Skip to content

Commit ba16dbe

Browse files
committed
Add 1.15 deployment specs for hostpath driver
1 parent 7d4b674 commit ba16dbe

File tree

9 files changed

+376
-1
lines changed

9 files changed

+376
-1
lines changed

deploy/kubernetes-1.15/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
The deployment for Kubernetes 1.15 uses CSI 1.0 and thus is
2+
incompatible with Kubernetes < 1.13.
3+
4+
It uses the APIs for CSIDriverInfo and CSINodeInfo that were
5+
introduced in Kubernetes 1.15, so features depending on those (like
6+
topology) will not work on Kubernetes 1.13. But because this example
7+
deployment does not enable those features, it can run on Kubernetes
8+
1.13.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../util/deploy-hostpath.sh
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: csi-hostpath-attacher
5+
labels:
6+
app: csi-hostpath-attacher
7+
spec:
8+
selector:
9+
app: csi-hostpath-attacher
10+
ports:
11+
- name: dummy
12+
port: 12345
13+
14+
---
15+
kind: StatefulSet
16+
apiVersion: apps/v1
17+
metadata:
18+
name: csi-hostpath-attacher
19+
spec:
20+
serviceName: "csi-hostpath-attacher"
21+
replicas: 1
22+
selector:
23+
matchLabels:
24+
app: csi-hostpath-attacher
25+
template:
26+
metadata:
27+
labels:
28+
app: csi-hostpath-attacher
29+
spec:
30+
affinity:
31+
podAffinity:
32+
requiredDuringSchedulingIgnoredDuringExecution:
33+
- labelSelector:
34+
matchExpressions:
35+
- key: app
36+
operator: In
37+
values:
38+
- csi-hostpathplugin
39+
topologyKey: kubernetes.io/hostname
40+
serviceAccountName: csi-attacher
41+
containers:
42+
- name: csi-attacher
43+
image: quay.io/k8scsi/csi-attacher:v1.2.0
44+
args:
45+
- --v=5
46+
- --csi-address=/csi/csi.sock
47+
volumeMounts:
48+
- mountPath: /csi
49+
name: socket-dir
50+
51+
volumes:
52+
- hostPath:
53+
path: /var/lib/kubelet/plugins/csi-hostpath
54+
type: DirectoryOrCreate
55+
name: socket-dir
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Service defined here, plus serviceName below in StatefulSet,
2+
# are needed only because of condition explained in
3+
# https://github.com/kubernetes/kubernetes/issues/69608
4+
5+
kind: Service
6+
apiVersion: v1
7+
metadata:
8+
name: csi-hostpathplugin
9+
labels:
10+
app: csi-hostpathplugin
11+
spec:
12+
selector:
13+
app: csi-hostpathplugin
14+
ports:
15+
- name: dummy
16+
port: 12345
17+
---
18+
kind: StatefulSet
19+
apiVersion: apps/v1
20+
metadata:
21+
name: csi-hostpathplugin
22+
spec:
23+
serviceName: "csi-hostpathplugin"
24+
# One replica only:
25+
# Host path driver only works when everything runs
26+
# on a single node. We achieve that by starting it once and then
27+
# co-locate all other pods via inter-pod affinity
28+
replicas: 1
29+
selector:
30+
matchLabels:
31+
app: csi-hostpathplugin
32+
template:
33+
metadata:
34+
labels:
35+
app: csi-hostpathplugin
36+
spec:
37+
hostNetwork: true
38+
containers:
39+
- name: node-driver-registrar
40+
image: quay.io/k8scsi/csi-node-driver-registrar:v1.1.0
41+
lifecycle:
42+
preStop:
43+
exec:
44+
command: ["/bin/sh", "-c", "rm -rf /registration/csi-hostpath /registration/csi-hostpath-reg.sock"]
45+
args:
46+
- --v=5
47+
- --csi-address=/csi/csi.sock
48+
- --kubelet-registration-path=/var/lib/kubelet/plugins/csi-hostpath/csi.sock
49+
securityContext:
50+
privileged: true
51+
env:
52+
- name: KUBE_NODE_NAME
53+
valueFrom:
54+
fieldRef:
55+
apiVersion: v1
56+
fieldPath: spec.nodeName
57+
volumeMounts:
58+
- mountPath: /csi
59+
name: socket-dir
60+
- mountPath: /registration
61+
name: registration-dir
62+
- mountPath: /csi-data-dir
63+
name: csi-data-dir
64+
65+
- name: hostpath
66+
image: quay.io/k8scsi/hostpathplugin:v1.1.0
67+
args:
68+
- "--v=5"
69+
- "--endpoint=$(CSI_ENDPOINT)"
70+
- "--nodeid=$(KUBE_NODE_NAME)"
71+
env:
72+
- name: CSI_ENDPOINT
73+
value: unix:///csi/csi.sock
74+
- name: KUBE_NODE_NAME
75+
valueFrom:
76+
fieldRef:
77+
apiVersion: v1
78+
fieldPath: spec.nodeName
79+
securityContext:
80+
privileged: true
81+
ports:
82+
- containerPort: 9898
83+
name: healthz
84+
protocol: TCP
85+
livenessProbe:
86+
failureThreshold: 5
87+
httpGet:
88+
path: /healthz
89+
port: healthz
90+
initialDelaySeconds: 10
91+
timeoutSeconds: 3
92+
periodSeconds: 2
93+
volumeMounts:
94+
- mountPath: /csi
95+
name: socket-dir
96+
- mountPath: /var/lib/kubelet/pods
97+
mountPropagation: Bidirectional
98+
name: mountpoint-dir
99+
- mountPath: /var/lib/kubelet/plugins
100+
mountPropagation: Bidirectional
101+
name: plugins-dir
102+
- mountPath: /csi-data-dir
103+
name: csi-data-dir
104+
105+
- name: liveness-probe
106+
volumeMounts:
107+
- mountPath: /csi
108+
name: socket-dir
109+
image: quay.io/k8scsi/livenessprobe:v1.1.0
110+
args:
111+
- --csi-address=/csi/csi.sock
112+
- --connection-timeout=3s
113+
- --health-port=9898
114+
115+
volumes:
116+
- hostPath:
117+
path: /var/lib/kubelet/plugins/csi-hostpath
118+
type: DirectoryOrCreate
119+
name: socket-dir
120+
- hostPath:
121+
path: /var/lib/kubelet/pods
122+
type: DirectoryOrCreate
123+
name: mountpoint-dir
124+
- hostPath:
125+
path: /var/lib/kubelet/plugins_registry
126+
type: Directory
127+
name: registration-dir
128+
- hostPath:
129+
path: /var/lib/kubelet/plugins
130+
type: Directory
131+
name: plugins-dir
132+
- hostPath:
133+
# 'path' is where PV data is persisted on host.
134+
# using /tmp is also possible while the PVs will not available after plugin container recreation or host reboot
135+
path: /var/lib/csi-hostpath-data/
136+
type: DirectoryOrCreate
137+
name: csi-data-dir
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: csi-hostpath-provisioner
5+
labels:
6+
app: csi-hostpath-provisioner
7+
spec:
8+
selector:
9+
app: csi-hostpath-provisioner
10+
ports:
11+
- name: dummy
12+
port: 12345
13+
14+
---
15+
kind: StatefulSet
16+
apiVersion: apps/v1
17+
metadata:
18+
name: csi-hostpath-provisioner
19+
spec:
20+
serviceName: "csi-hostpath-provisioner"
21+
replicas: 1
22+
selector:
23+
matchLabels:
24+
app: csi-hostpath-provisioner
25+
template:
26+
metadata:
27+
labels:
28+
app: csi-hostpath-provisioner
29+
spec:
30+
affinity:
31+
podAffinity:
32+
requiredDuringSchedulingIgnoredDuringExecution:
33+
- labelSelector:
34+
matchExpressions:
35+
- key: app
36+
operator: In
37+
values:
38+
- csi-hostpathplugin
39+
topologyKey: kubernetes.io/hostname
40+
serviceAccountName: csi-provisioner
41+
containers:
42+
- name: csi-provisioner
43+
image: quay.io/k8scsi/csi-provisioner:v1.3.0
44+
args:
45+
- -v=5
46+
- --csi-address=/csi/csi.sock
47+
- --connection-timeout=15s
48+
volumeMounts:
49+
- mountPath: /csi
50+
name: socket-dir
51+
volumes:
52+
- hostPath:
53+
path: /var/lib/kubelet/plugins/csi-hostpath
54+
type: DirectoryOrCreate
55+
name: socket-dir
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: csi-hostpath-snapshotter
5+
labels:
6+
app: csi-hostpath-snapshotter
7+
spec:
8+
selector:
9+
app: csi-hostpath-snapshotter
10+
ports:
11+
- name: dummy
12+
port: 12345
13+
14+
---
15+
kind: StatefulSet
16+
apiVersion: apps/v1
17+
metadata:
18+
name: csi-hostpath-snapshotter
19+
spec:
20+
serviceName: "csi-hostpath-snapshotter"
21+
replicas: 1
22+
selector:
23+
matchLabels:
24+
app: csi-hostpath-snapshotter
25+
template:
26+
metadata:
27+
labels:
28+
app: csi-hostpath-snapshotter
29+
spec:
30+
affinity:
31+
podAffinity:
32+
requiredDuringSchedulingIgnoredDuringExecution:
33+
- labelSelector:
34+
matchExpressions:
35+
- key: app
36+
operator: In
37+
values:
38+
- csi-hostpathplugin
39+
topologyKey: kubernetes.io/hostname
40+
serviceAccount: csi-snapshotter
41+
containers:
42+
- name: csi-snapshotter
43+
image: quay.io/k8scsi/csi-snapshotter:v1.2.0
44+
args:
45+
- -v=5
46+
- --csi-address=/csi/csi.sock
47+
- --connection-timeout=15s
48+
volumeMounts:
49+
- mountPath: /csi
50+
name: socket-dir
51+
volumes:
52+
- hostPath:
53+
path: /var/lib/kubelet/plugins/csi-hostpath
54+
type: DirectoryOrCreate
55+
name: socket-dir
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# WARNING: this is only for testing purposes. Do not install in a production
2+
# cluster.
3+
#
4+
# This exposes the hostpath's Unix domain csi.sock as a TCP port to the
5+
# outside world. The mapping from Unix domain socket to TCP is done
6+
# by socat.
7+
#
8+
# This is useful for testing with csi-sanity or csc.
9+
10+
apiVersion: v1
11+
kind: Service
12+
metadata:
13+
name: hostpath-service
14+
spec:
15+
type: NodePort
16+
selector:
17+
app: csi-hostpath-socat
18+
ports:
19+
- port: 10000 # fixed port inside the pod, dynamically allocated port outside
20+
---
21+
kind: StatefulSet
22+
apiVersion: apps/v1
23+
metadata:
24+
name: csi-hostpath-socat
25+
spec:
26+
serviceName: "csi-hostpath-socat"
27+
replicas: 1
28+
selector:
29+
matchLabels:
30+
app: csi-hostpath-socat
31+
template:
32+
metadata:
33+
labels:
34+
app: csi-hostpath-socat
35+
spec:
36+
affinity:
37+
podAffinity:
38+
requiredDuringSchedulingIgnoredDuringExecution:
39+
- labelSelector:
40+
matchExpressions:
41+
- key: app
42+
operator: In
43+
values:
44+
- csi-hostpathplugin
45+
topologyKey: kubernetes.io/hostname
46+
containers:
47+
- name: socat
48+
image: alpine/socat:1.0.3
49+
args:
50+
- tcp-listen:10000,fork,reuseaddr
51+
- unix-connect:/csi/csi.sock
52+
volumeMounts:
53+
- mountPath: /csi
54+
name: socket-dir
55+
volumes:
56+
- hostPath:
57+
path: /var/lib/kubelet/plugins/csi-hostpath
58+
type: DirectoryOrCreate
59+
name: socket-dir
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: snapshot.storage.k8s.io/v1alpha1
2+
kind: VolumeSnapshotClass
3+
metadata:
4+
name: csi-hostpath-snapclass
5+
snapshotter: csi-hostpath

deploy/kubernetes-latest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
kubernetes-1.14
1+
kubernetes-1.15

0 commit comments

Comments
 (0)