argoproj / argo-cd

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

unknown field "metadata.$setElementOrder/finalizers" warning in Application controller #20351

Open didlawowo opened 1 month ago

didlawowo commented 1 month ago

i'm using application set config with go template like, thoses are working fine but two things not work (the feature enabled true for cluster)

and i have a warn message like

unknown field "metadata.$setElementOrder/finalizers"

i don't know what i'm doing wrong ?

the two configs file are

{
    "source": {
        "repoURL": "https://argoproj.github.io/argo-helm",
        "targetRevision": "0.42.5",
        "chart": "argo-workflows"
    },
    "project": "testing-apps",
    "destination": {
        "namespace": "argo-workflows"
    },
    "syncPolicy": {
        "syncOptions": {
            "CreateNamespace": true
        }
    },
    "clusters": {
        "in-cluster": {
            "enabled": true,
            "valuesRevision": "main"
        }
    }
}
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: discovery-all-clusters
  namespace: kube-infra
spec:
  goTemplate: true
  generators:
  # Create a matrix generator that will install all chart in all clusters
  - matrix:
      generators:
      # Get all clusters
      - clusters: {}
      - git:
          repoURL: git@github.com:xxx/continuous-delivery.git
          #revision: main
          revision: main
          files:
          # Find all .argocd.json  in cc folder
          - path: 'deployed-charts/**/.argocd.json'
          values:
            # Add enabled field if clusters.${name}.enabled = true
            # name comes from the cluster generator
            enabled: '{{ dig "clusters" .name "enabled" false . }}'
            # selector:
            #   matchLabel:
            #     enabled: "true"
  template:
    metadata:
      name: '{{ .name }}-{{ .path.basename }}'
    spec:
      ignoreDifferences: ## for vault
      - group: admissionregistration.k8s.io
        kind: MutatingWebhookConfiguration
        jqPathExpressions:
        - .webhooks[]?.clientConfig.caBundle
      # project: '{{ .project }}'
      project: raspberry-apps
      sources:
      # First source is for value files
      # Default revision is HEAD but can be overriden with clusters.${name}.valuesRevision
      - repoURL: git@github.com:xxxx/continuous-delivery.git
        targetRevision: '{{ dig "clusters" .name "valuesRevision" "main" . }}'
        ref: values
      # Second source is for chart
      # Default revision is .source.targetRevision but can be overriden with clusters.${name}.chartRevision
      - repoURL: '{{ .source.repoURL }}'
        targetRevision: '{{ dig "clusters" .name "chartRevision" .source.targetRevision . }}'
        chart: '{{  default "" .source.chart }}'
        path: '{{  default "" .source.path }}'
        helm:
          #releaseName: '{{ .path.basename }}'
          valueFiles:
          - $values/{{ .path.path }}/values.yaml
          - $values/{{ .path.path }}/values.{{ .name }}.yaml
      destination:
        name: '{{ .name }}' ## from cluster generator
        namespace: '{{ .destination.namespace }}' ## from file json
      syncPolicy:
        automated:
          prune: true
          selfHeal: true
        syncOptions:
        - CreateNamespace={{ dig "syncPolicy" "syncOptions" "CreateNamespace" "true" . }}
        - ServerSideApply={{ dig "syncPolicy" "syncOptions" "ServerSideApply" "false" . }}
        retry:
          limit: 3 # number of failed sync attempt retries; unlimited number of attempts if less than 0
          backoff:
            duration: 15s # the amount to back off. Default unit is seconds, but could also be a duration (e.g. "2m", "1h")
            factor: 2 # a factor to multiply the base duration after each failed retry
            maxDuration: 20m

Checklist:

Describe the bug

unknown field "metadata.$setElementOrder/finalizers"

To Reproduce

just add config

Expected behavior

not warning

Version

Image: quay.io/argoproj/argocd:v2.12.4

Logs

Paste any relevant application logs here.
ChristianCiach commented 1 month ago

Did you recently enable "server-side diff" for your Argo-CD instance? The error message probably comes from kubectl when validating the generated Application resources.

Is your ApplicationSet generating Applications that you previously created manually?

Do you mind sharing your Argo-CD configuration?

Where exactly do you see this warning?

didlawowo commented 1 month ago

i see this warning in application controller log. i don't remember if i have application deployed manually maybe. i can share my config, but value file is huge... do you think there is a problem in my template ?

andrii-korotkov-verkada commented 2 weeks ago

Can you share the sources from git, please? If it's too big, maybe search for metadata, setElementOrder and finalizers and paste those parts.

didlawowo commented 1 week ago

i'm not sur what you want ?. i have provided the example above, what do you need ?

andrii-korotkov-verkada commented 1 week ago

Sorry, I meant helm charts and values.yaml files.

didlawowo commented 1 week ago

i can provide in private if you want.

andrii-korotkov-verkada commented 1 week ago

Feel free to send via CNCF Slack, I'm Andrii Korotkov (Verkada) there.