Skip to content

Commit

Permalink
Introduce Controller with Create and Delete Volume capability
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthik committed Nov 1, 2020
1 parent 44eb94a commit c11c4b1
Show file tree
Hide file tree
Showing 25 changed files with 2,586 additions and 21 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ verify:

.PHONY: test
test:
go test -v -race $$(go list ./pkg/... | grep -v /driver)
# TODO stop skipping controller tests when controller is implemented
go test -v -race ./pkg/driver/... -ginkgo.skip='\[Controller.Server\]'
go test -v -race $$(go list ./pkg/...)
go test -v -race ./pkg/driver/...

.PHONY: test-e2e
test-e2e:
Expand Down
35 changes: 35 additions & 0 deletions deploy/kubernetes/base/clusterrole-provisioner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: efs-external-provisioner-role
labels:
app.kubernetes.io/name: aws-efs-csi-driver
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots"]
verbs: ["get", "list"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents"]
verbs: ["get", "list"]
- apiGroups: ["storage.k8s.io"]
resources: ["csinodes"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "watch", "list", "delete", "update", "create"]
15 changes: 15 additions & 0 deletions deploy/kubernetes/base/clusterrolebinding-provisioner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: efs-csi-provisioner-binding
labels:
app.kubernetes.io/name: aws-efs-csi-driver
subjects:
- kind: ServiceAccount
name: efs-csi-controller-sa
namespace: kube-system
roleRef:
kind: ClusterRole
name: efs-external-provisioner-role
apiGroup: rbac.authorization.k8s.io
77 changes: 77 additions & 0 deletions deploy/kubernetes/base/controller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
# Controller Service
kind: Deployment
apiVersion: apps/v1
metadata:
name: efs-csi-controller
namespace: kube-system
labels:
app.kubernetes.io/name: aws-efs-csi-driver
spec:
replicas: 2
selector:
matchLabels:
app: efs-csi-controller
app.kubernetes.io/name: aws-efs-csi-driver
template:
metadata:
labels:
app: efs-csi-controller
app.kubernetes.io/name: aws-efs-csi-driver
spec:
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: efs-csi-controller-sa
priorityClassName: system-cluster-critical
tolerations:
- operator: Exists
containers:
- name: efs-plugin
image: amazon/aws-efs-csi-driver:latest
imagePullPolicy: IfNotPresent
args:
- --endpoint=$(CSI_ENDPOINT)
- --logtostderr
- --v=5
env:
- name: CSI_ENDPOINT
value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /var/lib/csi/sockets/pluginproxy/
ports:
- name: healthz
containerPort: 9808
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: healthz
initialDelaySeconds: 10
timeoutSeconds: 3
periodSeconds: 10
failureThreshold: 5
- name: csi-provisioner
image: quay.io/k8scsi/csi-provisioner:v1.6.0
args:
- --csi-address=$(ADDRESS)
- --v=5
- --feature-gates=Topology=true
- --enable-leader-election
- --leader-election-type=leases
env:
- name: ADDRESS
value: /var/lib/csi/sockets/pluginproxy/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /var/lib/csi/sockets/pluginproxy/
- name: liveness-probe
image: quay.io/k8scsi/livenessprobe:v1.1.0
args:
- --csi-address=/csi/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /csi
volumes:
- name: socket-dir
emptyDir: {}
3 changes: 2 additions & 1 deletion deploy/kubernetes/base/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ kind: CSIDriver
metadata:
name: efs.csi.aws.com
spec:
attachRequired: false
attachRequired: true
podInfoOnMount: false
4 changes: 4 additions & 0 deletions deploy/kubernetes/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: kube-system
resources:
- clusterrole-provisioner.yaml
- clusterrolebinding-provisioner.yaml
- node.yaml
- csidriver.yaml
- controller.yaml
- serviceaccount-csi-controller.yaml
4 changes: 4 additions & 0 deletions deploy/kubernetes/base/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ apiVersion: apps/v1
metadata:
name: efs-csi-node
namespace: kube-system
labels:
app.kubernetes.io/name: aws-efs-csi-driver
spec:
selector:
matchLabels:
app: efs-csi-node
app.kubernetes.io/name: aws-efs-csi-driver
template:
metadata:
labels:
app: efs-csi-node
app.kubernetes.io/name: aws-efs-csi-driver
spec:
nodeSelector:
kubernetes.io/os: linux
Expand Down
10 changes: 10 additions & 0 deletions deploy/kubernetes/base/serviceaccount-csi-controller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: efs-csi-controller-sa
namespace: kube-system
labels:
app.kubernetes.io/name: aws-efs-csi-driver
#Enable if EKS IAM for SA is used
#annotations:
# eks.amazonaws.com/role-arn: arn:aws:iam::111122223333:role/efs-csi-role
17 changes: 17 additions & 0 deletions deploy/kubernetes/overlays/dev/master_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,27 @@ apiVersion: apps/v1
metadata:
name: efs-csi-node
namespace: kube-system
labels:
app.kubernetes.io/name: aws-efs-csi-driver
spec:
template:
spec:
containers:
- name: efs-plugin
image: amazon/aws-efs-csi-driver:master
imagePullPolicy: Always
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: efs-csi-controller
namespace: kube-system
labels:
app.kubernetes.io/name: aws-efs-csi-driver
spec:
template:
spec:
containers:
- name: efs-plugin
image: amazon/aws-efs-csi-driver:master
imagePullPolicy: Always
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ module github.com/kubernetes-sigs/aws-efs-csi-driver
require (
github.com/aws/aws-sdk-go v1.31.2
github.com/container-storage-interface/spec v1.2.0
github.com/golang/mock v1.4.3
github.com/golang/mock v1.4.4
github.com/google/uuid v1.1.1
github.com/kubernetes-csi/csi-test v2.2.0+incompatible
github.com/onsi/ginkgo v1.12.2
github.com/onsi/gomega v1.10.1
Expand All @@ -14,6 +15,7 @@ require (
k8s.io/klog v1.0.0
k8s.io/kubernetes v1.17.6
k8s.io/utils v0.0.0-20191114184206-e782cd3c129f
rsc.io/quote/v3 v3.1.0 // indirect
)

replace (
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.4.3 h1:GV+pQPG/EUUbkh47niozDcADz6go/dUwhVzdUQHIVRw=
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
Expand Down Expand Up @@ -670,6 +672,7 @@ golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgw
golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190909030654-5b82db07426d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72 h1:bw9doJza/SFBEweII/rHQh338oozWyiFsBRHtrflcws=
golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
Expand Down
Loading

0 comments on commit c11c4b1

Please sign in to comment.