Skip to content
This repository was archived by the owner on Mar 22, 2018. It is now read-only.

Commit cc846a0

Browse files
committed
add deploy and example instructions
1 parent 235ccad commit cc846a0

15 files changed

Lines changed: 548 additions & 6 deletions

pkg/cinder/README.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,51 @@
11
# CSI Cinder driver
22

3-
## Usage:
3+
## Kubernetes
4+
5+
### Requirements
6+
7+
The following feature gates and runtime config have to be enabled to deploy the driver.
8+
9+
```
10+
FEATURE_GATES=CSIPersistentVolume=true,MountPropagation=true
11+
RUNTIME_CONFIG="storage.k8s.io/v1alpha1=true"
12+
```
13+
14+
Mountprogpation requires support for privileged containers. So, make sure privileged containers are enabled in the cluster.
15+
16+
### Example local-up-cluster.sh
17+
18+
```ALLOW_PRIVILEGED=true FEATURE_GATES=CSIPersistentVolume=true,MountPropagation=true RUNTIME_CONFIG="storage.k8s.io/v1alpha1=true" LOG_LEVEL=5 hack/local-up-cluster.sh```
19+
20+
### Deploy
21+
22+
Encode your ```cloud.conf``` file content using base64.
23+
24+
```base64 -w 0 cloud.conf```
25+
26+
Update ```cloud.conf``` configuration in ```deploy/kubernetes/csi-secret-cinderplugin.yaml``` file
27+
by using the result of the above command.
28+
29+
```kubectl -f deploy/kubernetes create```
30+
31+
### Example Nginx application
32+
33+
```kubectl -f examples/kubernetes/nginx.yaml create```
34+
35+
## Using CSC tool
436

537
### Start Cinder driver
638
```
739
$ sudo ./_output/cinderplugin --endpoint tcp://127.0.0.1:10000 --cloud-config /etc/cloud.conf --nodeid CSINodeID
840
```
941

10-
### Test using csc
42+
### Test
1143
Get ```csc``` tool from https://github.com/chakri-nelluri/gocsi/tree/master/csc
1244

1345
#### Get plugin info
1446
```
1547
$ csc identity plugin-info --endpoint tcp://127.0.0.1:10000
16-
"Cinder" "0.1.0"
48+
"csi-cinderplugin" "0.1.0"
1749
```
1850

