kustomize: Json Patch fails on v3.0.0
kustomize version
Version: {KustomizeVersion:3.0.0 GitCommit:e0bac6ad192f33d993f11206e24f6cda1d04c4ec BuildDate:2019-07-03T18:21:24Z GoOs:linux GoArch:amd64}
Observed that a jsonPatch that works for bundled kustomize 2.0.3 and 2.1.0 fails to build with 3.0.0. The error returned is
Error: no matches for OriginalId extensions_v1beta1_Deployment|~X|external-dns; no matches for CurrentId extensions_v1beta1_Deployment|~X|external-dns; failed to find unique target for patch extensions_v1beta1_Deployment|external-dns
My deployment base contains:
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: external-dns
namespace: kube-system
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: external-dns
annotations:
iam.amazonaws.com/role: changeme
spec:
serviceAccountName: external-dns
containers:
- name: external-dns
image: registry.opensource.zalan.do/teapot/external-dns:latest
args:
- --source=service
- --source=ingress
My overlay kustomization
resources:
- ../base
patchesJson6902:
- target:
group: extensions
version: v1beta1
kind: Deployment
name: external-dns
path: deployment-patch.yaml
My jsonPatch
- op: replace
path: /spec/template/metadata/annotations/iam.amazonaws.com~1role
value: arn:aws:iam::123456:role/ExternalDNS
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (5 by maintainers)
Try
That’s funny because with kustomize
v2.1.0, if you specify the namespace on the patch, and the namespace isn’t specified in the resource but only in thekustomization.yml(or if you specify a namespace in the resource that is not the same as the one in the kustomization.yml, like a place holder for instance), then you get an errorWith kustomize
v3.0.0:I didn’t see anything related to that change in the patch behaviour regarding namespaces in the changelog (but I may have missed it)
ok so turns out that
this … could be a bit clearer
Oops I figured it out. The correct namespace is kubeflow, as specified in the base - now I’m on to the next bug 😃
I’m getting the same bug trying to follow through the MNIST example in the end-to-end Kubeflow Guide. How would I change that file? Simply adding “namespace: kube-system” didn’t do it 😦