Skip to content

lookup function not working on argocd #330

@DrummyFloyd

Description

@DrummyFloyd

Can you please provide an alternative way to handle secrets {{ .Release.Name}}-lapi-secrets?

Because at the moment it's managed with this:

{{/*
Generate CS_LAPI_SECRET if not specified in values
*/}}
{{ define "lapi.csLapiSecret" }}
{{- if and (not .Values.lapi.enabled) (not .Values.lapi.secrets.csLapiSecret) }}
  {{- fail "lapi.enabled is false, but no lapi.secrets.csLapiSecret provided" }}
{{- end }}
{{- if .Values.lapi.secrets.csLapiSecret }}
  {{- .Values.lapi.secrets.csLapiSecret -}}
{{- else if (lookup "v1" "Secret" .Release.Namespace "crowdsec-lapi-secrets").data }}
  {{- $obj := (lookup "v1" "Secret" .Release.Namespace "crowdsec-lapi-secrets").data -}}
  {{- index $obj "csLapiSecret" | b64dec -}}
{{- else -}}
  {{- randAscii 64 -}}
{{- end -}}
{{- end -}}

{{/*
Generate registrationToken if not specified in values
*/}}
{{ define "lapi.registrationToken" }}
{{- if and (not .Values.lapi.enabled) (empty .Values.lapi.secrets.registrationToken) }}
  {{- fail "lapi.enabled is false, but no lapi.secrets.registrationToken provided" }}
{{- end }}
{{- if .Values.lapi.secrets.registrationToken }}
  {{- .Values.lapi.secrets.registrationToken -}}
{{- else if (lookup "v1" "Secret" .Release.Namespace "crowdsec-lapi-secrets").data }}
  {{- $obj := (lookup "v1" "Secret" .Release.Namespace "crowdsec-lapi-secrets").data -}}
  {{- index $obj "registrationToken" | b64dec -}}
{{- else -}}
  {{- randAlphaNum 48 -}}
{{- end -}}
{{- end -}}

But this mechanism isn't handled by ArgoCD (despite these open issues: argoproj/argo-cd#21745 argoproj/argo-cd#5202).

The lack of lookup support is starting to be noisy, especially when you use stakater/reloader

agent/lapi/appsec:
  deployAnnotations:
    reloader.stakater.com/auto: "true"

For instance, on every sync of ArgoCD, new secrets will be generated, then a new deployment of all the services will occur.

I know this is not directly a real problem of CrowdSec, but it would be really appreciated.

Thank you!

│ time="2026-02-13T11:13:05Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T11:14:40Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T11:14:40Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T12:00:48Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T12:00:48Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T12:12:45Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T12:12:45Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T12:31:17Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T12:31:17Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T14:16:13Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T14:16:13Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T14:42:46Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T14:42:46Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T14:53:55Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T14:53:55Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T15:10:53Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T15:10:53Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T15:16:52Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T15:16:52Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T15:19:20Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T15:19:20Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T15:25:10Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T15:25:10Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T15:48:23Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T15:48:23Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T16:06:21Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T16:06:21Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T16:10:28Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T16:10:28Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T16:20:44Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T16:20:44Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T16:21:52Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T16:21:52Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"                                                                                                            │
│ time="2026-02-13T16:28:20Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-appsec' of type 'Deployment' in namespace 'crowdsec'"                                                                                                          │
│ time="2026-02-13T16:28:20Z" level=info msg="Changes detected in 'crowdsec-lapi-secrets' of type 'SECRET' in namespace 'crowdsec'; updated 'crowdsec-lapi' of type 'Deployment' in namespace 'crowdsec'"   

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions