switch to node registrar

This commit is contained in:
Huamin Chen 2019-01-22 11:31:55 -05:00
parent be4c88f606
commit c6c496ff59
10 changed files with 46 additions and 46 deletions

View File

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

View File

@ -34,13 +34,13 @@ spec:
- "--v=5" - "--v=5"
env: env:
- name: ADDRESS - name: ADDRESS
value: /var/lib/kubelet/plugins_registry/csi-cephfsplugin/csi.sock value: /var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock
imagePullPolicy: "IfNotPresent" imagePullPolicy: "IfNotPresent"
volumeMounts: volumeMounts:
- name: socket-dir - name: socket-dir
mountPath: /var/lib/kubelet/plugins_registry/csi-cephfsplugin mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
volumes: volumes:
- name: socket-dir - name: socket-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins_registry/csi-cephfsplugin path: /var/lib/kubelet/plugins/csi-cephfsplugin
type: DirectoryOrCreate type: DirectoryOrCreate

View File

@ -18,23 +18,23 @@ spec:
dnsPolicy: ClusterFirstWithHostNet dnsPolicy: ClusterFirstWithHostNet
containers: containers:
- name: driver-registrar - name: driver-registrar
image: quay.io/k8scsi/driver-registrar:canary image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.2
args: args:
- "--v=5" - "--v=5"
- "--csi-address=$(ADDRESS)" - "--csi-address=/csi/csi.sock"
- "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)" - "--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: 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 - name: KUBE_NODE_NAME
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: spec.nodeName fieldPath: spec.nodeName
volumeMounts: volumeMounts:
- name: socket-dir - name: plugin-dir
mountPath: /var/lib/kubelet/plugins_registry/csi-cephfsplugin mountPath: /csi
- name: registration-dir - name: registration-dir
mountPath: /registration mountPath: /registration
- name: csi-cephfsplugin - name: csi-cephfsplugin
@ -60,11 +60,11 @@ spec:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: CSI_ENDPOINT - 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" imagePullPolicy: "IfNotPresent"
volumeMounts: volumeMounts:
- name: plugin-dir - name: plugin-dir
mountPath: /var/lib/kubelet/plugins_registry/csi-cephfsplugin mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
- 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"
@ -81,7 +81,7 @@ spec:
volumes: volumes:
- name: plugin-dir - name: plugin-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins_registry/csi-cephfsplugin path: /var/lib/kubelet/plugins/csi-cephfsplugin/
type: DirectoryOrCreate type: DirectoryOrCreate
- name: csi-plugins-dir - name: csi-plugins-dir
hostPath: hostPath:
@ -95,10 +95,6 @@ spec:
hostPath: hostPath:
path: /var/lib/kubelet/pods path: /var/lib/kubelet/pods
type: Directory type: Directory
- name: socket-dir
hostPath:
path: /var/lib/kubelet/plugins_registry/csi-cephfsplugin
type: DirectoryOrCreate
- name: host-sys - name: host-sys
hostPath: hostPath:
path: /sys path: /sys

View File

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

View File

@ -33,13 +33,13 @@ spec:
- "--v=5" - "--v=5"
env: env:
- name: ADDRESS - name: ADDRESS
value: /var/lib/kubelet/plugins_registry/csi-rbdplugin/csi.sock value: /var/lib/kubelet/plugins/csi-rbdplugin/csi.sock
imagePullPolicy: "IfNotPresent" imagePullPolicy: "IfNotPresent"
volumeMounts: volumeMounts:
- name: socket-dir - name: socket-dir
mountPath: /var/lib/kubelet/plugins_registry/csi-rbdplugin mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
volumes: volumes:
- name: socket-dir - name: socket-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins_registry/csi-rbdplugin path: /var/lib/kubelet/plugins/csi-rbdplugin
type: DirectoryOrCreate type: DirectoryOrCreate

View File

@ -19,23 +19,23 @@ spec:
dnsPolicy: ClusterFirstWithHostNet dnsPolicy: ClusterFirstWithHostNet
containers: containers:
- name: driver-registrar - name: driver-registrar
image: quay.io/k8scsi/driver-registrar:canary image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.2
args: args:
- "--v=5" - "--v=5"
- "--csi-address=$(ADDRESS)" - "--csi-address=/csi/csi.sock"
- "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)" - "--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: 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 - name: KUBE_NODE_NAME
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: spec.nodeName fieldPath: spec.nodeName
volumeMounts: volumeMounts:
- name: socket-dir - name: plugin-dir
mountPath: /var/lib/kubelet/plugins_registry/csi-rbdplugin mountPath: /csi
- name: registration-dir - name: registration-dir
mountPath: /registration mountPath: /registration
- name: csi-rbdplugin - name: csi-rbdplugin
@ -54,7 +54,7 @@ spec:
- "--metadatastorage=k8s_configmap" - "--metadatastorage=k8s_configmap"
env: env:
- name: HOST_ROOTFS - name: HOST_ROOTFS
value: "/rootfs" value: "/rootfs"
- name: NODE_ID - name: NODE_ID
valueFrom: valueFrom:
fieldRef: fieldRef:
@ -87,10 +87,10 @@ spec:
volumes: volumes:
- name: plugin-dir - name: plugin-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins_registry/csi-rbdplugin path: /var/lib/kubelet/plugins/csi-rbdplugin
type: DirectoryOrCreate type: DirectoryOrCreate
- name: plugin-mount-dir - name: plugin-mount-dir
hostPath: hostPath:
path: /var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices/ path: /var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices/
type: DirectoryOrCreate type: DirectoryOrCreate
- name: registration-dir - name: registration-dir
@ -101,10 +101,6 @@ spec:
hostPath: hostPath:
path: /var/lib/kubelet/pods path: /var/lib/kubelet/pods
type: Directory type: Directory
- name: socket-dir
hostPath:
path: /var/lib/kubelet/plugins_registry/csi-rbdplugin
type: DirectoryOrCreate
- name: host-dev - name: host-dev
hostPath: hostPath:
path: /dev path: /dev

View File

@ -26,7 +26,7 @@ import (
) )
const ( const (
PluginFolder = "/var/lib/kubelet/plugins_registry/csi-cephfsplugin" PluginFolder = "/var/lib/kubelet/plugins/csi-cephfsplugin"
Version = "1.0.0" Version = "1.0.0"
) )

View File

@ -241,3 +241,7 @@ func (ns *nodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetC
}, },
}, nil }, nil
} }
func (ns *nodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
return ns.DefaultNodeServer.NodeGetInfo(ctx, req)
}

View File

@ -218,6 +218,10 @@ func (ns *nodeServer) NodeUnstageVolume(
return nil, status.Error(codes.Unimplemented, "") 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) { func resolveBindMountedBlockDevice(mountPath string) (string, error) {
cmd := exec.Command("findmnt", "-n", "-o", "SOURCE", "--first-only", "--target", mountPath) cmd := exec.Command("findmnt", "-n", "-o", "SOURCE", "--first-only", "--target", mountPath)
out, err := cmd.CombinedOutput() out, err := cmd.CombinedOutput()

View File

@ -30,7 +30,7 @@ import (
// PluginFolder defines the location of rbdplugin // PluginFolder defines the location of rbdplugin
const ( const (
PluginFolder = "/var/lib/kubelet/plugins_registry/csi-rbdplugin" PluginFolder = "/var/lib/kubelet/plugins/csi-rbdplugin"
rbdDefaultAdminId = "admin" rbdDefaultAdminId = "admin"
rbdDefaultUserId = rbdDefaultAdminId rbdDefaultUserId = rbdDefaultAdminId
) )