Skip to content

Commit

Permalink
Extend project-robbie RBAC across all project-robbie projects
Browse files Browse the repository at this point in the history
Configure consistent RBAC in all project-robbie namespaces:

- project-robbie-6f75ac
- project-robbie-8dd79e
- project-robbie-b4784c

These changes included custom configuration for the Kustomize namespace
transformer so that it will update the namespace for all subjects listed in
the RoleBindings. See [1] for an example configuration, and [2] for what
passes for documentation.

[1]: kubernetes-sigs/kustomize#629 (comment)
[2]: kubernetes-sigs/kustomize#4704
  • Loading branch information
larsks committed Oct 22, 2024
1 parent 184229f commit 9f5f8f3
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- project-robbie-6f75ac
- project-robbie-8dd79e
- project-robbie-b4784c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- project-robbie-allow-sys-admin.yaml

transformers:
- |-
apiVersion: builtin
kind: NamespaceTransformer
metadata:
name: notImportantHere
namespace: project-robbie-6f75ac
setRoleBindingSubjects: allServiceAccounts
fieldSpecs:
- path: metadata/namespace
create: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: project-robbie-allow-sys-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: nerc-allow-sys-admin
subjects:
- kind: ServiceAccount
name: robbie-job-runner
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- project-robbie-allow-sys-admin.yaml

transformers:
- |-
apiVersion: builtin
kind: NamespaceTransformer
metadata:
name: notImportantHere
namespace: project-robbie-8dd79e
setRoleBindingSubjects: allServiceAccounts
fieldSpecs:
- path: metadata/namespace
create: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: project-robbie-allow-sys-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: nerc-allow-sys-admin
subjects:
- kind: ServiceAccount
name: robbie-job-runner
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: project-robbie-b4784c
resources:
- project-robbie-allow-sys-admin.yaml

transformers:
- |-
apiVersion: builtin
kind: NamespaceTransformer
metadata:
name: notImportantHere
namespace: project-robbie-b4784c
setRoleBindingSubjects: allServiceAccounts
fieldSpecs:
- path: metadata/namespace
create: true
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ roleRef:
name: nerc-allow-sys-admin
subjects:
- kind: ServiceAccount
namespace: project-robbie-b4784c
name: robbie-job-runner

0 comments on commit 9f5f8f3

Please sign in to comment.