# istio_custom-template.iop.yaml
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
  namespace: istio-system
  name: example-istiocontrolplane
spec:
  values:
    sidecarInjectorWebhook:
      templates:
        custom: |
          metadata:
            annotations:
              # Disable the built-in transformations. In the future we may want a template-level API
              prometheus.istio.io/merge-metrics: "false"
              sidecar.istio.io/rewriteAppHTTPProbers: "false"
              foo: bar
          spec:
            containers:
            {{- range $index, $container := .Spec.Containers }}
            - name: {{ $container.Name }}
              env:
              - name: SOME_ENV
                value: "true"
              - name: SOME_FILE
                value: /var/lib/data/foo.json
              volumeMounts:
              - mountPath: /var/lib/data/foo.json
                subPath: foo.json
                name: some-injected-file
            {{- end}}
            volumes:
            - name: some-injected-file
              downwardAPI:
                items:
                - path: foo.json
                  fieldRef:
                    fieldPath: "metadata.annotations['foo']"