kubernetes-sigs / kustomize

Customization of kubernetes YAML configurations
Apache License 2.0
11.02k stars 2.25k forks source link

Error: Multiple matches for name / ServiceAccount #1352

Closed looztra closed 5 years ago

looztra commented 5 years ago

Structure

Git repository with test files : https://github.com/looztra/kustomize-multibase-multiple-match-error

What works

What fails but is expected to work

Error message :

╰─» asdf global kustomize v2.0.3
╰─» kustomize build overlays/both/
Error: Multiple matches for name ~G_v1_ServiceAccount|apps-integration|~P|faros|~S:
  [~G_v1_ServiceAccount|apps-integration|~P|faros|~S ~G_v1_ServiceAccount|apps-demo|~P|faros|~S]

╰─» asdf global kustomize v2.1.0
╰─» kustomize build overlays/both/
Error: string case - multiple matches for ~G_v1_ServiceAccount|~X|faros:
  [~G_v1_ServiceAccount|apps-demo|faros
 ~G_v1_ServiceAccount|apps-integration|faros
]

╰─» asdf global kustomize v3.0.2
╰─» kustomize build overlays/both/
Error: string case - multiple matches for ~G_v1_ServiceAccount|~X|faros:
  [~G_v1_ServiceAccount|apps-demo|faros
 ~G_v1_ServiceAccount|apps-integration|faros
]

Context

Looked like #557 that has been fixed by #1344 but still fails with v3.0.2 (no namePrefix/Suffix in my usecase)

Any idea?

jbrette commented 5 years ago

This seems to be fixed by this PR

kustomize build overlays/both/
apiVersion: v1
kind: ServiceAccount
metadata:
  name: faros
  namespace: apps-demo
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: faros
  namespace: apps-integration
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: faros-clustergittrackobjects-viewer--apps-demo
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: faros-clustergittrackobjects-viewer
subjects:
- kind: ServiceAccount
  name: faros
  namespace: apps-demo
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: faros-clustergittrackobjects-viewer--apps-integration
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: faros-clustergittrackobjects-viewer
subjects:
- kind: ServiceAccount
  name: faros
  namespace: apps-integration
looztra commented 5 years ago

I will give it a try asap, thanks!

looztra commented 5 years ago

I checked and it works, great job, thanks!

looztra commented 5 years ago

fixed in v3.0.3

thank you!