-
Notifications
You must be signed in to change notification settings - Fork 537
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement node service for EFS driver
- Loading branch information
Cheng Pan
committed
Dec 26, 2018
1 parent
092648f
commit bca5d36
Showing
20 changed files
with
1,761 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: csi-attacher-sa | ||
namespace: default | ||
|
||
--- | ||
|
||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: external-attacher-runner | ||
namespace: default | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["secrets"] | ||
verbs: ["get", "list"] | ||
- apiGroups: [""] | ||
resources: ["events"] | ||
verbs: ["get", "list", "watch", "update"] | ||
- apiGroups: [""] | ||
resources: ["persistentvolumes"] | ||
verbs: ["get", "list", "watch", "update"] | ||
- apiGroups: [""] | ||
resources: ["nodes"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: ["storage.k8s.io"] | ||
resources: ["volumeattachments"] | ||
verbs: ["get", "list", "watch", "update"] | ||
|
||
--- | ||
|
||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: csi-attacher-role | ||
namespace: default | ||
subjects: | ||
- kind: ServiceAccount | ||
name: csi-attacher-sa | ||
namespace: default | ||
roleRef: | ||
kind: ClusterRole | ||
name: external-attacher-runner | ||
apiGroup: rbac.authorization.k8s.io | ||
|
||
--- | ||
|
||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: csi-attacher | ||
labels: | ||
app: csi-attacher | ||
spec: | ||
selector: | ||
app: csi-attacher | ||
clusterIP: None | ||
--- | ||
|
||
kind: StatefulSet | ||
apiVersion: apps/v1beta1 | ||
metadata: | ||
name: csi-attacher | ||
spec: | ||
serviceName: "csi-attacher" | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: csi-attacher | ||
spec: | ||
serviceAccount: csi-attacher-sa | ||
containers: | ||
- name: csi-attacher | ||
securityContext: | ||
privileged: true | ||
capabilities: | ||
add: ["SYS_ADMIN"] | ||
allowPrivilegeEscalation: true | ||
image: quay.io/k8scsi/csi-attacher:v0.4.1 | ||
args: | ||
- --v=5 | ||
- --csi-address=$(ADDRESS) | ||
env: | ||
- name: ADDRESS | ||
value: /var/lib/csi/sockets/pluginproxy/csi.sock | ||
imagePullPolicy: Always | ||
volumeMounts: | ||
- name: socket-dir | ||
mountPath: /var/lib/csi/sockets/pluginproxy/ | ||
- name: efs-plugin | ||
securityContext: | ||
privileged: true | ||
capabilities: | ||
add: ["SYS_ADMIN"] | ||
allowPrivilegeEscalation: true | ||
image: chengpan/aws-efs-csi-driver:testing | ||
args : | ||
- --endpoint=$(CSI_ENDPOINT) | ||
- --logtostderr | ||
- --v=5 | ||
env: | ||
- name: CSI_ENDPOINT | ||
value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock | ||
- name: AWS_ACCESS_KEY_ID | ||
valueFrom: | ||
secretKeyRef: | ||
name: aws-secret | ||
key: key_id | ||
- name: AWS_SECRET_ACCESS_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: aws-secret | ||
key: access_key | ||
imagePullPolicy: Always | ||
volumeMounts: | ||
- name: socket-dir | ||
mountPath: /var/lib/csi/sockets/pluginproxy/ | ||
volumes: | ||
- name: socket-dir | ||
emptyDir: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: csi-node-sa | ||
namespace: default | ||
|
||
--- | ||
|
||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: csi-node | ||
namespace: default | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["secrets"] | ||
verbs: ["get", "list"] | ||
- apiGroups: [""] | ||
resources: ["nodes"] | ||
verbs: ["get", "list", "update"] | ||
- apiGroups: [""] | ||
resources: ["namespaces"] | ||
verbs: ["get", "list"] | ||
- apiGroups: [""] | ||
resources: ["persistentvolumes"] | ||
verbs: ["get", "list", "watch", "update"] | ||
- apiGroups: ["storage.k8s.io"] | ||
resources: ["volumeattachments"] | ||
verbs: ["get", "list", "watch", "update"] | ||
- apiGroups: ["csi.storage.k8s.io"] | ||
resources: ["csinodeinfos"] | ||
verbs: ["get", "list", "watch", "update"] | ||
|
||
--- | ||
|
||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: csi-node | ||
namespace: default | ||
subjects: | ||
- kind: ServiceAccount | ||
name: csi-node-sa | ||
namespace: default | ||
roleRef: | ||
kind: ClusterRole | ||
name: csi-node | ||
apiGroup: rbac.authorization.k8s.io | ||
|
||
--- | ||
|
||
kind: DaemonSet | ||
apiVersion: apps/v1beta2 | ||
metadata: | ||
name: csi-node | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: csi-node | ||
template: | ||
metadata: | ||
labels: | ||
app: csi-node | ||
spec: | ||
serviceAccount: csi-node-sa | ||
hostNetwork: true | ||
containers: | ||
- name: csi-driver-registrar | ||
securityContext: | ||
privileged: true | ||
imagePullPolicy: Always | ||
image: quay.io/k8scsi/driver-registrar:v0.4.1 | ||
args: | ||
- --v=5 | ||
- --csi-address=$(ADDRESS) | ||
- --mode=node-register | ||
- --driver-requires-attachment=true | ||
- --pod-info-mount-version="v1" | ||
- --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH) | ||
env: | ||
- name: ADDRESS | ||
value: /csi/csi.sock | ||
- name: DRIVER_REG_SOCK_PATH | ||
value: /var/lib/kubelet/plugins/efs.csi.aws.com/csi.sock | ||
- name: KUBE_NODE_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: spec.nodeName | ||
volumeMounts: | ||
- name: plugin-dir | ||
mountPath: /csi | ||
- name: registration-dir | ||
mountPath: /registration | ||
- name: efs-plugin | ||
securityContext: | ||
privileged: true | ||
imagePullPolicy: Always | ||
image: chengpan/aws-efs-csi-driver:testing | ||
args: | ||
- --endpoint=$(CSI_ENDPOINT) | ||
- --logtostderr | ||
- --v=5 | ||
env: | ||
- name: CSI_ENDPOINT | ||
value: unix:/csi/csi.sock | ||
- name: AWS_ACCESS_KEY_ID | ||
valueFrom: | ||
secretKeyRef: | ||
name: aws-secret | ||
key: key_id | ||
- name: AWS_SECRET_ACCESS_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: aws-secret | ||
key: access_key | ||
volumeMounts: | ||
- name: kubelet-dir | ||
mountPath: /var/lib/kubelet | ||
mountPropagation: "Bidirectional" | ||
- name: plugin-dir | ||
mountPath: /csi | ||
- name: device-dir | ||
mountPath: /dev | ||
volumes: | ||
- name: kubelet-dir | ||
hostPath: | ||
path: /var/lib/kubelet | ||
type: Directory | ||
- name: plugin-dir | ||
hostPath: | ||
path: /var/lib/kubelet/plugins/efs.csi.aws.com/ | ||
type: DirectoryOrCreate | ||
- name: registration-dir | ||
hostPath: | ||
path: /var/lib/kubelet/plugins/ | ||
type: Directory | ||
- name: device-dir | ||
hostPath: | ||
path: /dev | ||
type: Directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: efs-claim | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: efs-sc | ||
resources: | ||
requests: | ||
storage: 5Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: app | ||
spec: | ||
containers: | ||
- name: app | ||
image: centos | ||
command: ["/bin/sh"] | ||
args: ["-c", "while true; do echo $(date -u) >> /data/out.txt; sleep 5; done"] | ||
volumeMounts: | ||
- name: persistent-storage | ||
mountPath: /data | ||
volumes: | ||
- name: persistent-storage | ||
persistentVolumeClaim: | ||
claimName: efs-claim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: efs-pv | ||
spec: | ||
capacity: | ||
storage: 5Gi | ||
volumeMode: Filesystem | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Recycle | ||
storageClassName: efs-sc | ||
csi: | ||
driver: efs.csi.aws.com | ||
volumeHandle: fs-ff2a9557 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
kind: StorageClass | ||
apiVersion: storage.k8s.io/v1 | ||
metadata: | ||
name: efs-sc | ||
provisioner: efs.csi.aws.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: aws-secret | ||
stringData: | ||
key_id: | ||
access_key: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module github.com/kubernetes-sigs/aws-efs-csi-driver | ||
|
||
require ( | ||
github.com/aws/aws-sdk-go v1.16.5 | ||
github.com/container-storage-interface/spec v0.3.0 | ||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b | ||
github.com/golang/mock v1.2.0 | ||
github.com/golang/protobuf v1.2.0 | ||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d | ||
google.golang.org/grpc v1.17.0 | ||
k8s.io/apimachinery v0.0.0-20181211025822-57dc7e687b54 // indirect | ||
k8s.io/klog v0.1.0 | ||
k8s.io/kubernetes v1.13.1 | ||
k8s.io/utils v0.0.0-20181115163542-0d26856f57b3 | ||
) |
Oops, something went wrong.