argoproj / argo-helm

ArgoProj Helm Charts
https://argoproj.github.io/argo-helm/
Apache License 2.0
1.77k stars 1.88k forks source link

Notification log format and level are not configurable via ArgoCD params. #3010

Open chatelain-io opened 2 weeks ago

chatelain-io commented 2 weeks ago

Describe the bug

In the documentation, https://argo-cd.readthedocs.io/en/latest/operator-manual/argocd-cmd-params-cm-yaml/ it says that you can configure the notification controller via the ArgoCD params ConfigMap.

## Argo CD Notifications Controller Properties
# Set the logging level. One of: debug|info|warn|error (default "info")
notificationscontroller.log.level: "info"
# Set the logging format. One of: text|json (default "text")
notificationscontroller.log.format: "text"

The Helm chart do set the environment variables:

  env:
    - name: ARGOCD_NOTIFICATIONS_CONTROLLER_LOGLEVEL
      valueFrom:
        configMapKeyRef:
          key: notificationscontroller.log.level
          name: argocd-cmd-params-cm
          optional: true
    - name: ARGOCD_NOTIFICATIONS_CONTROLLER_LOGFORMAT
      valueFrom:
        configMapKeyRef:
          key: notificationscontroller.log.format
          name: argocd-cmd-params-cm
          optional: true

The issue is that the Helm chart set these variables in the container arguments, which override the environment variables.

# charts/argo-cd/templates/argocd-notifications/deployment.yaml
      containers:
        - name: {{ .Values.notifications.name }}
          image: {{ default .Values.global.image.repository .Values.notifications.image.repository }}:{{ default (include "argo-cd.defaultTag" .) .Values.notifications.image.tag }}
          imagePullPolicy: {{ default .Values.global.image.imagePullPolicy .Values.notifications.image.imagePullPolicy }}
          args:
            - /usr/local/bin/argocd-notifications
            - --metrics-port={{ .Values.notifications.containerPorts.metrics }}
            - --loglevel={{ default .Values.global.logging.level .Values.notifications.logLevel }}
            - --logformat={{ default .Values.global.logging.format .Values.notifications.logFormat }}
            - --namespace={{ include "argo-cd.namespace" . }}
            - --argocd-repo-server={{ template "argo-cd.repoServer.fullname" . }}:{{ .Values.repoServer.service.port }}
            - --secret-name={{ .Values.notifications.secret.name }}
            {{- range .Values.notifications.extraArgs }}
            - {{ . | squote }}
            {{- end }}

Related helm chart

argo-cd

Helm chart version

7.2.0, latest

To Reproduce

# values.yaml
configs:
  params:
    notificationscontroller.log.format: "json"
    notificationscontroller.log.level: "warn"
helm upgrade argocd argo/argocd --install --namespace=argocd --values values.yaml 

Expected behavior

The Helm chart should drop the configuration via the container arguments.

Screenshots

No response

Additional context

No response

onkar6699 commented 4 days ago

Even with server same issue i am facing log not getting reflected

onkar6699 commented 4 days ago

Even if you set in in deployment --loglevel=debug it wont reflect