Using JsonPatch in K8sObjectOverlay

Is it somehow possible to use JsonPatch (same as in kustomize https://tools.ietf.org/html/rfc6902) in https://istio.io/latest/docs/reference/config/istio.operator.v1alpha1/#K8sObjectOverlay? I need to change ingressGateway from Deployment to Daemonset. This was easy with helm/kustomize.

@ostromart can you help on this pls.

AFAIK we can do it https://istio.io/latest/docs/setup/install/istioctl/#patching-the-output-manifest

That uses K8sObjectOverlay. But you identify the object by its kind:

overlays:
- kind: Deployment
  name: istio-ingressgateway

It has to be replaced like this, e.g. with kustomize:

patchesJson6902:
- target:
    group: apps
    version: v1
    kind: Deployment
    namespace: istio-system
    name: istio-ingressgateway
  path: transform-gateway.yaml

#cat transform-gateway.yaml
- op: replace
  path: /kind
  value: DaemonSet

Ok in the end it is very simple:

# Istio Gateway feature
ingressGateways:
- name: istio-ingressgateway
  enabled: true
  k8s:
    overlays:
      - kind: Deployment
        name: istio-ingressgateway
        patches:
          - path: kind
            value: Daemonset
1 Like