Description
Use-cases
- Injecting Istio sidecars without mutating webhook and
istioctl
. You don't even need to fork upstream charts or modify your chart. - Modify K8s resources produced by an upstream chart even if there's no configuration via
values.yaml
exposed.
Again this is a shameless plug: Adding helm-x
integration to helmfile would allow you to apply patches(JSON Patch and Strategic-Merge Patch) before helm-installing it, and that's possible without modifying or forking it.
releases:
- name: myapp
chart: sp/podinfo
# version is required because it isn't provided by kustomization by its nature!
version: 2.0.1
patches:
- jsonpatch.yaml
- strategicmergepatch.yaml
# inline json patch
- target:
group: autoscaling
version: v2beta1
kind: HorizontalPodAutoscaler
name: myapp-podinfo
patch:
- op: replace
path: /spec/maxReplicas
value: 1
# inline strategic-merge patch
- apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: myapp-podinfo
labels:
app: podinfo
chart: podinfo-2.0.1
release: myapp
heritage: Tiller
spec:
scaleTargetRef:
apiVersion: apps/v1beta2
kind: Deployment
name: myapp-podinfo
minReplicas: 3
The patches
setting results in running helm x upgrade --json-patch jsonpatch.yaml --strategic-merge-patch strategicmergepatch.yaml sp/podinfo --version 2.0.1
...on
helmfile syncfor example, that has the same effect as running (1)
helm template -o dir/to render the chart to a directory and (2) crerating
kustomization.yamlwith all the rendered manifests in its
resources:section and corresponding patch definitions in it and (3) running
kustomize buildto apply patches to all the manifests in the dir and (4) finally installing it as a local chart by running
helm upgrade temp/local/chart`.
See https://github.com/mumoshu/helm-x for more information.