Skip to content

Commit

Permalink
add custom pre/post startup nodeinit script
Browse files Browse the repository at this point in the history
Allows customization of nodeinit scripts to adapt node configuration before cilium is starting to allow eg. systemd configuration changes and reload of networkd.
This customization also allows a possibility to add hotfixes if node VMs needs fixed due to updates.

Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>
  • Loading branch information
mblaschke authored and julianwiedmann committed Mar 27, 2023
1 parent dd0a8f5 commit 07191bf
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Documentation/helm-values.rst

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Documentation/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,7 @@ prepend
prepended
prepulls
prerequirement
prestop
printf
priori
priorityClassName
Expand Down
2 changes: 2 additions & 0 deletions install/kubernetes/cilium/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions install/kubernetes/cilium/files/nodeinit/prestop.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -o errexit
set -o pipefail
set -o nounset

{{ .Values.nodeinit.prestop.preScript }}

if stat /tmp/node-deinit.cilium.io > /dev/null 2>&1; then
exit 0
fi
Expand Down Expand Up @@ -53,4 +55,6 @@ if iptables -w -t nat -L IP-MASQ > /dev/null; then
fi
{{- end }}

{{ .Values.nodeinit.prestop.postScript }}

echo "Node de-initialization complete"
5 changes: 5 additions & 0 deletions install/kubernetes/cilium/files/nodeinit/startup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ echo "Addressing:"
ip -4 a
ip -6 a

{{ .Values.nodeinit.startup.preScript }}

{{- if .Values.nodeinit.removeCbrBridge }}
if ip link show cbr0; then
echo "Detected cbr0 bridge. Deleting interface..."
Expand Down Expand Up @@ -199,4 +201,7 @@ fi
{{- if .Values.nodeinit.revertReconfigureKubelet }}
rm -f /tmp/node-deinit.cilium.io
{{- end }}

{{ .Values.nodeinit.startup.postScript }}

echo "Node initialization complete"
9 changes: 9 additions & 0 deletions install/kubernetes/cilium/values.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions install/kubernetes/cilium/values.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2176,6 +2176,15 @@ nodeinit:
# -- bootstrapFile is the location of the file where the bootstrap timestamp is
# written by the node-init DaemonSet
bootstrapFile: "/tmp/cilium-bootstrap.d/cilium-bootstrap-time"

# -- startup offers way to customize startup nodeinit script (pre and post position)
startup:
preScript: ""
postScript: ""
# -- prestop offers way to customize prestop nodeinit script (pre and post position)
prestop:
preScript: ""
postScript: ""

preflight:
# -- Enable Cilium pre-flight resources (required for upgrade)
Expand Down

0 comments on commit 07191bf

Please sign in to comment.