You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check on ipsec.service instead of libreswan package on host
The rpm db directory is different on rhcos and rhel workers, so mounting
/usr/share/rpm directory will not work for rhel worker nodes. To avoid
this, this commit checks on ipsec systemd service on the host to decide
which ipsec deployment to be active or dormant.
Signed-off-by: Periyasamy Palanisamy <[email protected]>
Copy file name to clipboardExpand all lines: bindata/network/ovn-kubernetes/common/ipsec-containerized.yaml
+12-19Lines changed: 12 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,9 @@ spec:
37
37
- key: network.operator.openshift.io/dpu-host
38
38
operator: DoesNotExist
39
39
serviceAccountName: ovn-kubernetes-node
40
+
{{ if .IPsecServiceCheckOnHost }}
41
+
hostPID: true
42
+
{{ end }}
40
43
hostNetwork: true
41
44
dnsPolicy: Default
42
45
priorityClassName: "system-node-critical"
@@ -50,9 +53,9 @@ spec:
50
53
#!/bin/bash
51
54
set -exuo pipefail
52
55
53
-
{{ if .IPsecCheckForLibreswan }}
54
-
if rpm --dbpath=/usr/share/rpm -q libreswan; then
55
-
echo "host has libreswan and therefore ipsec will be configured by ipsec host daemonset, this ovn ipsec container doesnt need to init anything"
56
+
{{ if .IPsecServiceCheckOnHost }}
57
+
if chroot /proc/1/root systemctl is-active --quiet ipsec.service; then
58
+
echo "host has ipsec.service running and therefore ipsec will be configured by ipsec host daemonset, this ovn ipsec container doesnt need to init anything"
56
59
exit 0
57
60
fi
58
61
{{ end }}
@@ -197,9 +200,6 @@ spec:
197
200
name: signer-ca
198
201
- mountPath: /etc/openvswitch
199
202
name: etc-openvswitch
200
-
- mountPath: /usr/share/rpm
201
-
name: host-usr-share-rpm
202
-
readOnly: true
203
203
resources:
204
204
requests:
205
205
cpu: 10m
@@ -231,9 +231,9 @@ spec:
231
231
}
232
232
trap cleanup SIGTERM
233
233
234
-
{{ if .IPsecCheckForLibreswan }}
235
-
if rpm --dbpath=/usr/share/rpm -q libreswan; then
236
-
echo "host has libreswan and therefore ipsec will be configured by ipsec host daemonset, this ovn ipsec container will sleep to infinity"
234
+
{{ if .IPsecServiceCheckOnHost }}
235
+
if chroot /proc/1/root systemctl is-active --quiet ipsec.service; then
236
+
echo "host has ipsec.service running and therefore ipsec will be configured by ipsec host daemonset, this ovn ipsec container will sleep to infinity"
237
237
sleep infinity
238
238
fi
239
239
{{ end }}
@@ -294,9 +294,6 @@ spec:
294
294
name: host-var-log-ovs
295
295
- mountPath: /etc/openvswitch
296
296
name: etc-openvswitch
297
-
- mountPath: /usr/share/rpm
298
-
name: host-usr-share-rpm
299
-
readOnly: true
300
297
resources:
301
298
requests:
302
299
cpu: 10m
@@ -309,9 +306,9 @@ spec:
309
306
- -c
310
307
- |
311
308
#!/bin/bash
312
-
{{ if .IPsecCheckForLibreswan }}
313
-
if rpm --dbpath=/usr/share/rpm -q libreswan; then
314
-
echo "host has libreswan and therefore ipsec will be configured by ipsec host daemonset, this ovn ipsec container is always \"alive\""
309
+
{{ if .IPsecServiceCheckOnHost }}
310
+
if chroot /proc/1/root systemctl is-active --quiet ipsec.service; then
311
+
echo "host has ipsec.service running and therefore ipsec will be configured by ipsec host daemonset, this ovn ipsec container is always \"alive\""
Copy file name to clipboardExpand all lines: bindata/network/ovn-kubernetes/common/ipsec-host.yaml
+12-22Lines changed: 12 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -50,9 +50,9 @@ spec:
50
50
- |
51
51
#!/bin/bash
52
52
set -exuo pipefail
53
-
{{ if .IPsecCheckForLibreswan }}
54
-
if ! rpm --dbpath=/usr/share/rpm -q libreswan; then
55
-
echo "host doesnt have libreswan, therefore ipsec will be configured by ipsec-containerized daemonset, this ovn ipsec container has nothing to init"
53
+
{{ if .IPsecServiceCheckOnHost }}
54
+
if ! chroot /proc/1/root systemctl is-active --quiet ipsec.service; then
55
+
echo "host doesn't have ipsec.service running, therefore ipsec will be configured by ipsec-containerized daemonset, this ovn ipsec container has nothing to init"
56
56
exit 0
57
57
fi
58
58
{{ end }}
@@ -200,9 +200,6 @@ spec:
200
200
name: etc-openvswitch
201
201
- mountPath: /etc
202
202
name: host-etc
203
-
- mountPath: /usr/share/rpm
204
-
name: host-usr-share-rpm
205
-
readOnly: true
206
203
resources:
207
204
requests:
208
205
cpu: 10m
@@ -219,9 +216,9 @@ spec:
219
216
#!/bin/bash
220
217
set -exuo pipefail
221
218
222
-
{{ if .IPsecCheckForLibreswan }}
223
-
if ! rpm --dbpath=/usr/share/rpm -q libreswan; then
224
-
echo "host doesnt have libreswan, therefore ipsec will be configured by ipsec-containerized daemonset, this ovn ipsec container will sleep to infinity"
219
+
{{ if .IPsecServiceCheckOnHost }}
220
+
if ! chroot /proc/1/root systemctl is-active --quiet ipsec.service; then
221
+
echo "host doesn't have ipsec.service running, therefore ipsec will be configured by ipsec-containerized daemonset, this ovn ipsec container will sleep to infinity"
225
222
sleep infinity
226
223
fi
227
224
{{ end }}
@@ -301,9 +298,9 @@ spec:
301
298
# In order to maintain traffic flows during container restart, we
302
299
# need to ensure that xfrm state and policies are not flushed.
303
300
304
-
{{ if .IPsecCheckForLibreswan }}
305
-
if ! rpm --dbpath=/usr/share/rpm -q libreswan; then
306
-
echo "host doesnt have libreswan, therefore ipsec will be configured by ipsec-containerized daemonset, preStop wont do anything"
301
+
{{ if .IPsecServiceCheckOnHost }}
302
+
if ! chroot /proc/1/root systemctl is-active --quiet ipsec.service; then
303
+
echo "host doesn't have ipsec.service running, therefore ipsec will be configured by ipsec-containerized daemonset, preStop wont do anything"
307
304
exit 0
308
305
fi
309
306
{{ end }}
@@ -335,9 +332,6 @@ spec:
335
332
name: usr-sbin
336
333
- mountPath: /usr/libexec
337
334
name: usr-libexec
338
-
- mountPath: /usr/share/rpm
339
-
name: host-usr-share-rpm
340
-
readOnly: true
341
335
resources:
342
336
requests:
343
337
cpu: 10m
@@ -350,9 +344,9 @@ spec:
350
344
- -c
351
345
- |
352
346
#!/bin/bash
353
-
{{ if .IPsecCheckForLibreswan }}
354
-
if ! rpm --dbpath=/usr/share/rpm -q libreswan; then
355
-
echo "host doesnt have libreswan, therefore ipsec will be configured by ipsec-containerized daemonset, this ovn ipsec container is always \"alive\""
347
+
{{ if .IPsecServiceCheckOnHost }}
348
+
if ! chroot /proc/1/root systemctl is-active --quiet ipsec.service; then
349
+
echo "host doesn't have ipsec.service running, therefore ipsec will be configured by ipsec-containerized daemonset, this ovn ipsec container is always \"alive\""
0 commit comments