Skip to content

Commit a922427

Browse files
committed
change the deploy file to fit external-health-monitor
1 parent e0618e1 commit a922427

File tree

4 files changed

+188
-2
lines changed

4 files changed

+188
-2
lines changed

deploy/kubernetes-1.17/hostpath/csi-hostpath-plugin.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ spec:
3434
labels:
3535
app: csi-hostpathplugin
3636
spec:
37+
serviceAccount: csi-external-health-monitor-controller
3738
containers:
3839
- name: node-driver-registrar
3940
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.0.1
@@ -59,7 +60,19 @@ spec:
5960
name: registration-dir
6061
- mountPath: /csi-data-dir
6162
name: csi-data-dir
62-
63+
- name: csi-external-health-monitor-controller
64+
image: k8s.gcr.io/sig-storage/csi-external-health-monitor-controller:v0.1.0
65+
args:
66+
- "--v=5"
67+
- "--csi-address=$(ADDRESS)"
68+
- "--leader-election"
69+
env:
70+
- name: ADDRESS
71+
value: /csi/csi.sock
72+
imagePullPolicy: "IfNotPresent"
73+
volumeMounts:
74+
- name: socket-dir
75+
mountPath: /csi
6376
- name: hostpath
6477
image: k8s.gcr.io/sig-storage/hostpathplugin:v1.4.0
6578
args:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
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+
serviceAccount: csi-external-health-monitor-controller
38+
containers:
39+
- name: node-driver-registrar
40+
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.0.1
41+
args:
42+
- --v=5
43+
- --csi-address=/csi/csi.sock
44+
- --kubelet-registration-path=/var/lib/kubelet/plugins/csi-hostpath/csi.sock
45+
securityContext:
46+
# This is necessary only for systems with SELinux, where
47+
# non-privileged sidecar containers cannot access unix domain socket
48+
# created by privileged CSI driver container.
49+
privileged: true
50+
env:
51+
- name: KUBE_NODE_NAME
52+
valueFrom:
53+
fieldRef:
54+
apiVersion: v1
55+
fieldPath: spec.nodeName
56+
volumeMounts:
57+
- mountPath: /csi
58+
name: socket-dir
59+
- mountPath: /registration
60+
name: registration-dir
61+
- mountPath: /csi-data-dir
62+
name: csi-data-dir
63+
64+
- name: csi-external-health-monitor-agent
65+
image: k8s.gcr.io/sig-storage/csi-external-health-monitor-agent:v0.1.0
66+
args:
67+
- "--v=5"
68+
- "--csi-address=$(ADDRESS)"
69+
env:
70+
- name: NODE_NAME
71+
valueFrom:
72+
fieldRef:
73+
fieldPath: spec.nodeName
74+
- name: ADDRESS
75+
value: /csi/csi.sock
76+
imagePullPolicy: "IfNotPresent"
77+
volumeMounts:
78+
- name: socket-dir
79+
mountPath: /csi
80+
- name: csi-external-health-monitor-controller
81+
image: k8s.gcr.io/sig-storage/csi-external-health-monitor-controller:v0.1.0
82+
args:
83+
- "--v=5"
84+
- "--csi-address=$(ADDRESS)"
85+
- "--leader-election"
86+
- "--list-volumes-interval=1m"
87+
env:
88+
- name: ADDRESS
89+
value: /csi/csi.sock
90+
imagePullPolicy: "IfNotPresent"
91+
volumeMounts:
92+
- name: socket-dir
93+
mountPath: /csi
94+
- name: hostpath
95+
image: k8s.gcr.io/sig-storage/hostpathplugin:v1.4.0
96+
args:
97+
- "--drivername=hostpath.csi.k8s.io"
98+
- "--v=5"
99+
- "--endpoint=$(CSI_ENDPOINT)"
100+
- "--nodeid=$(KUBE_NODE_NAME)"
101+
env:
102+
- name: CSI_ENDPOINT
103+
value: unix:///csi/csi.sock
104+
- name: KUBE_NODE_NAME
105+
valueFrom:
106+
fieldRef:
107+
apiVersion: v1
108+
fieldPath: spec.nodeName
109+
securityContext:
110+
privileged: true
111+
ports:
112+
- containerPort: 9898
113+
name: healthz
114+
protocol: TCP
115+
livenessProbe:
116+
failureThreshold: 5
117+
httpGet:
118+
path: /healthz
119+
port: healthz
120+
initialDelaySeconds: 10
121+
timeoutSeconds: 3
122+
periodSeconds: 2
123+
volumeMounts:
124+
- mountPath: /csi
125+
name: socket-dir
126+
- mountPath: /var/lib/kubelet/pods
127+
mountPropagation: Bidirectional
128+
name: mountpoint-dir
129+
- mountPath: /var/lib/kubelet/plugins
130+
mountPropagation: Bidirectional
131+
name: plugins-dir
132+
- mountPath: /csi-data-dir
133+
name: csi-data-dir
134+
- mountPath: /dev
135+
name: dev-dir
136+
- name: liveness-probe
137+
volumeMounts:
138+
- mountPath: /csi
139+
name: socket-dir
140+
image: k8s.gcr.io/sig-storage/livenessprobe:v2.1.0
141+
args:
142+
- --csi-address=/csi/csi.sock
143+
- --health-port=9898
144+
145+
volumes:
146+
- hostPath:
147+
path: /var/lib/kubelet/plugins/csi-hostpath
148+
type: DirectoryOrCreate
149+
name: socket-dir
150+
- hostPath:
151+
path: /var/lib/kubelet/pods
152+
type: DirectoryOrCreate
153+
name: mountpoint-dir
154+
- hostPath:
155+
path: /var/lib/kubelet/plugins_registry
156+
type: Directory
157+
name: registration-dir
158+
- hostPath:
159+
path: /var/lib/kubelet/plugins
160+
type: Directory
161+
name: plugins-dir
162+
- hostPath:
163+
# 'path' is where PV data is persisted on host.
164+
# using /tmp is also possible while the PVs will not available after plugin container recreation or host reboot
165+
path: /var/lib/csi-hostpath-data/
166+
type: DirectoryOrCreate
167+
name: csi-data-dir
168+
- hostPath:
169+
path: /dev
170+
type: Directory
171+
name: dev-dir
File renamed without changes.

