json-patch wildcard usage in argocd manifest
Asked Answered
B

1

9

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!

Boneblack answered 2/9, 2020 at 17:3 Comment(0)
B
5

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'
Boneblack answered 24/6, 2021 at 14:53 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.