diff --git a/app/Dockerfile b/Dockerfile similarity index 85% rename from app/Dockerfile rename to Dockerfile index 8306ca37..cfb490dd 100644 --- a/app/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM centos:7.4.1708 # Copy nfsplugin from build _output directory -COPY nfsplugin /nfsplugin +COPY _output/nfsplugin /nfsplugin RUN yum -y install nfs-utils && yum -y install epel-release && yum -y install jq && yum clean all diff --git a/Makefile b/Makefile index 249fe2fd..2a6e4ce7 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ REGISTRY_NAME=quay.io/k8scsi IMAGE_NAME=nfsplugin -IMAGE_VERSION=canary +IMAGE_VERSION=v1.0.0 IMAGE_TAG=$(REGISTRY_NAME)/$(IMAGE_NAME):$(IMAGE_VERSION) REV=$(shell git describe --long --tags --dirty) @@ -29,7 +29,7 @@ nfs: CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o _output/nfsplugin ./app/ nfs-container: nfs - docker build -t $(IMAGE_TAG) -f ./app/Dockerfile . + docker build -t $(IMAGE_TAG) -f ./Dockerfile . push: nfs-container docker push $(IMAGE_TAG) diff --git a/deploy/kubernetes/csi-attacher-nfsplugin.yaml b/deploy/kubernetes/csi-attacher-nfsplugin.yaml index c8165fe8..cb390e21 100644 --- a/deploy/kubernetes/csi-attacher-nfsplugin.yaml +++ b/deploy/kubernetes/csi-attacher-nfsplugin.yaml @@ -30,20 +30,20 @@ spec: serviceAccount: csi-attacher containers: - name: csi-attacher - image: quay.io/k8scsi/csi-attacher:v0.3.0 + image: quay.io/k8scsi/csi-attacher:v1.0.1 args: - "--v=5" - "--csi-address=$(ADDRESS)" env: - name: ADDRESS - value: /var/lib/csi/sockets/pluginproxy/csi.sock + value: /csi/csi.sock imagePullPolicy: "IfNotPresent" volumeMounts: - name: socket-dir - mountPath: /var/lib/csi/sockets/pluginproxy/ + mountPath: /csi - name: nfs - image: quay.io/k8scsi/nfsplugin:v0.3.0 + image: quay.io/k8scsi/nfsplugin:v1.0.0 args : - "--nodeid=$(NODE_ID)" - "--endpoint=$(CSI_ENDPOINT)" @@ -61,4 +61,3 @@ spec: volumes: - name: socket-dir emptyDir: - diff --git a/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml b/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml index 457e6f27..c259cd1f 100644 --- a/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml +++ b/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml @@ -16,14 +16,17 @@ spec: serviceAccount: csi-nodeplugin hostNetwork: true containers: - - name: driver-registrar - image: quay.io/k8scsi/driver-registrar:v0.3.0 + - name: node-driver-registrar + image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.2 + lifecycle: + preStop: + exec: + command: ["/bin/sh", "-c", "rm -rf /registration/csi-nfsplugin /registration/csi-nfsplugin-reg.sock"] args: - - "--v=5" - - "--csi-address=$(ADDRESS)" + - --v=5 + - --csi-address=/plugin/csi.sock + - --kubelet-registration-path=/var/lib/kubelet/plugins/csi-nfsplugin/csi.sock env: - - name: ADDRESS - value: /plugin/csi.sock - name: KUBE_NODE_NAME valueFrom: fieldRef: @@ -31,13 +34,15 @@ spec: volumeMounts: - name: plugin-dir mountPath: /plugin + - name: registration-dir + mountPath: /registration - name: nfs securityContext: privileged: true capabilities: add: ["SYS_ADMIN"] allowPrivilegeEscalation: true - image: quay.io/k8scsi/nfsplugin:v0.3.0 + image: quay.io/k8scsi/nfsplugin:v1.0.0 args : - "--nodeid=$(NODE_ID)" - "--endpoint=$(CSI_ENDPOINT)" @@ -64,3 +69,7 @@ spec: hostPath: path: /var/lib/kubelet/pods type: Directory + - hostPath: + path: /var/lib/kubelet/plugins_registry + type: Directory + name: registration-dir diff --git a/pkg/nfs/driver.go b/pkg/nfs/driver.go index f65c3132..6a1ff1d4 100644 --- a/pkg/nfs/driver.go +++ b/pkg/nfs/driver.go @@ -27,8 +27,8 @@ type driver struct { csiDriver *csicommon.CSIDriver endpoint string - ids *csicommon.DefaultIdentityServer - ns *nodeServer + //ids *identityServer + ns *nodeServer cap []*csi.VolumeCapability_AccessMode cscap []*csi.ControllerServiceCapability @@ -71,8 +71,9 @@ func (d *driver) Run() { s := csicommon.NewNonBlockingGRPCServer() s.Start(d.endpoint, csicommon.NewDefaultIdentityServer(d.csiDriver), - // NFS plugin has not implemented ControllerServer. - nil, + // NFS plugin has not implemented ControllerServer + // using default controllerserver. + csicommon.NewDefaultControllerServer(d.csiDriver), NewNodeServer(d)) s.Wait() }