Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

namePrefix in base breaks patchesJson6902 in overlay #972

Closed
pohly opened this issue Apr 12, 2019 · 2 comments · Fixed by #1279
Closed

namePrefix in base breaks patchesJson6902 in overlay #972

pohly opened this issue Apr 12, 2019 · 2 comments · Fixed by #1279

Comments

@pohly
Copy link
Contributor

pohly commented Apr 12, 2019

For a reproducible test, see #971

I'm using kustomize master, currently 177297c

I'm trying to patch a DaemonSet, but kustomize keeps complaining that it couldn't find target apps_v1beta2_DaemonSet|~X|~P|pmem-csi-node|~S.
The target is defined as:

patchesJson6902:
- target:
    group: apps
    version: v1beta2
    kind: DaemonSet
    name: pmem-csi-node
  path: lvm-patch.yaml

and there such a DaemonSet in the output when I comment out that part above:

apiVersion: apps/v1beta2
kind: DaemonSet
metadata:
  name: pmem-csi-node

The problem is that the base has namePrefix: pmem-csi-, so pmem-csi-node is the result of a rename.

It works when using name: node.

This looks like a layering violation to me. The overlay shouldn't have to know how the base produces its output. For example, it might use namePrefix now and later get changed to .yaml files where that prefix gets inserted by hand. Then the output is the same, but the overlay no longer works.

It also is non-obvious to the user. It cost me a few hours to figure out the reason for the couldn't find target error, because I was matching my target specification against the output of the base.

@pohly
Copy link
Contributor Author

pohly commented Apr 12, 2019

Also, is there some documentation about the matching criteria in target? By trial-and-error I found out that group+version+kind seem to have to match exactly (i.e. one cannot leave out group or version if the base has it). Is it possible to match just by name, assuming that the name is unique? What is the ~X, ~P, ~S that is shown in the error message?

@jcassee
Copy link
Contributor

jcassee commented Apr 13, 2019

See also #316

pohly added a commit to pohly/kustomize that referenced this issue Apr 18, 2019
The expectation is that the base entity can be referenced by its name
with prefix, because the overlay shouldn't have to know how the base
is generated. But currently the entity is only found when using the
name without prefix.

Related-To: kubernetes-sigs#972
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants