Merge pull request #2839 from Madhu-1/fix-drivername

Fix driver name in ceph csi driver
This commit is contained in:
Travis Nielsen
2019-04-10 08:51:06 -06:00
committed by GitHub
20 changed files with 145 additions and 275 deletions
+1 -4
View File
@@ -59,15 +59,13 @@ NAME READY STATUS RESTARTS AGE
pod/csi-cephfsplugin-h5spd 2/2 Running 0 1d
pod/csi-cephfsplugin-provisioner-0 2/2 Running 0 1d
pod/csi-rbdplugin-4l6zg 2/2 Running 2 1d
pod/csi-rbdplugin-attacher-0 1/1 Running 0 1d
pod/csi-rbdplugin-provisioner-0 2/2 Running 2 1d
pod/csi-rbdplugin-provisioner-0 4/4 Running 2 1d
pod/rook-ceph-agent-zlm84 1/1 Running 0 1d
pod/rook-ceph-operator-c84954957-jdzk6 1/1 Running 0 1d
pod/rook-discover-66hjp 1/1 Running 0 1d
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/csi-cephfsplugin-provisioner ClusterIP 10.0.0.107 <none> 1234/TCP 1d
service/csi-rbdplugin-attacher ClusterIP 10.0.0.109 <none> 1234/TCP 1d
service/csi-rbdplugin-provisioner ClusterIP 10.0.0.56 <none> 1234/TCP 1d
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
@@ -84,7 +82,6 @@ replicaset.apps/rook-ceph-operator-c84954957 1 1 1 1d
NAME DESIRED CURRENT AGE
statefulset.apps/csi-cephfsplugin-provisioner 1 1 1d
statefulset.apps/csi-rbdplugin-attacher 1 1 1d
statefulset.apps/csi-rbdplugin-provisioner 1 1 1d
```
@@ -2,7 +2,7 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: csi-cephfs
provisioner: csi-cephfsplugin
provisioner: cephfs.csi.ceph.com
parameters:
# Comma separated list of Ceph monitors
# if using FQDN, make sure csi plugin's dns policy is appropriate.
@@ -3,7 +3,7 @@ apiVersion: snapshot.storage.k8s.io/v1alpha1
kind: VolumeSnapshotClass
metadata:
name: csi-rbdplugin-snapclass
snapshotter: csi-rbdplugin
snapshotter: rbd.csi.ceph.com
parameters:
pool: rbd
monitors: mon1:port,mon2:port,...
@@ -2,7 +2,7 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: csi-rbd
provisioner: csi-rbdplugin
provisioner: rbd.csi.ceph.com
parameters:
# Comma separated list of Ceph monitors
# if using FQDN, make sure csi plugin's dns policy is appropriate.
@@ -12,7 +12,6 @@ parameters:
# secret as admin/user credentials. "monValueFromSecret" provides the
# key in the secret whose value is the mons
#monValueFromSecret: "monitors"
# Ceph pool into which the RBD image shall be created
pool: rbd
@@ -14,7 +14,7 @@ rules:
verbs: ["get", "list"]
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
verbs: ["get", "list", "watch", "create", "delete", "update"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
@@ -1,38 +0,0 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: rook-csi-rbd-attacher-sa
namespace: rook-ceph
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: rbd-external-attacher-runner
rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["get", "list", "watch", "update"]
- 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"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: rbd-csi-attacher-role
subjects:
- kind: ServiceAccount
name: rook-csi-rbd-attacher-sa
namespace: rook-ceph
roleRef:
kind: ClusterRole
name: rbd-external-attacher-runner
apiGroup: rbac.authorization.k8s.io
@@ -15,10 +15,22 @@ rules:
verbs: ["get", "list"]
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
verbs: ["get", "list", "watch", "create", "delete", "update"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
@@ -23,22 +23,22 @@ spec:
- "--v=5"
env:
- name: ADDRESS
value: /var/lib/kubelet/plugins/csi-cephfsplugin/csi-provisioner.sock
value: unix:///csi/csi-provisioner.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
mountPath: /csi
- name: csi-cephfsplugin
securityContext:
privileged: true
capabilities:
add: ["SYS_ADMIN"]
image: {{ .CephFSPluginImage }}
args :
args:
- "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
- "--v=5"
- "--drivername=csi-cephfsplugin"
- "--drivername=cephfs.csi.ceph.com"
- "--metadatastorage=k8s_configmap"
env:
- name: NODE_ID
@@ -50,11 +50,11 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins/csi-cephfsplugin/csi-provisioner.sock
value: unix:///csi/csi-provisioner.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
mountPath: /csi
- name: host-sys
mountPath: /sys
- name: lib-modules
@@ -65,7 +65,7 @@ spec:
volumes:
- name: socket-dir
hostPath:
path: /var/lib/kubelet/plugins/csi-cephfsplugin
path: /var/lib/kubelet/plugins/cephfs.csi.ceph.com
type: DirectoryOrCreate
- name: host-sys
hostPath:
@@ -23,7 +23,7 @@ spec:
args:
- "--v=5"
- "--csi-address=/csi/csi.sock"
- "--kubelet-registration-path=/var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock"
- "--kubelet-registration-path=/var/lib/kubelet/plugins/cephfs.csi.ceph.com/csi.sock"
lifecycle:
preStop:
exec:
@@ -45,11 +45,11 @@ spec:
add: ["SYS_ADMIN"]
allowPrivilegeEscalation: true
image: {{ .CephFSPluginImage }}
args :
args:
- "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
- "--v=5"
- "--drivername=csi-cephfsplugin"
- "--drivername=cephfs.csi.ceph.com"
- "--metadatastorage=k8s_configmap"
env:
- name: NODE_ID
@@ -61,11 +61,11 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock
value: unix:///csi/csi.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: plugin-dir
mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
mountPath: /csi
- name: csi-plugins-dir
mountPath: /var/lib/kubelet/plugins/kubernetes.io/csi
mountPropagation: "Bidirectional"
@@ -82,7 +82,7 @@ spec:
volumes:
- name: plugin-dir
hostPath:
path: /var/lib/kubelet/plugins/csi-cephfsplugin/
path: /var/lib/kubelet/plugins/cephfs.csi.ceph.com/
type: DirectoryOrCreate
- name: csi-plugins-dir
hostPath:
@@ -1,35 +0,0 @@
kind: StatefulSet
apiVersion: apps/v1beta2
metadata:
name: csi-rbdplugin-attacher
namespace: {{ .Namespace }}
spec:
serviceName: csi-rbdplugin-attacher
replicas: 1
selector:
matchLabels:
app: csi-rbdplugin-attacher
template:
metadata:
labels:
app: csi-rbdplugin-attacher
spec:
serviceAccount: rook-csi-rbd-attacher-sa
containers:
- name: csi-rbdplugin-attacher
image: {{ .AttacherImage }}
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
env:
- name: ADDRESS
value: /var/lib/kubelet/plugins/csi-rbdplugin/csi.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
volumes:
- name: socket-dir
hostPath:
path: /var/lib/kubelet/plugins/csi-rbdplugin
type: DirectoryOrCreate
@@ -8,7 +8,7 @@ spec:
replicas: 1
selector:
matchLabels:
app: csi-rbdplugin-provisioner
app: csi-rbdplugin-provisioner
template:
metadata:
labels:
@@ -23,11 +23,23 @@ spec:
- "--v=5"
env:
- name: ADDRESS
value: /var/lib/kubelet/plugins/csi-rbdplugin/csi-provisioner.sock
value: unix:///csi/csi-provisioner.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
mountPath: /csi
- name: csi-rbdplugin-attacher
image: {{ .AttacherImage }}
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
env:
- name: ADDRESS
value: /csi/csi-provisioner.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /csi
- name: csi-snapshotter
image: {{ .SnapshotterImage }}
args:
@@ -36,13 +48,13 @@ spec:
- "--v=5"
env:
- name: ADDRESS
value: /var/lib/kubelet/plugins/csi-rbdplugin/csi-provisioner.sock
value: unix:///csi/csi-provisioner.sock
imagePullPolicy: Always
securityContext:
privileged: true
volumeMounts:
- name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
mountPath: /csi
- name: csi-rbdplugin
securityContext:
privileged: true
@@ -53,12 +65,12 @@ spec:
- "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
- "--v=5"
- "--drivername=csi-rbdplugin"
- "--drivername=rbd.csi.ceph.com"
- "--containerized=true"
- "--metadatastorage=k8s_configmap"
env:
- name: HOST_ROOTFS
value: "/rootfs"
value: "/rootfs"
- name: NODE_ID
valueFrom:
fieldRef:
@@ -68,15 +80,15 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins/csi-rbdplugin/csi-provisioner.sock
value: unix:///csi/csi-provisioner.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
mountPath: /csi
- mountPath: /dev
name: host-dev
- mountPath: /rootfs
name: host-rootfs
name: host-rootfs
- mountPath: /sys
name: host-sys
- mountPath: /lib/modules
@@ -88,14 +100,14 @@ spec:
path: /dev
- name: host-rootfs
hostPath:
path: /
path: /
- name: host-sys
hostPath:
path: /sys
- name: lib-modules
hostPath:
path: /lib/modules
path: /lib/modules
- name: socket-dir
hostPath:
path: /var/lib/kubelet/plugins/csi-rbdplugin
path: /var/lib/kubelet/plugins/rbd.csi.ceph.com
type: DirectoryOrCreate
@@ -24,7 +24,7 @@ spec:
args:
- "--v=5"
- "--csi-address=/csi/csi.sock"
- "--kubelet-registration-path=/var/lib/kubelet/plugins/csi-rbdplugin/csi.sock"
- "--kubelet-registration-path=/var/lib/kubelet/plugins/rbd.csi.ceph.com/csi.sock"
lifecycle:
preStop:
exec:
@@ -50,7 +50,7 @@ spec:
- "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
- "--v=5"
- "--drivername=csi-rbdplugin"
- "--drivername=rbd.csi.ceph.com"
- "--containerized=true"
- "--metadatastorage=k8s_configmap"
env:
@@ -65,11 +65,11 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins_registry/csi-rbdplugin/csi.sock
value: unix:///csi/csi.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: plugin-dir
mountPath: /var/lib/kubelet/plugins_registry/csi-rbdplugin
mountPath: /csi
- name: pods-mount-dir
mountPath: /var/lib/kubelet/pods
mountPropagation: "Bidirectional"
@@ -88,7 +88,7 @@ spec:
volumes:
- name: plugin-dir
hostPath:
path: /var/lib/kubelet/plugins/csi-rbdplugin
path: /var/lib/kubelet/plugins/rbd.csi.ceph.com
type: DirectoryOrCreate
- name: plugin-mount-dir
hostPath:
-1
View File
@@ -56,7 +56,6 @@ func init() {
// csi deployment templates
operatorCmd.Flags().StringVar(&csi.RBDPluginTemplatePath, "csi-rbd-plugin-template-path", csi.DefaultRBDPluginTemplatePath, "path to ceph-csi rbd plugin template")
operatorCmd.Flags().StringVar(&csi.RBDProvisionerTemplatePath, "csi-rbd-provisioner-template-path", csi.DefaultRBDProvisionerTemplatePath, "path to ceph-csi rbd provisioner template")
operatorCmd.Flags().StringVar(&csi.RBDAttacherTemplatePath, "csi-rbd-attacher-template-path", csi.DefaultRBDAttacherTemplatePath, "path to ceph-csi rbd attacher template")
operatorCmd.Flags().StringVar(&csi.CephFSPluginTemplatePath, "csi-cephfs-plugin-template-path", csi.DefaultCephFSPluginTemplatePath, "path to ceph-csi cephfs plugin template")
operatorCmd.Flags().StringVar(&csi.CephFSProvisionerTemplatePath, "csi-cephfs-provisioner-template-path", csi.DefaultCephFSProvisionerTemplatePath, "path to ceph-csi cephfs provisioner template")
+2 -3
View File
@@ -36,9 +36,8 @@ Starting Kubernetes CSI driver brings up an [external-provisioner](https://githu
For example, deploying a CephFS CSI driver consists of the following steps:
1. Creating a [RBAC for external provisioner](https://github.com/ceph/ceph-csi/blob/master/deploy/cephfs/kubernetes/csi-provisioner-rbac.yaml) and the [provisioner itself](https://github.com/ceph/ceph-csi/blob/master/deploy/cephfs/kubernetes/csi-cephfsplugin-provisioner.yaml).
2. Creating a [RBAC for external attacher](https://github.com/ceph/ceph-csi/blob/master/deploy/cephfs/kubernetes/csi-attacher-rbac.yaml) and [attacher itself](https://github.com/ceph/ceph-csi/blob/master/deploy/cephfs/kubernetes/csi-attacher-rbac.yaml).
3. Creating [RBAC for CSI driver](https://github.com/ceph/ceph-csi/blob/master/deploy/cephfs/kubernetes/csi-nodeplugin-rbac.yaml) and [driver DaemonSet](https://github.com/ceph/ceph-csi/blob/master/deploy/cephfs/kubernetes/csi-cephfsplugin.yaml)
4. Creating Storage Classes for CSI provisioners.
2. Creating [RBAC for CSI driver](https://github.com/ceph/ceph-csi/blob/master/deploy/cephfs/kubernetes/csi-nodeplugin-rbac.yaml) and [driver DaemonSet](https://github.com/ceph/ceph-csi/blob/master/deploy/cephfs/kubernetes/csi-cephfsplugin.yaml)
3. Creating Storage Classes for CSI provisioners.
## Integration Plan
+14 -28
View File
@@ -17,6 +17,7 @@ limitations under the License.
package csi
import (
"errors"
"fmt"
"github.com/rook/rook/pkg/operator/k8sutil"
@@ -45,7 +46,6 @@ var (
// template paths
RBDPluginTemplatePath string
RBDProvisionerTemplatePath string
RBDAttacherTemplatePath string
CephFSPluginTemplatePath string
CephFSProvisionerTemplatePath string
@@ -66,7 +66,6 @@ const (
// template
DefaultRBDPluginTemplatePath = "/etc/ceph-csi/rbd/csi-rbdplugin.yaml"
DefaultRBDProvisionerTemplatePath = "/etc/ceph-csi/rbd/csi-rbdplugin-provisioner.yaml"
DefaultRBDAttacherTemplatePath = "/etc/ceph-csi/rbd/csi-rbdplugin-attacher.yaml"
DefaultCephFSPluginTemplatePath = "/etc/ceph-csi/cephfs/csi-cephfsplugin.yaml"
DefaultCephFSProvisionerTemplatePath = "/etc/ceph-csi/cephfs/csi-cephfsplugin-provisioner.yaml"
@@ -87,43 +86,40 @@ func SetCSINamespace(namespace string) {
func ValidateCSIParam() error {
if EnableRBD {
if len(CSIParam.RBDPluginImage) == 0 {
return fmt.Errorf("missing csi rbd plugin image")
return errors.New("missing csi rbd plugin image")
}
if len(CSIParam.RegistrarImage) == 0 {
return fmt.Errorf("missing csi registrar image")
return errors.New("missing csi registrar image")
}
if len(CSIParam.ProvisionerImage) == 0 {
return fmt.Errorf("missing csi provisioner image")
return errors.New("missing csi provisioner image")
}
if len(CSIParam.AttacherImage) == 0 {
return fmt.Errorf("missing csi attacher image")
return errors.New("missing csi attacher image")
}
if len(RBDPluginTemplatePath) == 0 {
return fmt.Errorf("missing rbd plugin template path")
return errors.New("missing rbd plugin template path")
}
if len(RBDProvisionerTemplatePath) == 0 {
return fmt.Errorf("missing rbd provisioner template path")
}
if len(RBDAttacherTemplatePath) == 0 {
return fmt.Errorf("missing rbd attacher template path")
return errors.New("missing rbd provisioner template path")
}
}
if EnableCephFS {
if len(CSIParam.CephFSPluginImage) == 0 {
return fmt.Errorf("missing csi cephfs plugin image")
return errors.New("missing csi cephfs plugin image")
}
if len(CSIParam.RegistrarImage) == 0 {
return fmt.Errorf("missing csi registrar image")
return errors.New("missing csi registrar image")
}
if len(CSIParam.ProvisionerImage) == 0 {
return fmt.Errorf("missing csi provisioner image")
return errors.New("missing csi provisioner image")
}
if len(CephFSPluginTemplatePath) == 0 {
return fmt.Errorf("missing cephfs plugin template path")
}
if len(CephFSProvisionerTemplatePath) == 0 {
return fmt.Errorf("missing ceph provisioner template path")
return errors.New("missing ceph provisioner template path")
}
}
return nil
@@ -131,9 +127,9 @@ func ValidateCSIParam() error {
func StartCSIDrivers(namespace string, clientset kubernetes.Interface) error {
var (
err error
rbdPlugin, cephfsPlugin *apps.DaemonSet
rbdProvisioner, rbdAttacher, cephfsProvisioner *apps.StatefulSet
err error
rbdPlugin, cephfsPlugin *apps.DaemonSet
rbdProvisioner, cephfsProvisioner *apps.StatefulSet
)
if EnableRBD {
@@ -145,10 +141,6 @@ func StartCSIDrivers(namespace string, clientset kubernetes.Interface) error {
if err != nil {
return fmt.Errorf("failed to load rbd provisioner template: %v", err)
}
rbdAttacher, err = templateToStatefulSet("rbd-attacher", RBDAttacherTemplatePath)
if err != nil {
return fmt.Errorf("failed to load rbd attacher template: %v", err)
}
}
if EnableCephFS {
cephfsPlugin, err = templateToDaemonSet("cephfsplugin", CephFSPluginTemplatePath)
@@ -174,12 +166,6 @@ func StartCSIDrivers(namespace string, clientset kubernetes.Interface) error {
}
}
if rbdAttacher != nil {
_, err = k8sutil.CreateStatefulSet("csi rbd attacher", namespace, "csi-rbdplugin-attacher", clientset, rbdAttacher)
if err != nil {
return fmt.Errorf("failed to start rbd attacher statefulset: %v\n%v", err, rbdAttacher)
}
}
if cephfsPlugin != nil {
err = k8sutil.CreateDaemonSet("csi cephfs plugin", namespace, clientset, cephfsPlugin)
-2
View File
@@ -27,8 +27,6 @@ import (
func TestStartCSI(t *testing.T) {
RBDPluginTemplatePath = "csi-rbdplugin.yaml"
RBDProvisionerTemplatePath = "csi-rbdplugin-provisioner.yaml"
RBDAttacherTemplatePath = "csi-rbdplugin-attacher.yaml"
CephFSPluginTemplatePath = "csi-cephfsplugin.yaml"
CephFSProvisionerTemplatePath = "csi-cephfsplugin-provisioner.yaml"
+56 -80
View File
@@ -17,43 +17,6 @@ limitations under the License.
package installer
const (
rbdAttacherTemplate = `
kind: StatefulSet
apiVersion: apps/v1beta2
metadata:
name: csi-rbdplugin-attacher
namespace: {{ .Namespace }}
spec:
serviceName: csi-rbdplugin-attacher
replicas: 1
selector:
matchLabels:
app: csi-rbdplugin-attacher
template:
metadata:
labels:
app: csi-rbdplugin-attacher
spec:
serviceAccount: rook-csi-rbd-attacher-sa
containers:
- name: csi-rbdplugin-attacher
image: {{ .AttacherImage }}
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
env:
- name: ADDRESS
value: /var/lib/kubelet/plugins/csi-rbdplugin/csi.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
volumes:
- name: socket-dir
hostPath:
path: /var/lib/kubelet/plugins/csi-rbdplugin
type: DirectoryOrCreate
`
rbdProvisionerTemplate = `
kind: StatefulSet
apiVersion: apps/v1beta2
@@ -65,7 +28,7 @@ const (
replicas: 1
selector:
matchLabels:
app: csi-rbdplugin-provisioner
app: csi-rbdplugin-provisioner
template:
metadata:
labels:
@@ -80,11 +43,24 @@ const (
- "--v=5"
env:
- name: ADDRESS
value: /var/lib/kubelet/plugins/csi-rbdplugin/csi-provisioner.sock
value: unix:///csi/csi-provisioner.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
mountPath: /csi
- name: csi-rbdplugin-attacher
image: {{ .AttacherImage }}
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
env:
- name: ADDRESS
value: /csi/csi-provisioner.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /csi
- name: csi-snapshotter
image: {{ .SnapshotterImage }}
args:
@@ -93,13 +69,13 @@ const (
- "--v=5"
env:
- name: ADDRESS
value: /var/lib/kubelet/plugins/csi-rbdplugin/csi-provisioner.sock
value: unix:///csi/csi-provisioner.sock
imagePullPolicy: Always
securityContext:
privileged: true
volumeMounts:
- name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
mountPath: /csi
- name: csi-rbdplugin
securityContext:
privileged: true
@@ -110,12 +86,12 @@ const (
- "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
- "--v=5"
- "--drivername=csi-rbdplugin"
- "--drivername=rbd.csi.ceph.com"
- "--containerized=true"
- "--metadatastorage=k8s_configmap"
env:
- name: HOST_ROOTFS
value: "/rootfs"
value: "/rootfs"
- name: NODE_ID
valueFrom:
fieldRef:
@@ -125,15 +101,15 @@ const (
fieldRef:
fieldPath: metadata.namespace
- name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins/csi-rbdplugin/csi-provisioner.sock
value: unix:///csi/csi-provisioner.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
mountPath: /csi
- mountPath: /dev
name: host-dev
- mountPath: /rootfs
name: host-rootfs
name: host-rootfs
- mountPath: /sys
name: host-sys
- mountPath: /lib/modules
@@ -145,16 +121,16 @@ const (
path: /dev
- name: host-rootfs
hostPath:
path: /
path: /
- name: host-sys
hostPath:
path: /sys
- name: lib-modules
hostPath:
path: /lib/modules
path: /lib/modules
- name: socket-dir
hostPath:
path: /var/lib/kubelet/plugins/csi-rbdplugin
path: /var/lib/kubelet/plugins/rbd.csi.ceph.com
type: DirectoryOrCreate
`
rbdPluginTemplate = `
@@ -162,7 +138,7 @@ const (
apiVersion: apps/v1beta2
metadata:
name: csi-rbdplugin
namespace: {{ .Namespace }}
namespace: {{ .Namespace }}
spec:
selector:
matchLabels:
@@ -174,21 +150,21 @@ const (
spec:
serviceAccount: rook-csi-rbd-plugin-sa
hostNetwork: true
hostPID: true
hostPID: true
# to use e.g. Rook orchestrated cluster, and mons' FQDN is
# resolved through k8s service, set dns policy to cluster first
dnsPolicy: ClusterFirstWithHostNet
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: driver-registrar
image: {{ .RegistrarImage }}
args:
- "--v=5"
- "--csi-address=/csi/csi.sock"
- "--kubelet-registration-path=/var/lib/kubelet/plugins/csi-rbdplugin/csi.sock"
- "--kubelet-registration-path=/var/lib/kubelet/plugins/rbd.csi.ceph.com/csi.sock"
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "rm -rf /registration/csi-rbdplugin /registration/csi-rbdplugin-reg.sock"]
command: ["/bin/sh", "-c", "rm -rf /registration/csi-rbdplugin /registration/csi-rbdplugin-reg.sock"]
env:
- name: KUBE_NODE_NAME
valueFrom:
@@ -210,12 +186,12 @@ const (
- "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
- "--v=5"
- "--drivername=csi-rbdplugin"
- "--drivername=rbd.csi.ceph.com"
- "--containerized=true"
- "--metadatastorage=k8s_configmap"
env:
- name: HOST_ROOTFS
value: "/rootfs"
value: "/rootfs"
- name: NODE_ID
valueFrom:
fieldRef:
@@ -225,11 +201,11 @@ const (
fieldRef:
fieldPath: metadata.namespace
- name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins_registry/csi-rbdplugin/csi.sock
value: unix:///csi/csi.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: plugin-dir
mountPath: /var/lib/kubelet/plugins_registry/csi-rbdplugin
mountPath: /csi
- name: pods-mount-dir
mountPath: /var/lib/kubelet/pods
mountPropagation: "Bidirectional"
@@ -239,7 +215,7 @@ const (
- mountPath: /dev
name: host-dev
- mountPath: /rootfs
name: host-rootfs
name: host-rootfs
- mountPath: /sys
name: host-sys
- mountPath: /lib/modules
@@ -248,10 +224,10 @@ const (
volumes:
- name: plugin-dir
hostPath:
path: /var/lib/kubelet/plugins/csi-rbdplugin
path: /var/lib/kubelet/plugins/rbd.csi.ceph.com
type: DirectoryOrCreate
- name: plugin-mount-dir
hostPath:
hostPath:
path: /var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices/
type: DirectoryOrCreate
- name: registration-dir
@@ -267,7 +243,7 @@ const (
path: /dev
- name: host-rootfs
hostPath:
path: /
path: /
- name: host-sys
hostPath:
path: /sys
@@ -280,13 +256,13 @@ const (
apiVersion: apps/v1beta2
metadata:
name: csi-cephfsplugin-provisioner
namespace: {{ .Namespace }}
namespace: {{ .Namespace }}
spec:
serviceName: "csi-cephfsplugin-provisioner"
replicas: 1
selector:
matchLabels:
app: csi-cephfsplugin-provisioner
app: csi-cephfsplugin-provisioner
template:
metadata:
labels:
@@ -301,11 +277,11 @@ const (
- "--v=5"
env:
- name: ADDRESS
value: /var/lib/kubelet/plugins/csi-cephfsplugin/csi-provisioner.sock
value: unix:///csi/csi-provisioner.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
mountPath: /csi
- name: csi-cephfsplugin
securityContext:
privileged: true
@@ -316,7 +292,7 @@ const (
- "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
- "--v=5"
- "--drivername=csi-cephfsplugin"
- "--drivername=cephfs.csi.ceph.com"
- "--metadatastorage=k8s_configmap"
env:
- name: NODE_ID
@@ -328,22 +304,22 @@ const (
fieldRef:
fieldPath: metadata.namespace
- name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins/csi-cephfsplugin/csi-provisioner.sock
value: unix:///csi/csi-provisioner.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
mountPath: /csi
- name: host-sys
mountPath: /sys
- name: lib-modules
mountPath: /lib/modules
readOnly: true
- name: host-dev
mountPath: /dev
mountPath: /dev
volumes:
- name: socket-dir
hostPath:
path: /var/lib/kubelet/plugins/csi-cephfsplugin
path: /var/lib/kubelet/plugins/cephfs.csi.ceph.com
type: DirectoryOrCreate
- name: host-sys
hostPath:
@@ -360,7 +336,7 @@ const (
apiVersion: apps/v1beta2
metadata:
name: csi-cephfsplugin
namespace: {{ .Namespace }}
namespace: {{ .Namespace }}
spec:
selector:
matchLabels:
@@ -374,18 +350,18 @@ const (
hostNetwork: true
# to use e.g. Rook orchestrated cluster, and mons' FQDN is
# resolved through k8s service, set dns policy to cluster first
dnsPolicy: ClusterFirstWithHostNet
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: driver-registrar
image: {{ .RegistrarImage }}
args:
- "--v=5"
- "--csi-address=/csi/csi.sock"
- "--kubelet-registration-path=/var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock"
- "--kubelet-registration-path=/var/lib/kubelet/plugins/cephfs.csi.ceph.com/csi.sock"
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "rm -rf /registration/csi-cephfsplugin /registration/csi-cephfsplugin-reg.sock"]
command: ["/bin/sh", "-c", "rm -rf /registration/csi-cephfsplugin /registration/csi-cephfsplugin-reg.sock"]
env:
- name: KUBE_NODE_NAME
valueFrom:
@@ -407,7 +383,7 @@ const (
- "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
- "--v=5"
- "--drivername=csi-cephfsplugin"
- "--drivername=cephfs.csi.ceph.com"
- "--metadatastorage=k8s_configmap"
env:
- name: NODE_ID
@@ -419,11 +395,11 @@ const (
fieldRef:
fieldPath: metadata.namespace
- name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock
value: unix:///csi/csi.sock
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: plugin-dir
mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
mountPath: /csi
- name: csi-plugins-dir
mountPath: /var/lib/kubelet/plugins/kubernetes.io/csi
mountPropagation: "Bidirectional"
@@ -440,7 +416,7 @@ const (
volumes:
- name: plugin-dir
hostPath:
path: /var/lib/kubelet/plugins/csi-cephfsplugin/
path: /var/lib/kubelet/plugins/cephfs.csi.ceph.com/
type: DirectoryOrCreate
- name: csi-plugins-dir
hostPath:
+1 -3
View File
@@ -31,7 +31,7 @@ import (
"github.com/rook/rook/pkg/daemon/ceph/client"
opspec "github.com/rook/rook/pkg/operator/ceph/spec"
"github.com/rook/rook/tests/framework/utils"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
@@ -408,8 +408,6 @@ func (h *CephInstaller) UninstallRookFromMultipleNS(systemNamespace string, name
h.k8shelper.Clientset.RbacV1beta1().ClusterRoles().Delete("rook-ceph-global", nil)
h.k8shelper.Clientset.RbacV1beta1().Roles(systemNamespace).Delete("rook-ceph-system", nil)
h.k8shelper.Clientset.RbacV1beta1().ClusterRoleBindings().Delete("rbd-csi-attacher-role", nil)
h.k8shelper.Clientset.RbacV1beta1().ClusterRoles().Delete("rbd-external-attacher-runner", nil)
h.k8shelper.Clientset.RbacV1beta1().ClusterRoleBindings().Delete("rbd-csi-nodeplugin", nil)
h.k8shelper.Clientset.RbacV1beta1().ClusterRoles().Delete("rbd-csi-nodeplugin", nil)
h.k8shelper.Clientset.RbacV1beta1().ClusterRoleBindings().Delete("rbd-csi-provisioner-role", nil)
+8 -41
View File
@@ -499,7 +499,6 @@ metadata:
name: csi-rbd-config
namespace: ` + namespace + `
data:
csi-rbdplugin-attacher.yaml: |-` + rbdAttacherTemplate + `
csi-rbdplugin-provisioner.yaml: |-` + rbdProvisionerTemplate + `
csi-rbdplugin.yaml: |-` + rbdPluginTemplate + `
---
@@ -514,44 +513,6 @@ data:
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: rook-csi-rbd-attacher-sa
namespace: ` + namespace + `
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: rbd-external-attacher-runner
rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["get", "list", "watch", "update"]
- 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"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: rbd-csi-attacher-role
subjects:
- kind: ServiceAccount
name: rook-csi-rbd-attacher-sa
namespace: ` + namespace + `
roleRef:
kind: ClusterRole
name: rbd-external-attacher-runner
apiGroup: rbac.authorization.k8s.io
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: rook-csi-rbd-plugin-sa
namespace: ` + namespace + `
@@ -609,7 +570,7 @@ rules:
verbs: ["get", "list"]
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
verbs: ["get", "list", "watch", "create", "delete", "update"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
@@ -637,6 +598,12 @@ rules:
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["create"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments"]
verbs: ["get", "list", "watch", "update"]
---
kind: ClusterRoleBinding
@@ -709,7 +676,7 @@ rules:
verbs: ["get", "list"]
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
verbs: ["get", "list", "watch", "create", "delete", "update"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
+3 -3
View File
@@ -26,7 +26,7 @@ import (
"github.com/rook/rook/tests/framework/utils"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -101,7 +101,7 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ` + csiSCRBD + `
provisioner: csi-rbdplugin
provisioner: rbd.csi.ceph.com
parameters:
monValueFromSecret: "monitors"
pool: ` + csiPoolRBD + `
@@ -117,7 +117,7 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ` + csiSCCephFS + `
provisioner: csi-cephFSplugin
provisioner: cephfs.csi.ceph.com
parameters:
monValueFromSecret: "monitors"
pool: ` + csiPoolCephFS + `