Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Can't get jqPathExpressions based ignoreDifferences to work with various WebhookConfigurations #9323

Open
3 tasks done
spkane opened this issue May 6, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@spkane
Copy link

spkane commented May 6, 2022

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

Setting this ignoreDifferences block applies fine, but doesn't do anything.

  ignoreDifferences:
  - kind: MutatingWebhookConfiguration
    name: istio-sidecar-injector
    jqPathExpressions:
    - '.webhooks[]?.clientConfig.caBundle'
  - kind: ValidatingWebhookConfiguration
    name: istiod-default-validator
    jqPathExpressions:
    - '.webhooks[]?.failurePolicy'

To Reproduce

Applying this ArgoCD application:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: tetrate-istio
  namespace: argocd
  finalizers:
  - resources-finalizer.argocd.argoproj.io
spec:
  project: default
  source:
    repoURL: https://github.com/aws-samples/eks-blueprints-add-ons
    path: add-ons/tetrate-istio
    targetRevision: HEAD
  destination:
    server: https://kubernetes.default.svc
    namespace: istio-system
  syncPolicy:
    automated:
      prune: true
    retry:
      limit: 1
      backoff:
        duration: 5s
        factor: 2
        maxDuration: 1m
  ignoreDifferences:
  - group: apps
    kind: MutatingWebhookConfiguration
    name: istio-sidecar-injector
    jqPathExpressions:
    - '.webhooks[]?.clientConfig.caBundle'
  - group: apps
    kind: ValidatingWebhookConfiguration
    name: istiod-default-validator
    jqPathExpressions:
    - '.webhooks[]?.failurePolicy'

Should install istio and then you get two webhook configs which show diffs that aren't ignored.

CleanShot 2022-05-06 at 12 51 01

apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
  name: istiod-default-validator

CleanShot 2022-05-06 at 14 12 27

apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
  name: istio-sidecar-injector

CleanShot 2022-05-06 at 14 19 10

Expected behavior

I can ignore these expected diffs from the application manifest level.

Screenshots

Version

v2.3.3+07ac038

cc/ aws-samples/eks-blueprints-add-ons#37

@spkane spkane added the bug Something isn't working label May 6, 2022
@spkane
Copy link
Author

spkane commented May 6, 2022

I also have set this in the ArgoCD ConfigMap and it does not work either. ignoreAggregatedRoles works fine, but the admissionregistration.k8s.io/MutatingWebhookConfiguration section does not appear to do anything.

data:
  application.instanceLabelKey: argocd.argoproj.io/instance
  resource.compareoptions: |
    ignoreAggregatedRoles: true
    admissionregistration.k8s.io/MutatingWebhookConfiguration:
      ignoreDifferences: |
        jqPathExpressions:
        - '.webhooks[]?.clientConfig.caBundle'

@spkane spkane changed the title [Bug] [Bug] Can't get jqPathExpressions based ignoreDifferences to work with various WebhookConfigurations [Bug] Can't get jqPathExpressions based ignoreDifferences to work with various WebhookConfigurations May 6, 2022
@zostay
Copy link

zostay commented Jul 6, 2022

I had some difficulty with this as well. I suspect it came down to the namespace setting. I haven't dug into the code for argocd, but based on behavior, I'd guess that all/most fields in the spec have to be given. I was specifically struggling to find a way to ignore the failurePolicy field you mentioned. I found that this works:

  ignoreDifferences:                                                                                                                   
  - group: admissionregistration.k8s.io                                                                                                
    jqPathExpressions:                                                                                                                 
    - .webhooks[].failurePolicy                                                                                                        
    kind: ValidatingWebhookConfiguration                                                                                               
    name: istio-validator-istio-system   

I explicitly set namespace: "" when I edited the Application record, but I don't know if that was helpful or just a red herring. I don't really have time to dig further into it now. I hope that's helpful to someone.

@HenryXie1
Copy link

I use below to fix

ignoreDifferences:
    - group: admissionregistration.k8s.io
      kind: ValidatingWebhookConfiguration
      name: istiod-default-validator
      jsonPointers:
        - /webhooks/0/failurePolicy

@tyler-harpool
Copy link

To keep istio-sidecar-injector in sync here is what you would need.

  ignoreDifferences:
  - group: admissionregistration.k8s.io
    kind: MutatingWebhookConfiguration
    name: istio-sidecar-injector
    jqPathExpressions:
    - .webhooks[].namespaceSelector.matchExpressions[] | select(.key == "control-plane")

@blakepettersson
Copy link
Member

Seems like a duplicate of #9678?

@spkane
Copy link
Author

spkane commented Sep 25, 2023

Seems like a duplicate of #9678?

Well officially, this one came first, but if the problem is being worked on via the other issue that is good to hear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants