diff options
| author | edisonxiang <xiang.edison@gmail.com> | 2019-08-21 21:17:50 +0800 |
|---|---|---|
| committer | edisonxiang <xiang.edison@gmail.com> | 2019-09-05 16:04:36 +0800 |
| commit | bc261c0352fdeaa4547421c8519cb7b8944cee1a (patch) | |
| tree | ba15cd4a1e799611a67fc067ac9703a642a21c79 /build/csisamples/hostpath | |
| parent | add required vendors (diff) | |
| download | kubeedge-bc261c0352fdeaa4547421c8519cb7b8944cee1a.tar.gz | |
add deploy and example
Diffstat (limited to 'build/csisamples/hostpath')
| -rw-r--r-- | build/csisamples/hostpath/deploy/csicontroller.yaml | 164 | ||||
| -rw-r--r-- | build/csisamples/hostpath/deploy/csinode.yaml | 84 | ||||
| -rw-r--r-- | build/csisamples/hostpath/example/app.yaml | 16 | ||||
| -rw-r--r-- | build/csisamples/hostpath/example/pvc.yaml | 11 | ||||
| -rw-r--r-- | build/csisamples/hostpath/example/sc.yaml | 7 |
5 files changed, 282 insertions, 0 deletions
diff --git a/build/csisamples/hostpath/deploy/csicontroller.yaml b/build/csisamples/hostpath/deploy/csicontroller.yaml new file mode 100644 index 000000000..582cb2f53 --- /dev/null +++ b/build/csisamples/hostpath/deploy/csicontroller.yaml @@ -0,0 +1,164 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-controller + namespace: default + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: external-controller-runner +rules: + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "list"] + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete", "update"] + - 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: ["storage.k8s.io"] + resources: ["volumeattachments"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-controller-role +subjects: + - kind: ServiceAccount + name: csi-controller + namespace: default +roleRef: + kind: ClusterRole + name: external-controller-runner + apiGroup: rbac.authorization.k8s.io + +--- +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + namespace: default + name: external-controller-cfg +rules: +- apiGroups: [""] + resources: ["endpoints"] + verbs: ["get", "watch", "list", "delete", "update", "create"] +- apiGroups: [""] + resources: ["configmaps"] + verbs: ["get", "watch", "list", "delete", "update", "create"] +- apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get", "watch", "list", "delete", "update", "create"] + +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-controller-role-cfg + namespace: default +subjects: + - kind: ServiceAccount + name: csi-controller + namespace: default +roleRef: + kind: Role + name: external-controller-cfg + apiGroup: rbac.authorization.k8s.io + +--- +kind: StatefulSet +apiVersion: apps/v1 +metadata: + name: csi-hostpath-controller +spec: + serviceName: "csi-hostpath-controller" + replicas: 1 + selector: + matchLabels: + app: csi-hostpath-controller + template: + metadata: + labels: + app: csi-hostpath-controller + spec: + serviceAccountName: csi-controller + containers: + - name: csi-provisioner + image: quay.io/k8scsi/csi-provisioner:v1.2.1 + imagePullPolicy: IfNotPresent + args: + - -v=5 + - --csi-address=/csi/csi.sock + - --connection-timeout=15s + - --master=http://10.0.0.231:8080 + volumeMounts: + - mountPath: /csi + name: csi-socket-dir + - name: csi-attacher + image: quay.io/k8scsi/csi-attacher:v1.1.1 + imagePullPolicy: IfNotPresent + args: + - --v=5 + - --csi-address=/csi/csi.sock + volumeMounts: + - mountPath: /csi + name: csi-socket-dir + - name: csi-driver + image: kubeedge/csidriver:v1.1.0 + imagePullPolicy: IfNotPresent + args: + - "--v=5" + - "--drivername=$(CSI_DRIVERNAME)" + - "--endpoint=$(CSI_ENDPOINT)" + - "--kubeedgeendpoint=$(KUBEEDGE_ENDPOINT)" + - "--nodeid=$(KUBE_NODE_NAME)" + env: + - name: CSI_DRIVERNAME + value: csi-hostpath + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + - name: KUBEEDGE_ENDPOINT + value: unix:///kubeedge/kubeedge.sock + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + name: csi-socket-dir + - mountPath: /kubeedge + name: kubeedge-socket-dir + volumes: + - hostPath: + path: /var/lib/kubelet/plugins/csi-hostpath + type: DirectoryOrCreate + name: csi-socket-dir + - hostPath: + path: /var/lib/kubeedge + type: DirectoryOrCreate + name: kubeedge-socket-dir diff --git a/build/csisamples/hostpath/deploy/csinode.yaml b/build/csisamples/hostpath/deploy/csinode.yaml new file mode 100644 index 000000000..5859a5535 --- /dev/null +++ b/build/csisamples/hostpath/deploy/csinode.yaml @@ -0,0 +1,84 @@ +kind: DaemonSet +apiVersion: apps/v1beta2 +metadata: + name: csi-hostpath-edge +spec: + selector: + matchLabels: + app: csi-hostpath-edge + template: + metadata: + labels: + app: csi-hostpath-edge + spec: + hostNetwork: true + containers: + - name: node-driver-registrar + image: quay.io/k8scsi/csi-node-driver-registrar:v1.1.0 + imagePullPolicy: IfNotPresent + lifecycle: + preStop: + exec: + command: ["/bin/sh", "-c", "rm -rf /registration/csi-hostpath /registration/csi-hostpath-reg.sock"] + args: + - --v=5 + - --csi-address=/csi/csi.sock + - --kubelet-registration-path=/var/lib/edged/plugins/csi-hostpath/csi.sock + securityContext: + privileged: true + env: + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + - name: csi-hostpath-driver + securityContext: + privileged: true + capabilities: + add: ["SYS_ADMIN"] + allowPrivilegeEscalation: true + image: quay.io/k8scsi/hostpathplugin:v1.1.0 + imagePullPolicy: IfNotPresent + args: + - "--drivername=csi-hostpath" + - "--v=5" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--endpoint=unix:///csi/csi.sock" + env: + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + imagePullPolicy: "IfNotPresent" + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: plugins-dir + mountPath: /var/lib/edged/plugins + mountPropagation: Bidirectional + - name: mountpoint-dir + mountPath: /var/lib/edged/pods + mountPropagation: "Bidirectional" + volumes: + - name: socket-dir + hostPath: + path: /var/lib/edged/plugins/csi-hostpath + type: DirectoryOrCreate + - name: registration-dir + hostPath: + path: /var/lib/edged/plugins_registry + type: DirectoryOrCreate + - name: plugins-dir + hostPath: + path: /var/lib/edged/plugins + type: DirectoryOrCreate + - name: mountpoint-dir + hostPath: + path: /var/lib/edged/pods + type: DirectoryOrCreate diff --git a/build/csisamples/hostpath/example/app.yaml b/build/csisamples/hostpath/example/app.yaml new file mode 100644 index 000000000..48e444241 --- /dev/null +++ b/build/csisamples/hostpath/example/app.yaml @@ -0,0 +1,16 @@ +kind: Pod +apiVersion: v1 +metadata: + name: my-csi-app +spec: + containers: + - name: my-frontend + image: busybox + volumeMounts: + - mountPath: "/data" + name: my-csi-volume + command: [ "sleep", "1000000" ] + volumes: + - name: my-csi-volume + persistentVolumeClaim: + claimName: csi-hostpath-pvc diff --git a/build/csisamples/hostpath/example/pvc.yaml b/build/csisamples/hostpath/example/pvc.yaml new file mode 100644 index 000000000..b0b51c874 --- /dev/null +++ b/build/csisamples/hostpath/example/pvc.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: csi-hostpath-pvc +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + storageClassName: csi-hostpath-sc diff --git a/build/csisamples/hostpath/example/sc.yaml b/build/csisamples/hostpath/example/sc.yaml new file mode 100644 index 000000000..66e4ce71b --- /dev/null +++ b/build/csisamples/hostpath/example/sc.yaml @@ -0,0 +1,7 @@ +apiVersion: storage.k8s.io/v1
+kind: StorageClass
+metadata:
+ name: csi-hostpath-sc
+provisioner: csi-hostpath
+reclaimPolicy: Delete
+volumeBindingMode: Immediate
|
