Skip to content

Commit

Permalink
build: add NFS provisioner RBAC to generated artifacts
Browse files Browse the repository at this point in the history
Signed-off-by: Niels de Vos <ndevos@ibm.com>
  • Loading branch information
nixpanic committed Mar 14, 2024
1 parent c060aa6 commit cb416a6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
4 changes: 4 additions & 0 deletions deploy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ all: \
cephfs/kubernetes/csi-config-map.yaml \
nfs/kubernetes/csidriver.yaml \
nfs/kubernetes/csi-config-map.yaml \
nfs/kubernetes/csi-provisioner-rbac.yaml \
rbd/kubernetes/csidriver.yaml \
rbd/kubernetes/csi-config-map.yaml

Expand All @@ -37,6 +38,9 @@ nfs/kubernetes/csidriver.yaml: ../api/deploy/kubernetes/nfs/csidriver.yaml ../ap
nfs/kubernetes/csi-config-map.yaml: ../api/deploy/kubernetes/nfs/csi-config-map.*
$(MAKE) -C ../tools generate-deploy

nfs/kubernetes/csi-provisioner-rbac.yaml: ../api/deploy/kubernetes/nfs/csi-provisioner-rbac*
$(MAKE) -C ../tools generate-deploy

rbd/kubernetes/csidriver.yaml: ../api/deploy/kubernetes/rbd/csidriver.yaml ../api/deploy/kubernetes/rbd/csidriver.go
$(MAKE) -C ../tools generate-deploy

Expand Down
34 changes: 18 additions & 16 deletions deploy/nfs/kubernetes/csi-provisioner-rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: nfs-csi-provisioner
#
# /!\ DO NOT MODIFY THIS FILE
#
# This file has been automatically generated by Ceph-CSI yamlgen.
# The source for the contents can be found in the api/deploy directory, make
# your modifications there.
#
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -51,25 +53,26 @@ rules:
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots"]
verbs: ["get", "list"]

---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: nfs-csi-provisioner-role
name: "nfs-csi-provisioner-role"
subjects:
- kind: ServiceAccount
name: nfs-csi-provisioner
namespace: default
name: "nfs-csi-provisioner"
namespace: "default"
roleRef:
kind: ClusterRole
name: nfs-external-provisioner-runner
apiGroup: rbac.authorization.k8s.io

---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
# replace with non-default namespace name
namespace: default
namespace: "default"
name: nfs-external-provisioner-cfg
rules:
# remove this once we stop supporting v1.0.0
Expand All @@ -79,18 +82,17 @@ rules:
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "watch", "list", "delete", "update", "create"]

---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: nfs-csi-provisioner-role-cfg
# replace with non-default namespace name
namespace: default
name: "nfs-csi-provisioner-role-cfg"
namespace: "default"
subjects:
- kind: ServiceAccount
name: nfs-csi-provisioner
# replace with non-default namespace name
namespace: default
name: "nfs-csi-provisioner"
namespace: "default"
roleRef:
kind: Role
name: nfs-external-provisioner-cfg
Expand Down
5 changes: 5 additions & 0 deletions tools/yamlgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ var yamlArtifacts = []deploymentArtifact{
reflect.ValueOf(nfs.NewCSIConfigMapYAML),
reflect.ValueOf(nfs.CSIConfigMapDefaults),
},
{
"../deploy/nfs/kubernetes/csi-provisioner-rbac.yaml",
reflect.ValueOf(nfs.NewCSIProvisionerRBACYAML),
reflect.ValueOf(nfs.CSIProvisionerRBACDefaults),
},
{
"../deploy/rbd/kubernetes/csidriver.yaml",
reflect.ValueOf(rbd.NewCSIDriverYAML),
Expand Down

0 comments on commit cb416a6

Please sign in to comment.