From c6c496ff59e3bc67f36836ba59dc6d6b21d8983f Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Tue, 22 Jan 2019 11:31:55 -0500 Subject: [PATCH] switch to node registrar --- .../kubernetes/csi-cephfsplugin-attacher.yaml | 6 ++-- .../csi-cephfsplugin-provisioner.yaml | 6 ++-- .../cephfs/kubernetes/csi-cephfsplugin.yaml | 28 ++++++++----------- .../kubernetes/csi-rbdplugin-attacher.yaml | 6 ++-- .../kubernetes/csi-rbdplugin-provisioner.yaml | 6 ++-- deploy/rbd/kubernetes/csi-rbdplugin.yaml | 28 ++++++++----------- pkg/cephfs/driver.go | 2 +- pkg/cephfs/nodeserver.go | 4 +++ pkg/rbd/nodeserver.go | 4 +++ pkg/rbd/rbd.go | 2 +- 10 files changed, 46 insertions(+), 46 deletions(-) diff --git a/deploy/cephfs/kubernetes/csi-cephfsplugin-attacher.yaml b/deploy/cephfs/kubernetes/csi-cephfsplugin-attacher.yaml index b663067a8..86f0b42a4 100644 --- a/deploy/cephfs/kubernetes/csi-cephfsplugin-attacher.yaml +++ b/deploy/cephfs/kubernetes/csi-cephfsplugin-attacher.yaml @@ -33,13 +33,13 @@ spec: - "--csi-address=$(ADDRESS)" env: - name: ADDRESS - value: /var/lib/kubelet/plugins_registry/csi-cephfsplugin/csi.sock + value: /var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock imagePullPolicy: "IfNotPresent" volumeMounts: - name: socket-dir - mountPath: /var/lib/kubelet/plugins_registry/csi-cephfsplugin + mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin volumes: - name: socket-dir hostPath: - path: /var/lib/kubelet/plugins_registry/csi-cephfsplugin + path: /var/lib/kubelet/plugins/csi-cephfsplugin type: DirectoryOrCreate diff --git a/deploy/cephfs/kubernetes/csi-cephfsplugin-provisioner.yaml b/deploy/cephfs/kubernetes/csi-cephfsplugin-provisioner.yaml index 8206680b3..bd6b54459 100644 --- a/deploy/cephfs/kubernetes/csi-cephfsplugin-provisioner.yaml +++ b/deploy/cephfs/kubernetes/csi-cephfsplugin-provisioner.yaml @@ -34,13 +34,13 @@ spec: - "--v=5" env: - name: ADDRESS - value: /var/lib/kubelet/plugins_registry/csi-cephfsplugin/csi.sock + value: /var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock imagePullPolicy: "IfNotPresent" volumeMounts: - name: socket-dir - mountPath: /var/lib/kubelet/plugins_registry/csi-cephfsplugin + mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin volumes: - name: socket-dir hostPath: - path: /var/lib/kubelet/plugins_registry/csi-cephfsplugin + path: /var/lib/kubelet/plugins/csi-cephfsplugin type: DirectoryOrCreate diff --git a/deploy/cephfs/kubernetes/csi-cephfsplugin.yaml b/deploy/cephfs/kubernetes/csi-cephfsplugin.yaml index c7009c51c..186f3d55e 100644 --- a/deploy/cephfs/kubernetes/csi-cephfsplugin.yaml +++ b/deploy/cephfs/kubernetes/csi-cephfsplugin.yaml @@ -18,23 +18,23 @@ spec: dnsPolicy: ClusterFirstWithHostNet containers: - name: driver-registrar - image: quay.io/k8scsi/driver-registrar:canary + image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.2 args: - "--v=5" - - "--csi-address=$(ADDRESS)" - - "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)" + - "--csi-address=/csi/csi.sock" + - "--kubelet-registration-path=/var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock" + lifecycle: + preStop: + exec: + command: ["/bin/sh", "-c", "rm -rf /registration/csi-cephfsplugin /registration/csi-cephfsplugin-reg.sock"] env: - - name: ADDRESS - value: /var/lib/kubelet/plugins_registry/csi-cephfsplugin/csi.sock - - name: DRIVER_REG_SOCK_PATH - value: /var/lib/kubelet/plugins_registry/csi-cephfsplugin/csi.sock - name: KUBE_NODE_NAME valueFrom: fieldRef: fieldPath: spec.nodeName volumeMounts: - - name: socket-dir - mountPath: /var/lib/kubelet/plugins_registry/csi-cephfsplugin + - name: plugin-dir + mountPath: /csi - name: registration-dir mountPath: /registration - name: csi-cephfsplugin @@ -60,11 +60,11 @@ spec: fieldRef: fieldPath: metadata.namespace - name: CSI_ENDPOINT - value: unix://var/lib/kubelet/plugins_registry/csi-cephfsplugin/csi.sock + value: unix://var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock imagePullPolicy: "IfNotPresent" volumeMounts: - name: plugin-dir - mountPath: /var/lib/kubelet/plugins_registry/csi-cephfsplugin + mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin - name: csi-plugins-dir mountPath: /var/lib/kubelet/plugins/kubernetes.io/csi mountPropagation: "Bidirectional" @@ -81,7 +81,7 @@ spec: volumes: - name: plugin-dir hostPath: - path: /var/lib/kubelet/plugins_registry/csi-cephfsplugin + path: /var/lib/kubelet/plugins/csi-cephfsplugin/ type: DirectoryOrCreate - name: csi-plugins-dir hostPath: @@ -95,10 +95,6 @@ spec: hostPath: path: /var/lib/kubelet/pods type: Directory - - name: socket-dir - hostPath: - path: /var/lib/kubelet/plugins_registry/csi-cephfsplugin - type: DirectoryOrCreate - name: host-sys hostPath: path: /sys diff --git a/deploy/rbd/kubernetes/csi-rbdplugin-attacher.yaml b/deploy/rbd/kubernetes/csi-rbdplugin-attacher.yaml index f7a3d488a..19e9ee17b 100644 --- a/deploy/rbd/kubernetes/csi-rbdplugin-attacher.yaml +++ b/deploy/rbd/kubernetes/csi-rbdplugin-attacher.yaml @@ -33,13 +33,13 @@ spec: - "--csi-address=$(ADDRESS)" env: - name: ADDRESS - value: /var/lib/kubelet/plugins_registry/csi-rbdplugin/csi.sock + value: /var/lib/kubelet/plugins/csi-rbdplugin/csi.sock imagePullPolicy: "IfNotPresent" volumeMounts: - name: socket-dir - mountPath: /var/lib/kubelet/plugins_registry/csi-rbdplugin + mountPath: /var/lib/kubelet/plugins/csi-rbdplugin volumes: - name: socket-dir hostPath: - path: /var/lib/kubelet/plugins_registry/csi-rbdplugin + path: /var/lib/kubelet/plugins/csi-rbdplugin type: DirectoryOrCreate diff --git a/deploy/rbd/kubernetes/csi-rbdplugin-provisioner.yaml b/deploy/rbd/kubernetes/csi-rbdplugin-provisioner.yaml index fd7e3c634..90d5c410b 100644 --- a/deploy/rbd/kubernetes/csi-rbdplugin-provisioner.yaml +++ b/deploy/rbd/kubernetes/csi-rbdplugin-provisioner.yaml @@ -33,13 +33,13 @@ spec: - "--v=5" env: - name: ADDRESS - value: /var/lib/kubelet/plugins_registry/csi-rbdplugin/csi.sock + value: /var/lib/kubelet/plugins/csi-rbdplugin/csi.sock imagePullPolicy: "IfNotPresent" volumeMounts: - name: socket-dir - mountPath: /var/lib/kubelet/plugins_registry/csi-rbdplugin + mountPath: /var/lib/kubelet/plugins/csi-rbdplugin volumes: - name: socket-dir hostPath: - path: /var/lib/kubelet/plugins_registry/csi-rbdplugin + path: /var/lib/kubelet/plugins/csi-rbdplugin type: DirectoryOrCreate diff --git a/deploy/rbd/kubernetes/csi-rbdplugin.yaml b/deploy/rbd/kubernetes/csi-rbdplugin.yaml index 721565873..66c8d57ee 100644 --- a/deploy/rbd/kubernetes/csi-rbdplugin.yaml +++ b/deploy/rbd/kubernetes/csi-rbdplugin.yaml @@ -19,23 +19,23 @@ spec: dnsPolicy: ClusterFirstWithHostNet containers: - name: driver-registrar - image: quay.io/k8scsi/driver-registrar:canary + image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.2 args: - "--v=5" - - "--csi-address=$(ADDRESS)" - - "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)" + - "--csi-address=/csi/csi.sock" + - "--kubelet-registration-path=/var/lib/kubelet/plugins/csi-rbdplugin/csi.sock" + lifecycle: + preStop: + exec: + command: ["/bin/sh", "-c", "rm -rf /registration/csi-rbdplugin /registration/csi-rbdplugin-reg.sock"] env: - - name: ADDRESS - value: /var/lib/kubelet/plugins_registry/csi-rbdplugin/csi.sock - - name: DRIVER_REG_SOCK_PATH - value: /var/lib/kubelet/plugins_registry/csi-rbdplugin/csi.sock - name: KUBE_NODE_NAME valueFrom: fieldRef: fieldPath: spec.nodeName volumeMounts: - - name: socket-dir - mountPath: /var/lib/kubelet/plugins_registry/csi-rbdplugin + - name: plugin-dir + mountPath: /csi - name: registration-dir mountPath: /registration - name: csi-rbdplugin @@ -54,7 +54,7 @@ spec: - "--metadatastorage=k8s_configmap" env: - name: HOST_ROOTFS - value: "/rootfs" + value: "/rootfs" - name: NODE_ID valueFrom: fieldRef: @@ -87,10 +87,10 @@ spec: volumes: - name: plugin-dir hostPath: - path: /var/lib/kubelet/plugins_registry/csi-rbdplugin + path: /var/lib/kubelet/plugins/csi-rbdplugin type: DirectoryOrCreate - name: plugin-mount-dir - hostPath: + hostPath: path: /var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices/ type: DirectoryOrCreate - name: registration-dir @@ -101,10 +101,6 @@ spec: hostPath: path: /var/lib/kubelet/pods type: Directory - - name: socket-dir - hostPath: - path: /var/lib/kubelet/plugins_registry/csi-rbdplugin - type: DirectoryOrCreate - name: host-dev hostPath: path: /dev diff --git a/pkg/cephfs/driver.go b/pkg/cephfs/driver.go index 518da6ffc..a4e39005e 100644 --- a/pkg/cephfs/driver.go +++ b/pkg/cephfs/driver.go @@ -26,7 +26,7 @@ import ( ) const ( - PluginFolder = "/var/lib/kubelet/plugins_registry/csi-cephfsplugin" + PluginFolder = "/var/lib/kubelet/plugins/csi-cephfsplugin" Version = "1.0.0" ) diff --git a/pkg/cephfs/nodeserver.go b/pkg/cephfs/nodeserver.go index ca20d4a5f..e33f38f8b 100644 --- a/pkg/cephfs/nodeserver.go +++ b/pkg/cephfs/nodeserver.go @@ -241,3 +241,7 @@ func (ns *nodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetC }, }, nil } + +func (ns *nodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) { + return ns.DefaultNodeServer.NodeGetInfo(ctx, req) +} diff --git a/pkg/rbd/nodeserver.go b/pkg/rbd/nodeserver.go index 9ea5138e4..2eeaf0530 100644 --- a/pkg/rbd/nodeserver.go +++ b/pkg/rbd/nodeserver.go @@ -218,6 +218,10 @@ func (ns *nodeServer) NodeUnstageVolume( return nil, status.Error(codes.Unimplemented, "") } +func (ns *nodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) { + return ns.DefaultNodeServer.NodeGetInfo(ctx, req) +} + func resolveBindMountedBlockDevice(mountPath string) (string, error) { cmd := exec.Command("findmnt", "-n", "-o", "SOURCE", "--first-only", "--target", mountPath) out, err := cmd.CombinedOutput() diff --git a/pkg/rbd/rbd.go b/pkg/rbd/rbd.go index 5aa8b6b26..014a9802b 100644 --- a/pkg/rbd/rbd.go +++ b/pkg/rbd/rbd.go @@ -30,7 +30,7 @@ import ( // PluginFolder defines the location of rbdplugin const ( - PluginFolder = "/var/lib/kubelet/plugins_registry/csi-rbdplugin" + PluginFolder = "/var/lib/kubelet/plugins/csi-rbdplugin" rbdDefaultAdminId = "admin" rbdDefaultUserId = rbdDefaultAdminId )