Skip to content

Commit cb8f3ca

Browse files
authored
Merge pull request #282 from pohly/single-pod-deployments
single pod deployments
2 parents 5443144 + 194132f commit cb8f3ca

32 files changed

+1238
-106
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
The deployment for Kubernetes 1.18 uses CSIDriver v1 and
2+
thus is incompatible with Kubernetes < 1.18.
3+
4+
It uses separate pods and service accounts for each sidecar. This is
5+
not how they would normally be deployed. It gets done this way to test
6+
that the individual RBAC rules are correct.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../util/deploy-hostpath.sh
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../util/destroy-hostpath.sh

deploy/kubernetes-1.18/hostpath/csi-hostpath-attacher.yaml renamed to deploy/kubernetes-1.18-test/hostpath/csi-hostpath-attacher.yaml

File renamed without changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: CSIDriver
3+
metadata:
4+
name: hostpath.csi.k8s.io
5+
labels:
6+
app.kubernetes.io/instance: hostpath.csi.k8s.io
7+
app.kubernetes.io/part-of: csi-driver-host-path
8+
app.kubernetes.io/name: hostpath.csi.k8s.io
9+
app.kubernetes.io/component: csi-driver
10+
spec:
11+
# Supports persistent and ephemeral inline volumes.
12+
volumeLifecycleModes:
13+
- Persistent
14+
- Ephemeral
15+
# To determine at runtime which mode a volume uses, pod info and its
16+
# "csi.storage.k8s.io/ephemeral" entry are needed.
17+
podInfoOnMount: true
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
kind: StatefulSet
2+
apiVersion: apps/v1
3+
metadata:
4+
name: csi-hostpathplugin
5+
labels:
6+
app.kubernetes.io/instance: hostpath.csi.k8s.io
7+
app.kubernetes.io/part-of: csi-driver-host-path
8+
app.kubernetes.io/name: csi-hostpathplugin
9+
app.kubernetes.io/component: plugin
10+
spec:
11+
serviceName: "csi-hostpathplugin"
12+
# One replica only:
13+
# Host path driver only works when everything runs
14+
# on a single node. We achieve that by starting it once and then
15+
# co-locate all other pods via inter-pod affinity
16+
replicas: 1
17+
selector:
18+
matchLabels:
19+
app.kubernetes.io/instance: hostpath.csi.k8s.io
20+
app.kubernetes.io/part-of: csi-driver-host-path
21+
app.kubernetes.io/name: csi-hostpathplugin
22+
app.kubernetes.io/component: plugin
23+
template:
24+
metadata:
25+
labels:
26+
app.kubernetes.io/instance: hostpath.csi.k8s.io
27+
app.kubernetes.io/part-of: csi-driver-host-path
28+
app.kubernetes.io/name: csi-hostpathplugin
29+
app.kubernetes.io/component: plugin
30+
spec:
31+
serviceAccountName: csi-external-health-monitor-controller
32+
containers:
33+
- name: hostpath
34+
image: k8s.gcr.io/sig-storage/hostpathplugin:v1.6.2
35+
args:
36+
- "--drivername=hostpath.csi.k8s.io"
37+
- "--v=5"
38+
- "--endpoint=$(CSI_ENDPOINT)"
39+
- "--nodeid=$(KUBE_NODE_NAME)"
40+
env:
41+
- name: CSI_ENDPOINT
42+
value: unix:///csi/csi.sock
43+
- name: KUBE_NODE_NAME
44+
valueFrom:
45+
fieldRef:
46+
apiVersion: v1
47+
fieldPath: spec.nodeName
48+
securityContext:
49+
privileged: true
50+
ports:
51+
- containerPort: 9898
52+
name: healthz
53+
protocol: TCP
54+
livenessProbe:
55+
failureThreshold: 5
56+
httpGet:
57+
path: /healthz
58+
port: healthz
59+
initialDelaySeconds: 10
60+
timeoutSeconds: 3
61+
periodSeconds: 2
62+
volumeMounts:
63+
- mountPath: /csi
64+
name: socket-dir
65+
- mountPath: /var/lib/kubelet/pods
66+
mountPropagation: Bidirectional
67+
name: mountpoint-dir
68+
- mountPath: /var/lib/kubelet/plugins
69+
mountPropagation: Bidirectional
70+
name: plugins-dir
71+
- mountPath: /csi-data-dir
72+
name: csi-data-dir
73+
- mountPath: /dev
74+
name: dev-dir
75+
76+
- name: liveness-probe
77+
volumeMounts:
78+
- mountPath: /csi
79+
name: socket-dir
80+
image: k8s.gcr.io/sig-storage/livenessprobe:v2.2.0
81+
args:
82+
- --csi-address=/csi/csi.sock
83+
- --health-port=9898
84+
85+
- name: csi-external-health-monitor-agent
86+
image: k8s.gcr.io/sig-storage/csi-external-health-monitor-agent:v0.2.0
87+
args:
88+
- "--v=5"
89+
- "--csi-address=$(ADDRESS)"
90+
env:
91+
- name: NODE_NAME
92+
valueFrom:
93+
fieldRef:
94+
fieldPath: spec.nodeName
95+
- name: ADDRESS
96+
value: /csi/csi.sock
97+
imagePullPolicy: "IfNotPresent"
98+
volumeMounts:
99+
- name: socket-dir
100+
mountPath: /csi
101+
102+
- name: csi-external-health-monitor-controller
103+
image: k8s.gcr.io/sig-storage/csi-external-health-monitor-controller:v0.2.0
104+
args:
105+
- "--v=5"
106+
- "--csi-address=$(ADDRESS)"
107+
- "--leader-election"
108+
env:
109+
- name: ADDRESS
110+
value: /csi/csi.sock
111+
imagePullPolicy: "IfNotPresent"
112+
volumeMounts:
113+
- name: socket-dir
114+
mountPath: /csi
115+
116+
- name: node-driver-registrar
117+
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.0.1
118+
args:
119+
- --v=5
120+
- --csi-address=/csi/csi.sock
121+
- --kubelet-registration-path=/var/lib/kubelet/plugins/csi-hostpath/csi.sock
122+
securityContext:
123+
# This is necessary only for systems with SELinux, where
124+
# non-privileged sidecar containers cannot access unix domain socket
125+
# created by privileged CSI driver container.
126+
privileged: true
127+
env:
128+
- name: KUBE_NODE_NAME
129+
valueFrom:
130+
fieldRef:
131+
apiVersion: v1
132+
fieldPath: spec.nodeName
133+
volumeMounts:
134+
- mountPath: /csi
135+
name: socket-dir
136+
- mountPath: /registration
137+
name: registration-dir
138+
- mountPath: /csi-data-dir
139+
name: csi-data-dir
140+
141+
volumes:
142+
- hostPath:
143+
path: /var/lib/kubelet/plugins/csi-hostpath
144+
type: DirectoryOrCreate
145+
name: socket-dir
146+
- hostPath:
147+
path: /var/lib/kubelet/pods
148+
type: DirectoryOrCreate
149+
name: mountpoint-dir
150+
- hostPath:
151+
path: /var/lib/kubelet/plugins_registry
152+
type: Directory
153+
name: registration-dir
154+
- hostPath:
155+
path: /var/lib/kubelet/plugins
156+
type: Directory
157+
name: plugins-dir
158+
- hostPath:
159+
# 'path' is where PV data is persisted on host.
160+
# using /tmp is also possible while the PVs will not available after plugin container recreation or host reboot
161+
path: /var/lib/csi-hostpath-data/
162+
type: DirectoryOrCreate
163+
name: csi-data-dir
164+
- hostPath:
165+
path: /dev
166+
type: Directory
167+
name: dev-dir

deploy/kubernetes-1.18/hostpath/csi-hostpath-provisioner.yaml renamed to deploy/kubernetes-1.18-test/hostpath/csi-hostpath-provisioner.yaml

File renamed without changes.

deploy/kubernetes-1.18/hostpath/csi-hostpath-resizer.yaml renamed to deploy/kubernetes-1.18-test/hostpath/csi-hostpath-resizer.yaml

File renamed without changes.

deploy/kubernetes-1.18/snapshotter/csi-hostpath-snapshotclass.yaml renamed to deploy/kubernetes-1.18-test/hostpath/csi-hostpath-snapshotclass.yaml

File renamed without changes.

deploy/kubernetes-1.18/hostpath/csi-hostpath-snapshotter.yaml renamed to deploy/kubernetes-1.18-test/hostpath/csi-hostpath-snapshotter.yaml

File renamed without changes.

0 commit comments

Comments
 (0)