I'm working under some restrictions, outside of my control, namely the CI/CD pipeline and the infrastructure in general.
I've been testing my kustomizations on my local console which has v1.21, but my pipeline is running v1.17.
So components
are out, and apparently so is patching multiple resources with the patches
object: https://github.com/kubernetes-sigs/kustomize/issues/1373#issuecomment-618439078
And no, directly invoking kustomize
(of any version) is not available either.
Not using components, I can deal with, but multi-patching support seems incredibly basic.
Here's a basic example of what I was doing:
root
|- kube
|- kustomize
|- base
| |- job_dir
| | |- job1.yml
| | |- ..
| |- job.patch.yml
| | # config that applies to some jobs
| |- kustomization.yml
| # resources:
| # - job_dir/job1.yml
| # - ..
| #
| # patches:
| # - target:
| # kind: Job
| # patch: |-
| # - op: add
| # ..
| # - path: job.patch.yml
| # target:
| # kind: Job
| # labelSelector: patchWith=job.patch
|- overlays
|- dev
| |- kustomization.yml
| # images: ..
|- prod
|- kustomization.yml
# images: ..
executed with kubectl 1.17:
$ kubectl apply -k kube/kustomize/base
error: json: cannot unmarshal object into Go struct field Kustomization.patchesStrategicMerge of type patch.StrategicMerge
executed with kubectl 1.20+:
kubectl apply -k kube/kustomize/base
job.batch/job1 created
job.batch/..
Without multi-patching, can I emulate the same behavior somehow?
Preferably with using some templating tool like jinja2
.
Worth noting that the infrastructure's actual Kubernetes instance is running v1.20, so there's some restrictions there, too. (for instance, why I'm not just using indexed jobs ಠ_ಠ) So, if there's a way to