Merge pull request #223 from Madhu-1/fix-222-1.0

update driver name as per csi spec
This commit is contained in:
Róbert Vašek 2019-03-14 06:38:13 +01:00 committed by GitHub
commit a4dd845735
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 132 additions and 59 deletions

View File

@ -27,7 +27,7 @@ import (
var ( var (
endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint") endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint")
driverName = flag.String("drivername", "csi-cephfsplugin", "name of the driver") driverName = flag.String("drivername", "cephfs.csi.ceph.com", "name of the driver")
nodeID = flag.String("nodeid", "", "node id") nodeID = flag.String("nodeid", "", "node id")
volumeMounter = flag.String("volumemounter", "", "default volume mounter (possible options are 'kernel', 'fuse')") volumeMounter = flag.String("volumemounter", "", "default volume mounter (possible options are 'kernel', 'fuse')")
metadataStorage = flag.String("metadatastorage", "", "metadata persistence method [node|k8s_configmap]") metadataStorage = flag.String("metadatastorage", "", "metadata persistence method [node|k8s_configmap]")
@ -43,6 +43,13 @@ func init() {
func main() { func main() {
err := util.ValidateDriverName(*driverName)
if err != nil {
klog.Fatalln(err)
}
//update plugin name
cephfs.PluginFolder = cephfs.PluginFolder + *driverName
cp, err := util.CreatePersistanceStorage(cephfs.PluginFolder, *metadataStorage, *driverName) cp, err := util.CreatePersistanceStorage(cephfs.PluginFolder, *metadataStorage, *driverName)
if err != nil { if err != nil {
os.Exit(1) os.Exit(1)

View File

@ -27,7 +27,7 @@ import (
var ( var (
endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint") endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint")
driverName = flag.String("drivername", "csi-rbdplugin", "name of the driver") driverName = flag.String("drivername", "rbd.csi.ceph.com", "name of the driver")
nodeID = flag.String("nodeid", "", "node id") nodeID = flag.String("nodeid", "", "node id")
containerized = flag.Bool("containerized", true, "whether run as containerized") containerized = flag.Bool("containerized", true, "whether run as containerized")
metadataStorage = flag.String("metadatastorage", "", "metadata persistence method [node|k8s_configmap]") metadataStorage = flag.String("metadatastorage", "", "metadata persistence method [node|k8s_configmap]")
@ -43,6 +43,13 @@ func init() {
func main() { func main() {
err := util.ValidateDriverName(*driverName)
if err != nil {
klog.Fatalln(err)
}
//update plugin name
rbd.PluginFolder = rbd.PluginFolder + *driverName
cp, err := util.CreatePersistanceStorage(rbd.PluginFolder, *metadataStorage, *driverName) cp, err := util.CreatePersistanceStorage(rbd.PluginFolder, *metadataStorage, *driverName)
if err != nil { if err != nil {
os.Exit(1) os.Exit(1)

View File

@ -21,3 +21,9 @@ If you want to delete your Chart, use this command
```bash ```bash
helm delete --purge "ceph-csi-cephfs" helm delete --purge "ceph-csi-cephfs"
``` ```
If you want to delete the namespace, use this command
```bash
kubectl delete namespace ceph-csi-rbd
```

View File

@ -39,7 +39,11 @@ spec:
lifecycle: lifecycle:
preStop: preStop:
exec: exec:
command: ["/bin/sh", "-c", "rm -rf /registration/csi-cephfsplugin /registration/csi-cephfsplugin-reg.sock"] command: [
"/bin/sh", "-c",
'rm -rf /registration/{{ .Values.driverName }}
/registration/{{ .Values.driverName }}-reg.sock'
]
env: env:
- name: KUBE_NODE_NAME - name: KUBE_NODE_NAME
valueFrom: valueFrom:
@ -64,11 +68,13 @@ spec:
- "--nodeid=$(NODE_ID)" - "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)" - "--endpoint=$(CSI_ENDPOINT)"
- "--v=5" - "--v=5"
- "--drivername=csi-cephfsplugin" - "--drivername=$(DRIVER_NAME)"
- "--metadatastorage=k8s_configmap" - "--metadatastorage=k8s_configmap"
env: env:
- name: HOST_ROOTFS - name: HOST_ROOTFS
value: "/rootfs" value: "/rootfs"
- name: DRIVER_NAME
value: {{ .Values.driverName }}
- name: NODE_ID - name: NODE_ID
valueFrom: valueFrom:
fieldRef: fieldRef:

View File

@ -52,11 +52,13 @@ spec:
- "--nodeid=$(NODE_ID)" - "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)" - "--endpoint=$(CSI_ENDPOINT)"
- "--v=5" - "--v=5"
- "--drivername=csi-cephfsplugin" - "--drivername=$(DRIVER_NAME)"
- "--metadatastorage=k8s_configmap" - "--metadatastorage=k8s_configmap"
env: env:
- name: HOST_ROOTFS - name: HOST_ROOTFS
value: "/rootfs" value: "/rootfs"
- name: DRIVER_NAME
value: {{ .Values.driverName }}
- name: NODE_ID - name: NODE_ID
valueFrom: valueFrom:
fieldRef: fieldRef:

View File

@ -13,11 +13,11 @@ serviceAccounts:
create: true create: true
name: name:
socketDir: /var/lib/kubelet/plugins/csi-cephfsplugin socketDir: /var/lib/kubelet/plugins/cephfs.csi.ceph.com
socketFile: csi.sock socketFile: csi.sock
registrationDir: /var/lib/kubelet/plugins_registry registrationDir: /var/lib/kubelet/plugins_registry
volumeDevicesDir: /var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices volumeDevicesDir: /var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices
driverName: cephfs.csi.ceph.com
attacher: attacher:
name: attacher name: attacher

View File

@ -34,13 +34,13 @@ spec:
- "--csi-address=$(ADDRESS)" - "--csi-address=$(ADDRESS)"
env: env:
- name: ADDRESS - name: ADDRESS
value: /var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock value: /var/lib/kubelet/plugins/cephfs.csi.ceph.com/csi.sock
imagePullPolicy: "IfNotPresent" imagePullPolicy: "IfNotPresent"
volumeMounts: volumeMounts:
- name: socket-dir - name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin mountPath: /var/lib/kubelet/plugins/cephfs.csi.ceph.com
volumes: volumes:
- name: socket-dir - name: socket-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins/csi-cephfsplugin path: /var/lib/kubelet/plugins/cephfs.csi.ceph.com
type: DirectoryOrCreate type: DirectoryOrCreate

View File

@ -34,11 +34,11 @@ spec:
- "--v=5" - "--v=5"
env: env:
- name: ADDRESS - name: ADDRESS
value: /var/lib/kubelet/plugins/csi-cephfsplugin/csi-provisioner.sock value: /var/lib/kubelet/plugins/cephfs.csi.ceph.com/csi-provisioner.sock
imagePullPolicy: "IfNotPresent" imagePullPolicy: "IfNotPresent"
volumeMounts: volumeMounts:
- name: socket-dir - name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin mountPath: /var/lib/kubelet/plugins/cephfs.csi.ceph.com
- name: csi-cephfsplugin - name: csi-cephfsplugin
securityContext: securityContext:
privileged: true privileged: true
@ -49,7 +49,7 @@ spec:
- "--nodeid=$(NODE_ID)" - "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)" - "--endpoint=$(CSI_ENDPOINT)"
- "--v=5" - "--v=5"
- "--drivername=csi-cephfsplugin" - "--drivername=cephfs.csi.ceph.com"
- "--metadatastorage=k8s_configmap" - "--metadatastorage=k8s_configmap"
env: env:
- name: NODE_ID - name: NODE_ID
@ -61,11 +61,11 @@ spec:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: CSI_ENDPOINT - name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins/csi-cephfsplugin/csi-provisioner.sock value: unix://var/lib/kubelet/plugins/cephfs.csi.ceph.com/csi-provisioner.sock
imagePullPolicy: "IfNotPresent" imagePullPolicy: "IfNotPresent"
volumeMounts: volumeMounts:
- name: socket-dir - name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin mountPath: /var/lib/kubelet/plugins/cephfs.csi.ceph.com
- name: host-sys - name: host-sys
mountPath: /sys mountPath: /sys
- name: lib-modules - name: lib-modules
@ -76,7 +76,7 @@ spec:
volumes: volumes:
- name: socket-dir - name: socket-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins/csi-cephfsplugin path: /var/lib/kubelet/plugins/cephfs.csi.ceph.com
type: DirectoryOrCreate type: DirectoryOrCreate
- name: host-sys - name: host-sys
hostPath: hostPath:

View File

@ -23,7 +23,7 @@ spec:
args: args:
- "--v=5" - "--v=5"
- "--csi-address=/csi/csi.sock" - "--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: lifecycle:
preStop: preStop:
exec: exec:
@ -53,7 +53,7 @@ spec:
- "--nodeid=$(NODE_ID)" - "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)" - "--endpoint=$(CSI_ENDPOINT)"
- "--v=5" - "--v=5"
- "--drivername=csi-cephfsplugin" - "--drivername=cephfs.csi.ceph.com"
- "--metadatastorage=k8s_configmap" - "--metadatastorage=k8s_configmap"
env: env:
- name: NODE_ID - name: NODE_ID
@ -65,11 +65,11 @@ spec:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: CSI_ENDPOINT - name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock value: unix://var/lib/kubelet/plugins/cephfs.csi.ceph.com/csi.sock
imagePullPolicy: "IfNotPresent" imagePullPolicy: "IfNotPresent"
volumeMounts: volumeMounts:
- name: plugin-dir - name: plugin-dir
mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin mountPath: /var/lib/kubelet/plugins/cephfs.csi.ceph.com
- name: csi-plugins-dir - name: csi-plugins-dir
mountPath: /var/lib/kubelet/plugins/kubernetes.io/csi mountPath: /var/lib/kubelet/plugins/kubernetes.io/csi
mountPropagation: "Bidirectional" mountPropagation: "Bidirectional"
@ -86,7 +86,7 @@ spec:
volumes: volumes:
- name: plugin-dir - name: plugin-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins/csi-cephfsplugin/ path: /var/lib/kubelet/plugins/cephfs.csi.ceph.com/
type: DirectoryOrCreate type: DirectoryOrCreate
- name: csi-plugins-dir - name: csi-plugins-dir
hostPath: hostPath:

View File

@ -21,3 +21,9 @@ If you want to delete your Chart, use this command
```bash ```bash
helm delete --purge "ceph-csi-rbd" helm delete --purge "ceph-csi-rbd"
``` ```
If you want to delete the namespace, use this command
```bash
kubectl delete namespace ceph-csi-rbd
```

View File

@ -39,7 +39,11 @@ spec:
lifecycle: lifecycle:
preStop: preStop:
exec: exec:
command: ["/bin/sh", "-c", "rm -rf /registration/csi-rbdplugin /registration/csi-rbdplugin-reg.sock"] command: [
"/bin/sh", "-c",
'rm -rf /registration/{{ .Values.driverName }}
/registration/{{ .Values.driverName }}-reg.sock'
]
env: env:
- name: KUBE_NODE_NAME - name: KUBE_NODE_NAME
valueFrom: valueFrom:
@ -64,12 +68,14 @@ spec:
- "--nodeid=$(NODE_ID)" - "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)" - "--endpoint=$(CSI_ENDPOINT)"
- "--v=5" - "--v=5"
- "--drivername=csi-rbdplugin" - "--drivername=$(DRIVER_NAME)"
- "--containerized=true" - "--containerized=true"
- "--metadatastorage=k8s_configmap" - "--metadatastorage=k8s_configmap"
env: env:
- name: HOST_ROOTFS - name: HOST_ROOTFS
value: "/rootfs" value: "/rootfs"
- name: DRIVER_NAME
value: {{ .Values.driverName }}
- name: NODE_ID - name: NODE_ID
valueFrom: valueFrom:
fieldRef: fieldRef:

View File

@ -69,12 +69,14 @@ spec:
- "--nodeid=$(NODE_ID)" - "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)" - "--endpoint=$(CSI_ENDPOINT)"
- "--v=5" - "--v=5"
- "--drivername=csi-rbdplugin" - "--drivername=$(DRIVER_NAME)"
- "--containerized=true" - "--containerized=true"
- "--metadatastorage=k8s_configmap" - "--metadatastorage=k8s_configmap"
env: env:
- name: HOST_ROOTFS - name: HOST_ROOTFS
value: "/rootfs" value: "/rootfs"
- name: DRIVER_NAME
value: {{ .Values.driverName }}
- name: NODE_ID - name: NODE_ID
valueFrom: valueFrom:
fieldRef: fieldRef:

View File

@ -13,10 +13,11 @@ serviceAccounts:
create: true create: true
name: name:
socketDir: /var/lib/kubelet/plugins/csi-rbdplugin socketDir: /var/lib/kubelet/plugins/rbd.csi.ceph.com
socketFile: csi.sock socketFile: csi.sock
registrationDir: /var/lib/kubelet/plugins_registry registrationDir: /var/lib/kubelet/plugins_registry
volumeDevicesDir: /var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices volumeDevicesDir: /var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices
driverName: rbd.csi.ceph.com
attacher: attacher:
name: attacher name: attacher

View File

@ -34,13 +34,13 @@ spec:
- "--csi-address=$(ADDRESS)" - "--csi-address=$(ADDRESS)"
env: env:
- name: ADDRESS - name: ADDRESS
value: /var/lib/kubelet/plugins/csi-rbdplugin/csi.sock value: /var/lib/kubelet/plugins/rbd.csi.ceph.com/csi.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/rbd.csi.ceph.com
volumes: volumes:
- name: socket-dir - name: socket-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins/csi-rbdplugin path: /var/lib/kubelet/plugins/rbd.csi.ceph.com
type: DirectoryOrCreate type: DirectoryOrCreate

View File

@ -34,11 +34,11 @@ spec:
- "--v=5" - "--v=5"
env: env:
- name: ADDRESS - name: ADDRESS
value: /var/lib/kubelet/plugins/csi-rbdplugin/csi-provisioner.sock value: /var/lib/kubelet/plugins/rbd.csi.ceph.com/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/rbd.csi.ceph.com
- name: csi-snapshotter - name: csi-snapshotter
image: quay.io/k8scsi/csi-snapshotter:v1.0.1 image: quay.io/k8scsi/csi-snapshotter:v1.0.1
args: args:
@ -47,13 +47,13 @@ spec:
- "--v=5" - "--v=5"
env: env:
- name: ADDRESS - name: ADDRESS
value: /var/lib/kubelet/plugins/csi-rbdplugin/csi-provisioner.sock value: /var/lib/kubelet/plugins/rbd.csi.ceph.com/csi-provisioner.sock
imagePullPolicy: Always imagePullPolicy: Always
securityContext: securityContext:
privileged: true privileged: true
volumeMounts: volumeMounts:
- name: socket-dir - name: socket-dir
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin mountPath: /var/lib/kubelet/plugins/rbd.csi.ceph.com
- name: csi-rbdplugin - name: csi-rbdplugin
securityContext: securityContext:
privileged: true privileged: true
@ -64,7 +64,7 @@ spec:
- "--nodeid=$(NODE_ID)" - "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)" - "--endpoint=$(CSI_ENDPOINT)"
- "--v=5" - "--v=5"
- "--drivername=csi-rbdplugin" - "--drivername=rbd.csi.ceph.com"
- "--containerized=true" - "--containerized=true"
- "--metadatastorage=k8s_configmap" - "--metadatastorage=k8s_configmap"
env: env:
@ -79,11 +79,11 @@ spec:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: CSI_ENDPOINT - name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins/csi-rbdplugin/csi-provisioner.sock value: unix://var/lib/kubelet/plugins/rbd.csi.ceph.com/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/rbd.csi.ceph.com
- mountPath: /dev - mountPath: /dev
name: host-dev name: host-dev
- mountPath: /rootfs - mountPath: /rootfs
@ -108,5 +108,5 @@ spec:
path: /lib/modules path: /lib/modules
- name: socket-dir - name: socket-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins/csi-rbdplugin path: /var/lib/kubelet/plugins/rbd.csi.ceph.com
type: DirectoryOrCreate type: DirectoryOrCreate

View File

@ -24,14 +24,14 @@ spec:
args: args:
- "--v=5" - "--v=5"
- "--csi-address=/csi/csi.sock" - "--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: lifecycle:
preStop: preStop:
exec: exec:
command: [ command: [
"/bin/sh", "-c", "/bin/sh", "-c",
"rm -rf /registration/csi-rbdplugin \ "rm -rf /registration/rbd.csi.ceph.com \
/registration/csi-rbdplugin-reg.sock" /registration/rbd.csi.ceph.com-reg.sock"
] ]
env: env:
- name: KUBE_NODE_NAME - name: KUBE_NODE_NAME
@ -54,7 +54,7 @@ spec:
- "--nodeid=$(NODE_ID)" - "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)" - "--endpoint=$(CSI_ENDPOINT)"
- "--v=5" - "--v=5"
- "--drivername=csi-rbdplugin" - "--drivername=rbd.csi.ceph.com"
- "--containerized=true" - "--containerized=true"
- "--metadatastorage=k8s_configmap" - "--metadatastorage=k8s_configmap"
env: env:
@ -69,11 +69,11 @@ spec:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: CSI_ENDPOINT - name: CSI_ENDPOINT
value: unix://var/lib/kubelet/plugins_registry/csi-rbdplugin/csi.sock value: unix://var/lib/kubelet/plugins_registry/rbd.csi.ceph.com/csi.sock
imagePullPolicy: "IfNotPresent" imagePullPolicy: "IfNotPresent"
volumeMounts: volumeMounts:
- name: plugin-dir - name: plugin-dir
mountPath: /var/lib/kubelet/plugins_registry/csi-rbdplugin mountPath: /var/lib/kubelet/plugins_registry/rbd.csi.ceph.com
- name: pods-mount-dir - name: pods-mount-dir
mountPath: /var/lib/kubelet/pods mountPath: /var/lib/kubelet/pods
mountPropagation: "Bidirectional" mountPropagation: "Bidirectional"
@ -92,7 +92,7 @@ spec:
volumes: volumes:
- name: plugin-dir - name: plugin-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins/csi-rbdplugin path: /var/lib/kubelet/plugins/rbd.csi.ceph.com
type: DirectoryOrCreate type: DirectoryOrCreate
- name: plugin-mount-dir - name: plugin-mount-dir
hostPath: hostPath:

View File

@ -30,7 +30,7 @@ make image-cephfsplugin
Option | Default value | Description Option | Default value | Description
--------------------|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
`--endpoint` | `unix://tmp/csi.sock` | CSI endpoint, must be a UNIX socket `--endpoint` | `unix://tmp/csi.sock` | CSI endpoint, must be a UNIX socket
`--drivername` | `csi-cephfsplugin` | name of the driver (Kubernetes: `provisioner` field in StorageClass must correspond to this value) `--drivername` | `cephfs.csi.ceph.com` | name of the driver (Kubernetes: `provisioner` field in StorageClass must correspond to this value)
`--nodeid` | _empty_ | This node's ID `--nodeid` | _empty_ | This node's ID
`--volumemounter` | _empty_ | default volume mounter. Available options are `kernel` and `fuse`. This is the mount method used if volume parameters don't specify otherwise. If left unspecified, the driver will first probe for `ceph-fuse` in system's path and will choose Ceph kernel client if probing failed. `--volumemounter` | _empty_ | default volume mounter. Available options are `kernel` and `fuse`. This is the mount method used if volume parameters don't specify otherwise. If left unspecified, the driver will first probe for `ceph-fuse` in system's path and will choose Ceph kernel client if probing failed.
`--metadatastorage` | _empty_ | Whether metadata should be kept on node as file or in a k8s configmap (`node` or `k8s_configmap`) `--metadatastorage` | _empty_ | Whether metadata should be kept on node as file or in a k8s configmap (`node` or `k8s_configmap`)

View File

@ -29,7 +29,7 @@ make image-rbdplugin
Option | Default value | Description Option | Default value | Description
------ | ------------- | ----------- ------ | ------------- | -----------
`--endpoint` | `unix://tmp/csi.sock` | CSI endpoint, must be a UNIX socket `--endpoint` | `unix://tmp/csi.sock` | CSI endpoint, must be a UNIX socket
`--drivername` | `csi-cephfsplugin` | name of the driver (Kubernetes: `provisioner` field in StorageClass must correspond to this value) `--drivername` | `rbd.csi.ceph.com` | name of the driver (Kubernetes: `provisioner` field in StorageClass must correspond to this value)
`--nodeid` | _empty_ | This node's ID `--nodeid` | _empty_ | This node's ID
`--containerized` | true | Whether running in containerized mode `--containerized` | true | Whether running in containerized mode
`--metadatastorage` | _empty_ | Whether should metadata be kept on node as file or in a k8s configmap (`node` or `k8s_configmap`) `--metadatastorage` | _empty_ | Whether should metadata be kept on node as file or in a k8s configmap (`node` or `k8s_configmap`)

View File

@ -108,7 +108,7 @@ one of your Ceph pod.
To restore the snapshot to a new PVC, deploy To restore the snapshot to a new PVC, deploy
[pvc-restore.yaml](./rbd/pvc-restore.yaml) and a testing pod [pvc-restore.yaml](./rbd/pvc-restore.yaml) and a testing pod
[pod-restore.yaml](./rbd/pvc-restore.yaml): [pod-restore.yaml](./rbd/pod-restore.yaml):
```bash ```bash
kubectl create -f pvc-restore.yaml kubectl create -f pvc-restore.yaml
@ -133,7 +133,7 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass kind: StorageClass
metadata: metadata:
name: csi-rbd name: csi-rbd
provisioner: csi-rbdplugin provisioner: rbd.csi.ceph.com
parameters: parameters:
monitors: rook-ceph-mon-b.rook-ceph.svc.cluster.local:6789 monitors: rook-ceph-mon-b.rook-ceph.svc.cluster.local:6789
pool: rbd pool: rbd

View File

@ -3,7 +3,7 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass kind: StorageClass
metadata: metadata:
name: csi-cephfs name: csi-cephfs
provisioner: csi-cephfsplugin provisioner: cephfs.csi.ceph.com
parameters: parameters:
# Comma separated list of Ceph monitors # Comma separated list of Ceph monitors
# if using FQDN, make sure csi plugin's dns policy is appropriate. # if using FQDN, make sure csi plugin's dns policy is appropriate.

View File

@ -3,7 +3,7 @@ apiVersion: snapshot.storage.k8s.io/v1alpha1
kind: VolumeSnapshotClass kind: VolumeSnapshotClass
metadata: metadata:
name: csi-rbdplugin-snapclass name: csi-rbdplugin-snapclass
snapshotter: csi-rbdplugin snapshotter: rbd.csi.ceph.com
parameters: parameters:
pool: rbd pool: rbd
monitors: mon1:port,mon2:port,... monitors: mon1:port,mon2:port,...

View File

@ -3,7 +3,7 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass kind: StorageClass
metadata: metadata:
name: csi-rbd name: csi-rbd
provisioner: csi-rbdplugin provisioner: rbd.csi.ceph.com
parameters: parameters:
# Comma separated list of Ceph monitors # Comma separated list of Ceph monitors
# if using FQDN, make sure csi plugin's dns policy is appropriate. # if using FQDN, make sure csi plugin's dns policy is appropriate.

View File

@ -19,19 +19,21 @@ package cephfs
import ( import (
"k8s.io/klog" "k8s.io/klog"
"github.com/ceph/ceph-csi/pkg/csi-common" csicommon "github.com/ceph/ceph-csi/pkg/csi-common"
"github.com/ceph/ceph-csi/pkg/util" "github.com/ceph/ceph-csi/pkg/util"
"github.com/container-storage-interface/spec/lib/go/csi" "github.com/container-storage-interface/spec/lib/go/csi"
) )
const ( const (
// PluginFolder defines the location of ceph plugin
PluginFolder = "/var/lib/kubelet/plugins/csi-cephfsplugin"
// version of ceph driver // version of ceph driver
version = "1.0.0" version = "1.0.0"
) )
// PluginFolder defines the location of ceph plugin
var PluginFolder = "/var/lib/kubelet/plugins/"
// Driver contains the default identity,node and controller struct // Driver contains the default identity,node and controller struct
type Driver struct { type Driver struct {
cd *csicommon.CSIDriver cd *csicommon.CSIDriver

View File

@ -19,7 +19,7 @@ package cephfs
import ( import (
"context" "context"
"github.com/ceph/ceph-csi/pkg/csi-common" csicommon "github.com/ceph/ceph-csi/pkg/csi-common"
"github.com/container-storage-interface/spec/lib/go/csi" "github.com/container-storage-interface/spec/lib/go/csi"
) )

View File

@ -25,12 +25,15 @@ import (
) )
const ( const (
cephRootPrefix = PluginFolder + "/controller/volumes/root-"
cephVolumesRoot = "csi-volumes" cephVolumesRoot = "csi-volumes"
namespacePrefix = "ns-" namespacePrefix = "ns-"
) )
var (
cephRootPrefix = PluginFolder + "/controller/volumes/root-"
)
func getCephRootPathLocal(volID volumeID) string { func getCephRootPathLocal(volID volumeID) string {
return cephRootPrefix + string(volID) return cephRootPrefix + string(volID)
} }

View File

@ -19,7 +19,7 @@ package rbd
import ( import (
"context" "context"
"github.com/ceph/ceph-csi/pkg/csi-common" csicommon "github.com/ceph/ceph-csi/pkg/csi-common"
"github.com/container-storage-interface/spec/lib/go/csi" "github.com/container-storage-interface/spec/lib/go/csi"
) )

View File

@ -17,7 +17,7 @@ limitations under the License.
package rbd package rbd
import ( import (
"github.com/ceph/ceph-csi/pkg/csi-common" csicommon "github.com/ceph/ceph-csi/pkg/csi-common"
"github.com/ceph/ceph-csi/pkg/util" "github.com/ceph/ceph-csi/pkg/util"
"github.com/container-storage-interface/spec/lib/go/csi" "github.com/container-storage-interface/spec/lib/go/csi"
@ -29,11 +29,13 @@ import (
// PluginFolder defines the location of rbdplugin // PluginFolder defines the location of rbdplugin
const ( const (
PluginFolder = "/var/lib/kubelet/plugins/csi-rbdplugin"
rbdDefaultAdminID = "admin" rbdDefaultAdminID = "admin"
rbdDefaultUserID = rbdDefaultAdminID rbdDefaultUserID = rbdDefaultAdminID
) )
// PluginFolder defines the location of ceph plugin
var PluginFolder = "/var/lib/kubelet/plugins/"
// Driver contains the default identity,node and controller struct // Driver contains the default identity,node and controller struct
type Driver struct { type Driver struct {
cd *csicommon.CSIDriver cd *csicommon.CSIDriver

View File

@ -25,7 +25,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"k8s.io/klog" "k8s.io/klog"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
apierrs "k8s.io/apimachinery/pkg/api/errors" apierrs "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
k8s "k8s.io/client-go/kubernetes" k8s "k8s.io/client-go/kubernetes"

View File

@ -19,7 +19,10 @@ package util
import ( import (
"os" "os"
"path" "path"
"strings"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/util/validation"
"k8s.io/klog" "k8s.io/klog"
) )
@ -68,3 +71,23 @@ func CreatePersistanceStorage(sPath, metaDataStore, driverName string) (CachePer
func createPersistentStorage(persistentStoragePath string) error { func createPersistentStorage(persistentStoragePath string) error {
return os.MkdirAll(persistentStoragePath, os.FileMode(0755)) return os.MkdirAll(persistentStoragePath, os.FileMode(0755))
} }
// ValidateDriverName validates the driver name
func ValidateDriverName(driverName string) error {
if len(driverName) == 0 {
return errors.New("driver name is empty")
}
if len(driverName) > 63 {
return errors.New("driver name length should be less than 63 chars")
}
var err error
for _, msg := range validation.IsDNS1123Subdomain(strings.ToLower(driverName)) {
if err == nil {
err = errors.New(msg)
continue
}
err = errors.Wrap(err, msg)
}
return err
}