Istio Operator: How to find list item path by key/value with k8s.overlays

8/9/2021

I'm trying to patch podAntiAffinity for istio ingressgateway via IstioOperator manifest and k8s.overlays but always getting something like:

podAffinityTerm is not a valid key:value path element Here is my config:

apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
  profile: default
  values:
    gateways:
      istio-ingressgateway:
        podAntiAffinityTermLabelSelector:
        - key: app
          operator: In
          values: istio-ingressgateway
          topologyKey: topology.kubernetes.io/zone
  components:
    ingressGateways:
      - name: istio-ingressgateway
        enabled: true
      - name: istio-ingressgateway-private
        enabled: true
        k8s:
          overlays:
            - kind: Deployment
              name: istio-ingressgateway-private
              patches:
                - path: metadata.labels.app
                  value: istio-ingressgateway-private
                - path: spec.template.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.[podAffinityTerm.topologyKey:topology.kubernetes.io/zone].labelSelector.matchExpressions[0].values[0]
                  value: istio-ingressgateway-private

Exact error: Error: path spec.template.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.podAffinityTerm.topologyKey:"topology.kubernetes.io/zone".labelSelector.matchExpressions.0.values.0: [podAffinityTerm is not a valid key:value path element, path spec.template.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.podAffinityTerm.topologyKey:"topology.kubernetes.io/zone".labelSelector.matchExpressions.0.values.0: [podAffinityTerm is not a valid key:value path element

Also, it works fine if I'm using an index instead of key/value pair.
Thanks for any advices.
P.S. Istio version is 1.10.3

-- neopug
istio
istio-operator
kubernetes

0 Answers