mirror of https://github.com/linkerd/linkerd2.git
When injecting a Cronjob with no `spec.jobTemplate.spec.template.metadata` we were getting the following error: ``` Error transforming resources: jsonpatch add operation does not apply: doc is missing path: "/spec/jobTemplate/spec/template/metadata/annotations" ``` This only happens to Cronjobs because other workloads force having at least a label there that is used in `spec.selector` (at least as of v1 workloads). With this fix, if no metadata is detected, then we add it in the json patch when injecting, prior to adding the injection annotation. I've added a couple of new unit tests, one that verifies that this doesn't remove metadata contents in Cronjobs that do have that metadata, and another one that tests injection in Cronjobs that don't have metadata (which I verified it failed prior to this fix). |
||
---|---|---|
.. | ||
templates | ||
Chart.yaml | ||
requirements.lock | ||
requirements.yaml |