argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.47k stars 5.31k forks source link

Fluentd chart. ArgoCD does not replace "fileConfigs" values #7997

Open d-selifanov opened 2 years ago

d-selifanov commented 2 years ago

If you are trying to resolve an environment-specific issue or have a one-off question about the edge case that does not require a feature then please consider asking a question in argocd slack channel.

Checklist:

Describe the bug

Deploy problem fluentd helm chart (https://github.com/fluent/helm-charts/tree/main/charts/fluentd) via ArgoCD. ArgoCD does not replace "fileConfigs" values, but merge chart values and replacement values.

Deploy with helm goes fine (helm upgrade --install --wait fluentd fluentd -n logging --values values_app.yaml)

To Reproduce

Deploy fluentd chart with some values in fileConfigs.

For example:

kind: Application
metadata:
  name: devops.tcod2-fluentd
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: devops.tcod2
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
      allowEmpty: false
    syncOptions:
      - Validate=false
      - CreateNamespace=true
      - PrunePropagationPolicy=foreground
      - PruneLast=true
    retry:
      limit: 5
      backoff:
        duration: 5s
        factor: 2
        maxDuration: 3m
  destination:
    namespace: logging
    server: "https://k8s.local:6443"
  source:
    repoURL: "https://fluent.github.io/helm-charts"
    chart: "fluentd"
    targetRevision: "0.3.2"
    helm:
      releaseName: fluentd
      version: v3
      values: |
        nameOverride: ""
        fullnameOverride: ""

        kind: "DaemonSet"

        image:
          repository: "fluent/fluentd-kubernetes-daemonset"
          pullPolicy: "IfNotPresent"
          tag: "v1.14.3-debian-kafka2-1.0"

        imagePullSecrets: []

        serviceAccount:
          create: true
          annotations: {}
          name: null

        rbac:
          create: true

        podSecurityPolicy:
          enabled: true
          annotations: {}

        podSecurityContext: {}
        securityContext: {}

        lifecycle: {}

        livenessProbe:
          httpGet:
            path: /metrics
            port: metrics

        readinessProbe:
          httpGet:
            path: /metrics
            port: metrics

        resources: {}

        autoscaling:
          enabled: false
          minReplicas: 1
          maxReplicas: 100
          targetCPUUtilizationPercentage: 80
          customRules: []

        nodeSelector: {}

        tolerations: []

        affinity: {}

        annotations: {}

        labels: {}

        podAnnotations: {}

        podLabels: {}

        updateStrategy: {}

        env:
        - name: "FLUENTD_CONF"
          value: "../../etc/fluent/fluent.conf"

        envFrom: []

        volumes:
        - name: varlog
          hostPath:
            path: /var/log
        - name: egovdockercontainers
          hostPath:
            path: /egov/docker/containers
        - name: etcfluentd-main
          configMap:
            name: fluentd-main
            defaultMode: 0777
        - name: etcfluentd-config
          configMap:
            name: fluentd-config
            defaultMode: 0777

        volumeMounts:
        - name: varlog
          mountPath: /var/log
        - name: dockercontainers
          mountPath: /docker/containers
          readOnly: true
        - name: etcfluentd-main
          mountPath: /etc/fluent
        - name: etcfluentd-config
          mountPath: /etc/fluent/config.d/

        persistence:
          enabled: false
          storageClass: ""
          accessMode: ReadWriteOnce
          size: 10Gi

        service:
          type: "ClusterIP"
          annotations: {}
          ports: []

        metrics:
          serviceMonitor:
            enabled: true
            additionalLabels:
              release: prometheus-operator
            namespace: "monitoring"
            namespaceSelector: {}
            metricRelabelings: []
            relabelings: []

          prometheusRule:
            enabled: false
            additionalLabels: {}
            namespace: ""
            rules: []

        dashboards:
          enabled: "false"
          namespace: ""
          labels:
            grafana_dashboard: '"1"'

        plugins: []

        configMapConfigs:
          - fluentd-prometheus-conf

        fileConfigs:
          main.conf: |-
            <source>
              @type tail
              path "/var/log/containers/*.log"
              pos_file "/var/log/fluentdconnector-containers.log.pos"
              tag "kubernetes.*"
              <parse>
                @type "json"
                time_format "%Y-%m-%dT%H:%M:%S.%NZ"
              </parse>
            </source>
            <filter kubernetes.**>
                @type concat
                key log
                multiline_start_regexp /^\[\d{4}-\d{2}-\d{2}\s\d{2}\:\d{2}\:\d{2}\.\d{3}\]/
                flush_interval 3s
                timeout_label @NORMAL
            </filter>
            <filter kubernetes.**>
                @type kubernetes_metadata
            </filter>
            <match kubernetes.**>
              @type relabel
              @label @NORMAL
            </match>
            <label @NORMAL>
              <match kubernetes.**>
                @type  kafka2
                brokers kafka01:9092
                use_event_time        true
                default_topic         k8s
                required_acks         1
                <format>
                  @type json
                </format>
                <buffer horus-fluentd>
                  @type file
                  path /var/log/fluentd-buffers/kubernetes.buffer
                  flush_thread_count 100
                  flush_mode interval
                  flush_interval 5s
                  chunk_limit_size 20M
                  #chunk_full_threshold 0.90
                  #queue_limit_length 64
                  queued_chunks_limit_size 10
                  retry_max_interval 30
                  retry_forever true
                </buffer>
              </match>
            </label>

Expected behavior

Working configmap for fluentd.

Doing merge all configs (chart values + some values), but must be replacement to main.conf only.

Screenshots Снимок экрана от 2021-12-20 14-23-32 Снимок экрана от 2021-12-20 14-30-32

Version

{
    "Version": "v2.2.0+6da92a8",
    "BuildDate": "2021-12-14T18:09:18Z",
    "GitCommit": "6da92a8e8103ce4145bb0fe2b7e952be79c9ff0a",
    "GitTreeState": "clean",
    "GoVersion": "go1.16.11",
    "Compiler": "gc",
    "Platform": "linux/amd64",
    "KsonnetVersion": "v0.13.1",
    "KustomizeVersion": "v4.2.0 2021-06-30T22:49:26Z",
    "HelmVersion": "v3.7.1+g1d11fcb",
    "KubectlVersion": "v0.22.2",
    "JsonnetVersion": "v0.17.0"
}

Logs

Challouf commented 2 years ago

Hello, facing the same problem Any update on this ?!

d-selifanov commented 2 years ago

Hello, facing the same problem Any update on this ?!

Hi, use main.conf and other configs set blank:

` 01_sources.conf: |-

02_filters.conf: |-

03_dispatch.conf: |-

04_outputs.conf: |-`

lifehack :)

kgw7401 commented 1 year ago

I want to change 04_outputs.conf file. Does anyone know the answer?

----update---- @d-selifanov solution works! thanks bro