deploy/util/deploy-hostpath.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ if version_gt $(rbac_version "${BASE_DIR}/hostpath/csi-hostpath-snapshotter.yaml
116116
SNAPSHOTTER_RBAC_RELATIVE_PATH="csi-snapshotter/rbac-csi-snapshotter.yaml"
117117
fi
118118

119+
CSI_EXTERNAL_HEALTH_MONITOR_RBAC_YAML="https://raw.githubusercontent.com/kubernetes-csi/external-health-monitor/$(rbac_version "${BASE_DIR}/hostpath/csi-hostpath-plugin.yaml" csi-external-health-monitor-controller false)/deploy/kubernetes/external-health-monitor-controller/rbac.yaml"
120+
: ${CSI_EXTERNAL_HEALTH_MONITOR_RBAC:=https://raw.githubusercontent.com/kubernetes-csi/external-health-monitor/$(rbac_version "${BASE_DIR}/hostpath/csi-hostpath-plugin.yaml" csi-external-health-monitor-controller "${UPDATE_RBAC_RULES}")/deploy/kubernetes/external-health-monitor-controller/rbac.yaml}
119121
CSI_PROVISIONER_RBAC_YAML="https://raw.githubusercontent.com/kubernetes-csi/external-provisioner/$(rbac_version "${BASE_DIR}/hostpath/csi-hostpath-provisioner.yaml" csi-provisioner false)/deploy/kubernetes/rbac.yaml"
120122
: ${CSI_PROVISIONER_RBAC:=https://raw.githubusercontent.com/kubernetes-csi/external-provisioner/$(rbac_version "${BASE_DIR}/hostpath/csi-hostpath-provisioner.yaml" csi-provisioner "${UPDATE_RBAC_RULES}")/deploy/kubernetes/rbac.yaml}
121123
CSI_ATTACHER_RBAC_YAML="https://raw.githubusercontent.com/kubernetes-csi/external-attacher/$(rbac_version "${BASE_DIR}/hostpath/csi-hostpath-attacher.yaml" csi-attacher false)/deploy/kubernetes/rbac.yaml"
@@ -140,7 +142,7 @@ run () {
140142

141143
# rbac rules
142144
echo "applying RBAC rules"
143-
for component in CSI_PROVISIONER CSI_ATTACHER CSI_SNAPSHOTTER CSI_RESIZER; do
145+
for component in CSI_PROVISIONER CSI_ATTACHER CSI_SNAPSHOTTER CSI_RESIZER CSI_EXTERNAL_HEALTH_MONITOR; do
144146
eval current="\${${component}_RBAC}"
145147
eval original="\${${component}_RBAC_YAML}"
146148
if [ "$current" != "$original" ]; then

0 commit comments

Comments
 (0)