Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

json-patch wildcard usage in argocd manifest

Is it possible to replace this

---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: elastic-operator
  labels:
    argocd.application.type: "system"
spec:
  ignoreDifferences:
    - group: admissionregistration.k8s.io
      kind: ValidatingWebhookConfiguration
      jsonPointers:
        - /webhooks/0/clientConfig/caBundle
    - group: admissionregistration.k8s.io
      kind: ValidatingWebhookConfiguration
      jsonPointers:
        - /webhooks/1/clientConfig/caBundle
    - group: admissionregistration.k8s.io
      kind: ValidatingWebhookConfiguration
      jsonPointers:
        - /webhooks/2/clientConfig/caBundle

For something that uses a "wildcard" instead? The following is a "non-working" example of what I'm looking for:

---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: elastic-operator
  labels:
    argocd.application.type: "system"
spec:
  ignoreDifferences:
    - group: admissionregistration.k8s.io
      kind: ValidatingWebhookConfiguration
      jsonPointers:
        - /webhooks/[*]/clientConfig/caBundle

I wasn't able to find anything in their doc that said that this is possible nor the opposite. i.e.https://argoproj.github.io/argo-cd/user-guide/diffing/ It seems that "json-patch" is being used but reading some of the RFCs, I was not able to find anything about wildcards either.

Thank you!

like image 800
carrotcakeslayer Avatar asked Sep 02 '20 17:09

carrotcakeslayer


Video Answer


1 Answers

Just in case someone else faces this. The answer is no, json patch does not allow to use that expression. Luckly, newer versions of argocd enable the usage of json path (!=patch) by the new "jqPathExpressions":

data:
  resource.customizations: |
    admissionregistration.k8s.io/MutatingWebhookConfiguration:
      ignoreDifferences: |
        jqPathExpressions:
        - '.webhooks[]?.clientConfig.caBundle'
like image 122
carrotcakeslayer Avatar answered Dec 18 '22 12:12

carrotcakeslayer