argoproj / argo-cd

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

Diff identified for /spec/additionalPrinterColumns/*/priority field with value 0 #3889

Open ribbybibby opened 4 years ago

ribbybibby commented 4 years ago

Describe the bug If the priority field of an additionalPrinterColumns item in a CRD is set to 0, it is stripped by the api server and therefore registers as a diff when trying to sync it with ArgoCD.

To Reproduce

Sync this CRD with ArgoCD:

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: tridentversions.trident.netapp.io
spec:
  group: trident.netapp.io
  version: v1
  versions:
    - name: v1
      served: true
      storage: true
  scope: Namespaced
  names:
    plural: tridentversions
    singular: tridentversion
    kind: TridentVersion
    shortNames:
    - tver
    - tversion
    categories:
    - trident
    - trident-internal
  additionalPrinterColumns:
    - name: Version
      type: string
      description: The Trident version
      priority: 0 # <---- note priority
      JSONPath: .trident_version

Expected behavior

I would expect no diff to be generated.

Of course I can ignore the differences for these fields, but then if the priority changes in future versions of the CRD, ArgoCD won't identify that as a legitimate diff.

Given that this is a standard field on a primitve resource, perhaps Argo should be able to handle this itself.

Version

argocd: v1.5.4+36bade7
  BuildDate: 2020-05-05T19:02:56Z
  GitCommit: 36bade7a2d7b69d1c0b0c4d41191f792a847d61c
  GitTreeState: clean
  GoVersion: go1.14.1
  Compiler: gc
  Platform: darwin/amd64
argocd-server: v1.6.1+159674e
  BuildDate: 2020-06-19T00:41:05Z
  GitCommit: 159674ee844a378fb98fe297006bf7b83a6e32d2
  GitTreeState: clean
  GoVersion: go1.14.1
  Compiler: gc
  Platform: linux/amd64
  Ksonnet Version: v0.13.1
  Kustomize Version: {Version:kustomize/v3.6.1 GitCommit:c97fa946d576eb6ed559f17f2ac43b3b5a8d5dbd BuildDate:2020-05-27T20:47:35Z GoOs:linux GoArch:amd64}
  Helm Version: version.BuildInfo{Version:"v3.2.0", GitCommit:"e11b7ce3b12db2941e90399e874513fbd24bcb71", GitTreeState:"clean", GoVersion:"go1.13.10"}
  Kubectl Version: v1.14.0
OllowainT commented 3 years ago

It would be nice if this bug will be fixed in the future. As it is still open since mid of last year I just want to say, that I experienced this strange behavior in v2.1.6 also.

magf commented 2 years ago

It would be nice if this bug will be fixed in the future. As it is still open since mid of last year I just want to say, that I experienced this strange behavior in v2.1.6 also.

v2.3.4 - the bug is still there

Kazetsukai commented 2 years ago

Seeing this issue as well

RuBiCK commented 1 year ago

V2.4.4 and the bug still exist

lsoica commented 1 year ago

Hitting this as well with the ApiSix helm chart. Is there a way to workaround this issue?

tombowditch commented 1 year ago

Hitting this as well with the ApiSix helm chart. Is there a way to workaround this issue?

Try something like this in your Application...

  ignoreDifferences:
  - group: apiextensions.k8s.io
    kind: CustomResourceDefinition
    jqPathExpressions:
    - ..|.priority?

Really not the best, but this worked for me. You can make it much more specific, but I only have this for one specific application's CRD so no problem for me.

morremeyer commented 3 months ago

We have added the following key to the argocd-cm ConfigMap. This ignores all additionalPrinterColumns that have a priority of 0 for the whole ArgoCD instance:

    resource.customizations.ignoreDifferences.apiextensions.k8s.io_CustomResourceDefinition: |
      jqPathExpressions:
        - .spec.versions[].additionalPrinterColumns[].priority | select(. == 0)

With this, you do not need Application-specific configuration, and priorities that are not 0 will be part of the diff, since these are not removed by the API server and should still be diffed.

artemus717 commented 3 weeks ago

We have added the following key to the argocd-cm ConfigMap. This ignores all additionalPrinterColumns that have a priority of 0 for the whole ArgoCD instance:

    resource.customizations.ignoreDifferences.apiextensions.k8s.io_CustomResourceDefinition: |
      jqPathExpressions:
        - .spec.versions[].additionalPrinterColumns[].priority | select(. == 0)

With this, you do not need Application-specific configuration, and priorities that are not 0 will be part of the diff, since these are not removed by the API server and should still be diffed.

Could you advise which part this config should be added to? There are only URL & oidc.config in my argocd-cm configmap