1951
#### Get supported versions
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# This YAML file contains attacher & csi driver API objects,
2+
# which are necessary to run external csi attacher for cinder.
3+
4+
kind: Service
5+
apiVersion: v1
6+
metadata:
7+
name: csi-attacher-cinderplugin
8+
labels:
9+
app: csi-attacher-cinderplugin
10+
spec:
11+
selector:
12+
app: csi-attacher-cinderplugin
13+
ports:
14+
- name: dummy
15+
port: 12345
16+
17+
---
18+
kind: StatefulSet
19+
apiVersion: apps/v1beta1
20+
metadata:
21+
name: csi-attacher-cinderplugin
22+
spec:
23+
serviceName: "csi-attacher-cinderplugin"
24+
replicas: 1
25+
template:
26+
metadata:
27+
labels:
28+
app: csi-attacher-cinderplugin
29+
spec:
30+
serviceAccount: csi-attacher
31+
containers:
32+
- name: csi-attacher
33+
image: docker.io/k8scsi/csi-attacher
34+
args:
35+
- "--v=5"
36+
- "--csi-address=$(ADDRESS)"
37+
env:
38+
- name: ADDRESS
39+
value: /var/lib/csi/sockets/pluginproxy/csi.sock
40+
imagePullPolicy: "IfNotPresent"
41+
volumeMounts:
42+
- name: socket-dir
43+
mountPath: /var/lib/csi/sockets/pluginproxy/
44+
- name: cinder
45+
image: docker.io/k8scsi/cinderplugin
46+
args :
47+
- "--nodeid=$(NODE_ID)"
48+
- "--endpoint=$(CSI_ENDPOINT)"
49+
- "--cloud-config=$(CLOUD_CONFIG)"
50+
env:
51+
- name: NODE_ID
52+
valueFrom:
53+
fieldRef:
54+
fieldPath: spec.nodeName
55+
- name: CSI_ENDPOINT
56+
value: unix://plugin/csi.sock
57+
- name: CLOUD_CONFIG
58+
value: /etc/config/cloud.conf
59+
imagePullPolicy: "IfNotPresent"
60+
volumeMounts:
61+
- name: socket-dir
62+
mountPath: /plugin
63+
- name: secret-cinderplugin
64+
mountPath: /etc/config
65+
readOnly: true
66+
volumes:
67+
- name: socket-dir
68+
emptyDir:
69+
- name: secret-cinderplugin
70+
secret:
71+
secretName: csi-secret-cinderplugin
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This YAML file contains RBAC API objects,
2+
# which are necessary to run external csi attacher for cinder.
3+
4+
apiVersion: v1
5+
kind: ServiceAccount
6+
metadata:
7+
name: csi-attacher
8+
9+
---
10+
kind: ClusterRole
11+
apiVersion: rbac.authorization.k8s.io/v1
12+
metadata:
13+
name: external-attacher-runner
14+
rules:
15+
- apiGroups: [""]
16+
resources: ["persistentvolumes"]
17+
verbs: ["get", "list", "watch", "update"]
18+
- apiGroups: [""]
19+
resources: ["nodes"]
20+
verbs: ["get", "list", "watch"]
21+
- apiGroups: ["storage.k8s.io"]
22+
resources: ["volumeattachments"]
23+
verbs: ["get", "list", "watch", "update"]
24+
25+
---
26+
kind: ClusterRoleBinding
27+
apiVersion: rbac.authorization.k8s.io/v1
28+
metadata:
29+
name: csi-attacher-role
30+
subjects:
31+
- kind: ServiceAccount
32+
name: csi-attacher
33+
namespace: default
34+
roleRef:
35+
kind: ClusterRole
36+
name: external-attacher-runner
37+
apiGroup: rbac.authorization.k8s.io
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# This YAML file contains driver-registrar & csi driver nodeplugin API objects,
2+
# which are necessary to run csi nodeplugin for cinder.
3+
4+
kind: DaemonSet
5+
apiVersion: apps/v1beta2
6+
metadata:
7+
name: csi-nodeplugin-cinderplugin
8+
spec:
9+
selector:
10+
matchLabels:
11+
app: csi-nodeplugin-cinderplugin
12+
template:
13+
metadata:
14+
labels:
15+
app: csi-nodeplugin-cinderplugin
16+
spec:
17+
serviceAccount: csi-nodeplugin
18+
hostNetwork: true
19+
containers:
20+
- name: driver-registrar
21+
image: docker.io/k8scsi/driver-registrar
22+
args:
23+
- "--v=5"
24+
- "--csi-address=$(ADDRESS)"
25+
env:
26+
- name: ADDRESS
27+
value: /plugin/csi.sock
28+
- name: KUBE_NODE_NAME
29+
valueFrom:
30+
fieldRef:
31+
fieldPath: spec.nodeName
32+
volumeMounts:
33+
- name: plugin-dir
34+
mountPath: /plugin
35+
- name: cinder
36+
securityContext:
37+
privileged: true
38+
capabilities:
39+
add: ["SYS_ADMIN"]
40+
allowPrivilegeEscalation: true
41+
image: docker.io/k8scsi/cinderplugin
42+
args :
43+
- "--nodeid=$(NODE_ID)"
44+
- "--endpoint=$(CSI_ENDPOINT)"
45+
- "--cloud-config=$(CLOUD_CONFIG)"
46+
env:
47+
- name: NODE_ID
48+
valueFrom:
49+
fieldRef:
50+
fieldPath: spec.nodeName
51+
- name: CSI_ENDPOINT
52+
value: unix://plugin/csi.sock
53+
- name: CLOUD_CONFIG
54+
value: /etc/config/cloud.conf
55+
imagePullPolicy: "IfNotPresent"
56+
volumeMounts:
57+
- name: plugin-dir
58+
mountPath: /plugin
59+
- name: pods-mount-dir
60+
mountPath: /var/lib/kubelet/pods
61+
mountPropagation: "Bidirectional"
62+
- name: pods-cloud-data
63+
mountPath: /var/lib/cloud/data
64+
readOnly: true
65+
- name: pods-probe-dir
66+
mountPath: /dev
67+
mountPropagation: "HostToContainer"
68+
- name: secret-cinderplugin
69+
mountPath: /etc/config
70+
readOnly: true
71+
volumes:
72+
- name: plugin-dir
73+
hostPath:
74+
path: /var/lib/kubelet/plugins/csi-cinderplugin
75+
type: DirectoryOrCreate
76+
- name: pods-mount-dir
77+
hostPath:
78+
path: /var/lib/kubelet/pods
79+
type: Directory
80+
- name: pods-cloud-data
81+
hostPath:
82+
path: /var/lib/cloud/data
83+
type: Directory
84+
- name: pods-probe-dir
85+
hostPath:
86+
path: /dev
87+
type: Directory
88+
- name: secret-cinderplugin
89+
secret:
90+
secretName: csi-secret-cinderplugin
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This YAML defines all API objects to create RBAC roles for csi node plugin.
2+
3+
apiVersion: v1
4+
kind: ServiceAccount
5+
metadata:
6+
name: csi-nodeplugin
7+
8+
---
9+
kind: ClusterRole
10+
apiVersion: rbac.authorization.k8s.io/v1
11+
metadata:
12+
name: csi-nodeplugin
13+
rules:
14+
- apiGroups: [""]
15+
resources: ["persistentvolumes"]
16+
verbs: ["get", "list", "watch", "update"]
17+
- apiGroups: [""]
18+
resources: ["nodes"]
19+
verbs: ["get", "list", "watch", "update"]
20+
- apiGroups: ["storage.k8s.io"]
21+
resources: ["volumeattachments"]
22+
verbs: ["get", "list", "watch", "update"]
23+
---
24+
kind: ClusterRoleBinding
25+
apiVersion: rbac.authorization.k8s.io/v1
26+
metadata:
27+
name: csi-nodeplugin
28+
subjects:
29+
- kind: ServiceAccount
30+
name: csi-nodeplugin
31+
namespace: default
32+
roleRef:
33+
kind: ClusterRole
34+
name: csi-nodeplugin
35+
apiGroup: rbac.authorization.k8s.io
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# This YAML file contains attacher & csi driver API objects,
2+
# which are necessary to run external csi provisioner for cinder.
3+
4+
kind: Service
5+
apiVersion: v1
6+
metadata:
7+
name: csi-provisioner-cinderplugin
8+
labels:
9+
app: csi-provisioner-cinderplugin
10+
spec:
11+
selector:
12+
app: csi-provisioner-cinderplugin
13+
ports:
14+
- name: dummy
15+
port: 12345
16+
17+
---
18+
kind: StatefulSet
19+
apiVersion: apps/v1beta1
20+
metadata:
21+
name: csi-provisioner-cinderplugin
22+
spec:
23+
serviceName: "csi-provisioner-cinderplugin"
24+
replicas: 1
25+
template:
26+
metadata:
27+
labels:
28+
app: csi-provisioner-cinderplugin
29+
spec:
30+
serviceAccount: csi-provisioner
31+
containers:
32+
- name: csi-provisioner
33+
image: docker.io/k8scsi/csi-provisioner
34+
args:
35+
- "--provisioner=csi-cinderplugin"
36+
- "--csi-address=$(ADDRESS)"
37+
env:
38+
- name: ADDRESS
39+
value: /var/lib/csi/sockets/pluginproxy/csi.sock
40+
imagePullPolicy: "IfNotPresent"
41+
volumeMounts:
42+
- name: socket-dir
43+
mountPath: /var/lib/csi/sockets/pluginproxy/
44+
- name: cinder
45+
image: docker.io/k8scsi/cinderplugin
46+
args :
47+
- "--nodeid=$(NODE_ID)"
48+
- "--endpoint=$(CSI_ENDPOINT)"
49+
- "--cloud-config=$(CLOUD_CONFIG)"
50+
env:
51+
- name: NODE_ID
52+
valueFrom:
53+
fieldRef:
54+
fieldPath: spec.nodeName
55+
- name: CSI_ENDPOINT
56+
value: unix://plugin/csi.sock
57+
- name: CLOUD_CONFIG
58+
value: /etc/config/cloud.conf
59+
imagePullPolicy: "IfNotPresent"
60+
volumeMounts:
61+
- name: socket-dir
62+
mountPath: /plugin
63+
- name: secret-cinderplugin
64+
mountPath: /etc/config
65+
readOnly: true
66+
volumes:
67+
- name: socket-dir
68+
emptyDir:
69+
- name: secret-cinderplugin
70+
secret:
71+
secretName: csi-secret-cinderplugin

0 commit comments

Comments
 (0)