-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
namespace transformation fails to update rolebinding subject #1377
Comments
@richardmarshall The #1379 has been merged. Can you check it and close the bug. |
@jbrette Looks good, closing. |
It seems like #1379 (f649b62 to be precise) broke our setup with replacing the namespace. We are using kubebuilder and kustomize on top of it. Here is a simplified example which reproduces the issue:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: "foo"
bases:
- ../manager
resources:
- clusterRoleBinding.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: null
name: manager-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: manager-role
subjects:
- kind: ServiceAccount
name: default
namespace: system After running apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: null
name: manager-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: manager-role
subjects:
- kind: ServiceAccount
name: default
namespace: system Expected was: apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: null
name: manager-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: manager-role
subjects:
- kind: ServiceAccount
name: default
namespace: foo So far I tried to find a workaround for this issue with no success? Did the syntax to replace the namespace changed or is this a new bug? |
@jannickfahlbusch Thank you for reporting the issue. This is a new bug. The namespace transformation on |
Interesting, I just tried to change the name of the ServiceAccount to a value different than |
@jannickfahlbusch This is fixed in 3.1.0. |
Just to say that this is still not working in
The above keeps the namespace as However if I modify the subjects as:
Kustomize will work correctly and replace namespace with |
By the way also by using vars it won't work:
|
@YiannisGkoufas Could you provide the definition of your ServiceAccount? |
I don't think it would make any difference, since I haven't even included it in the resources.
|
@YiannisGkoufas Seems dup with #2906 |
Yep indeed! So the ServiceAccount and the reference on the ClusterRoleBinding need to have as namespace "default" for it to be replaced. Should be documented somewhere though :) |
Good to hear that solves your problem. /close |
Starting in v3.0.3 if a resource is included with the same namespace as the target for the namespace transformer the service account update for rolebindings will not set the namespace correctly.
For the following kustomization and resources:
Output from v3.0.2
Output from v3.0.3
In v3.0.3 the subject of the ClusterRoleBinding has a null namespace instead of the expected value
foo
.Without the explicit
.metadata.namespace
in the configmap the update of the role binding works as expected.Discovered in this slack thread for more context:
https://kubernetes.slack.com/archives/C9A5ALABG/p1563542754114100
Will look into what is causing this when I have some available time.
The text was updated successfully, but these errors were encountered: