review feedback: tune rbd provisioner rbac

Signed-off-by: Huamin Chen <hchen@redhat.com>
This commit is contained in:
Huamin Chen 2019-01-23 10:05:15 -05:00
parent 7caf03b556
commit e0e764b3a1
12 changed files with 93 additions and 39 deletions

View File

@ -1,13 +1,13 @@
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: csi-attacher name: cephfs-csi-attacher
--- ---
kind: ClusterRole kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: external-attacher-runner name: cephfs-external-attacher-runner
rules: rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["events"] resources: ["events"]
@ -26,12 +26,12 @@ rules:
kind: ClusterRoleBinding kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: csi-attacher-role name: cephfs-csi-attacher-role
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: csi-attacher name: cephfs-csi-attacher
namespace: default namespace: default
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
name: external-attacher-runner name: cephfs-external-attacher-runner
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io

View File

@ -24,7 +24,7 @@ spec:
labels: labels:
app: csi-cephfsplugin-attacher app: csi-cephfsplugin-attacher
spec: spec:
serviceAccount: csi-attacher serviceAccount: cephfs-csi-attacher
containers: containers:
- name: csi-cephfsplugin-attacher - name: csi-cephfsplugin-attacher
image: quay.io/k8scsi/csi-attacher:v1.0.0 image: quay.io/k8scsi/csi-attacher:v1.0.0

View File

@ -24,7 +24,7 @@ spec:
labels: labels:
app: csi-cephfsplugin-provisioner app: csi-cephfsplugin-provisioner
spec: spec:
serviceAccount: csi-provisioner serviceAccount: cephfs-csi-provisioner
containers: containers:
- name: csi-provisioner - name: csi-provisioner
image: quay.io/k8scsi/csi-provisioner:v1.0.0 image: quay.io/k8scsi/csi-provisioner:v1.0.0
@ -44,7 +44,7 @@ spec:
privileged: true privileged: true
capabilities: capabilities:
add: ["SYS_ADMIN"] add: ["SYS_ADMIN"]
image: 127.0.0.1/root/cephfsplugin:v1.0.0 image: quay.io/cephcsi/cephfsplugin:v1.0.0
args : args :
- "--nodeid=$(NODE_ID)" - "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)" - "--endpoint=$(CSI_ENDPOINT)"

View File

@ -11,7 +11,7 @@ spec:
labels: labels:
app: csi-cephfsplugin app: csi-cephfsplugin
spec: spec:
serviceAccount: csi-nodeplugin serviceAccount: cephfs-csi-nodeplugin
hostNetwork: true hostNetwork: true
# to use e.g. Rook orchestrated cluster, and mons' FQDN is # to use e.g. Rook orchestrated cluster, and mons' FQDN is
# resolved through k8s service, set dns policy to cluster first # resolved through k8s service, set dns policy to cluster first

View File

@ -1,13 +1,13 @@
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: csi-nodeplugin name: cephfs-csi-nodeplugin
--- ---
kind: ClusterRole kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: csi-nodeplugin name: cephfs-csi-nodeplugin
rules: rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["nodes"] resources: ["nodes"]
@ -29,12 +29,12 @@ rules:
kind: ClusterRoleBinding kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: csi-nodeplugin name: cephfs-csi-nodeplugin
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: csi-nodeplugin name: cephfs-csi-nodeplugin
namespace: default namespace: default
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
name: csi-nodeplugin name: cephfs-csi-nodeplugin
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io

View File

@ -1,13 +1,13 @@
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: csi-provisioner name: cephfs-csi-provisioner
--- ---
kind: ClusterRole kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: external-provisioner-runner name: cephfs-external-provisioner-runner
rules: rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["secrets"] resources: ["secrets"]
@ -32,12 +32,12 @@ rules:
kind: ClusterRoleBinding kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: csi-provisioner-role name: cephfs-csi-provisioner-role
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: csi-provisioner name: cephfs-csi-provisioner
namespace: default namespace: default
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
name: external-provisioner-runner name: cephfs-external-provisioner-runner
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io

View File

@ -1,13 +1,13 @@
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: csi-attacher name: rbd-csi-attacher
--- ---
kind: ClusterRole kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: external-attacher-runner name: rbd-external-attacher-runner
rules: rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["events"] resources: ["events"]
@ -26,12 +26,12 @@ rules:
kind: ClusterRoleBinding kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: csi-attacher-role name: rbd-csi-attacher-role
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: csi-attacher name: rbd-csi-attacher
namespace: default namespace: default
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
name: external-attacher-runner name: rbd-external-attacher-runner
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io

View File

