RNK
RNK

Reputation: 5792

How can I add service annotation in istio operator patch

I am installing istio 1.6.0 using istioctl with below config file:

--
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
  profile: default
  components:
    egressGateways:
      - name: istio-egressgateway
        enabled: true
    ingressGateways:
      - name: istio-ingressgateway
        enabled: true
        k8s:
          overlays:
          - kind: Service
            name: istio-ingressgateway
            patches:
            - path: spec.loadBalancerIP
              value: x.x.x.x
            - path: spec.externalTrafficPolicy
              value: Local
            - path: metadata.annotations.[service.beta.kubernetes.io/azure-load-balancer-resource-group]
              value: az-rg-group

This part giving me an error:

- path: metadata.annotations.[service.beta.kubernetes.io/azure-load-balancer-resource-group]
  value: az-rg-group

Error: failed to apply manifests: errors occurred during operation

Path is not correct for annotation. How can I provide a path of annotation with valid syntax?

Following this sample code: https://github.com/istio/istio/blob/master/operator/samples/pilot-advanced-override.yaml

Upvotes: 2

Views: 2223

Answers (1)

redzack
redzack

Reputation: 1711

There is a new field for service annotations. The issue was raised here https://github.com/istio/istio/issues/20078

Please refer the following example ingressgateway_k8s_settings.yaml

apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
  components:
    pilot:
      enabled: false
    ingressGateways:
    - namespace: istio-system
      name: istio-ingressgateway
      enabled: true
      k8s:
        service:
          externalTrafficPolicy: Local
        serviceAnnotations:
          manifest-generate: "testserviceAnnotation"
        securityContext:
          sysctls:
          - name: "net.ipv4.ip_local_port_range"
            value: "80 65535"

Upvotes: 3

Related Questions