deploy attacher sidecar in rbd provisioner sts

currently we are deploying external-attacher
as a seperate statefulset, which leads to
attacher communicating with the node provisoner
daemonset, This PR deploys external-attacher
as a sidecar container inside provisioner
statefulset, so that external-provisioner
always communicates with the plugin responsible
for the provision controller capcabilities.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2019-03-27 10:29:40 +05:30
parent 426bf67966
commit 3ef11e06c3
4 changed files with 18 additions and 84 deletions

View File

@ -1,38 +0,0 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: rbd-csi-attacher
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: rbd-external-attacher-runner
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["csi.storage.k8s.io"]
resources: ["csinodeinfos"]
verbs: ["get", "list", "watch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: rbd-csi-attacher-role
subjects:
- kind: ServiceAccount
name: rbd-csi-attacher
namespace: default
roleRef:
kind: ClusterRole
name: rbd-external-attacher-runner
apiGroup: rbac.authorization.k8s.io

View File

@ -43,6 +43,12 @@ rules:
- apiGroups: ["csi.storage.k8s.io"] - apiGroups: ["csi.storage.k8s.io"]
resources: ["csinodeinfos"] resources: ["csinodeinfos"]
verbs: ["get", "list", "watch"] verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments"]
verbs: ["get", "list", "watch", "update"]
--- ---
kind: ClusterRoleBinding kind: ClusterRoleBinding

View File

@ -1,46 +0,0 @@
---
kind: Service
apiVersion: v1
metadata:
name: csi-rbdplugin-attacher
labels:
app: csi-rbdplugin-attacher
spec:
selector:
app: csi-rbdplugin-attacher
ports:
- name: dummy
port: 12345
---
kind: StatefulSet
apiVersion: apps/v1beta1
metadata:
name: csi-rbdplugin-attacher
spec:
serviceName: "csi-rbdplugin-attacher"
replicas: 1
template:
metadata:
labels:
app: csi-rbdplugin-attacher
spec:
serviceAccount: rbd-csi-attacher
containers:
- name: csi-rbdplugin-attacher
image: quay.io/k8scsi/csi-attacher:v1.0.1
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
env:
- name: ADDRESS
value: unix:///csi/csi-attacher.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /csi
volumes:
- name: socket-dir
hostPath:
path: /var/lib/kubelet/plugins/rbd.csi.ceph.com
type: DirectoryOrCreate

View File

@ -54,6 +54,18 @@ spec:
volumeMounts: volumeMounts:
- name: socket-dir - name: socket-dir
mountPath: /csi mountPath: /csi
- name: csi-rbdplugin-attacher
image: quay.io/k8scsi/csi-attacher:v1.0.1
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
env:
- name: ADDRESS
value: /csi/csi.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /csi
- name: csi-rbdplugin - name: csi-rbdplugin
securityContext: securityContext:
privileged: true privileged: true