@ -1,13 +1,13 @@
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: csi-nodeplugin name: rbd-csi-nodeplugin
--- ---
kind: ClusterRole kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: csi-nodeplugin name: rbd-csi-nodeplugin
rules: rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["nodes"] resources: ["nodes"]
@ -23,18 +23,18 @@ rules:
verbs: ["get", "list", "watch", "update"] verbs: ["get", "list", "watch", "update"]
- apiGroups: [""] - apiGroups: [""]
resources: ["configmaps"] resources: ["configmaps"]
verbs: ["get", "list", "create", "delete"] verbs: ["get", "list"]
--- ---
kind: ClusterRoleBinding kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: csi-nodeplugin name: rbd-csi-nodeplugin
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: csi-nodeplugin name: rbd-csi-nodeplugin
namespace: default namespace: default
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
name: csi-nodeplugin name: rbd-csi-nodeplugin
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io

View File

@ -1,13 +1,13 @@
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: csi-provisioner name: rbd-csi-provisioner
--- ---
kind: ClusterRole kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: external-provisioner-runner name: rbd-external-provisioner-runner
rules: rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["secrets"] resources: ["secrets"]
@ -27,17 +27,20 @@ rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["endpoints"] resources: ["endpoints"]
verbs: ["get", "create", "update"] verbs: ["get", "create", "update"]
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "list", "create", "delete"]
--- ---
kind: ClusterRoleBinding kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: csi-provisioner-role name: rbd-csi-provisioner-role
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: csi-provisioner name: rbd-csi-provisioner
namespace: default namespace: default
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
name: external-provisioner-runner name: rbd-external-provisioner-runner
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io

View File

@ -24,7 +24,7 @@ spec:
labels: labels:
app: csi-rbdplugin-attacher app: csi-rbdplugin-attacher
spec: spec:
serviceAccount: csi-attacher serviceAccount: rbd-csi-attacher
containers: containers:
- name: csi-rbdplugin-attacher - name: csi-rbdplugin-attacher
image: quay.io/k8scsi/csi-attacher:v1.0.0 image: quay.io/k8scsi/csi-attacher:v1.0.0

View File

@ -24,7 +24,7 @@ spec:
labels: labels:
app: csi-rbdplugin-provisioner app: csi-rbdplugin-provisioner
spec: spec:
serviceAccount: csi-provisioner serviceAccount: rbd-csi-provisioner
containers: containers:
- name: csi-provisioner - name: csi-provisioner
image: quay.io/k8scsi/csi-provisioner:canary image: quay.io/k8scsi/csi-provisioner:canary
@ -33,12 +33,63 @@ spec:
- "--v=5" - "--v=5"
env: env:
- name: ADDRESS - name: ADDRESS
value: /var/lib/kubelet/plugins/csi-rbdplugin/csi.sock value: /var/lib/kubelet/plugins/csi-rbdplugin/csi-provisioner.sock
imagePullPolicy: "IfNotPresent" imagePullPolicy: "IfNotPresent"
volumeMounts: volumeMounts:
- name: socket-dir - name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
- name: csi-rbdplugin
securityContext:
privileged: true
capabilities:
add: ["SYS_ADMIN"]
image: quay.io/cephcsi/rbdplugin:v1.0.0
args :
- "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
- "--v=5"
- "--drivername=csi-rbdplugin"
- "--containerized=true"
- "--metadatastorage=k8s_configmap"
env:
- name: HOST_ROOTFS
value: "/rootfs"
- name: NODE_ID
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins/csi-rbdplugin/csi-provisioner.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
- mountPath: /dev
name: host-dev
- mountPath: /rootfs
name: host-rootfs
- mountPath: /sys
name: host-sys
- mountPath: /lib/modules
name: lib-modules
readOnly: true
volumes: volumes:
- name: host-dev
hostPath:
path: /dev
- name: host-rootfs
hostPath:
path: /
- name: host-sys
hostPath:
path: /sys
- name: lib-modules
hostPath:
path: /lib/modules
- name: socket-dir - name: socket-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins/csi-rbdplugin path: /var/lib/kubelet/plugins/csi-rbdplugin

View File

@ -11,7 +11,7 @@ spec:
labels: labels:
app: csi-rbdplugin app: csi-rbdplugin
spec: spec:
serviceAccount: csi-nodeplugin serviceAccount: rbd-csi-nodeplugin
hostNetwork: true hostNetwork: true
hostPID: true hostPID: true
# to use e.g. Rook orchestrated cluster, and mons' FQDN is # to use e.g. Rook orchestrated cluster, and mons' FQDN is