Skip to content

Commit

Permalink
brightbox: Align K8s systemd-sysext usage with CAPO
Browse files Browse the repository at this point in the history
When the condition fails we don't want to propagate this to the unit in
the post update action.
Sync this with the files from CAPO which also prevents major updates.
  • Loading branch information
pothos committed Apr 29, 2024
1 parent c98e1c9 commit 22f6741
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions brightbox/compute.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ data "ct_config" "config-control-plane" {
strict = true
content = templatefile("${path.module}/server-configs/control-plane.yaml.tmpl", {
kubernetes_version = var.kubernetes_version
kubernetes_minor = join(" ", [split(".", var.kubernetes_version)[0], split(".", var.kubernetes_version)[1]])
})
snippets = [
data.template_file.core_user.rendered
Expand All @@ -38,6 +39,7 @@ data "ct_config" "config-worker" {
strict = true
content = templatefile("${path.module}/server-configs/worker.yaml.tmpl", {
kubernetes_version = var.kubernetes_version
kubernetes_minor = join(" ", [split(".", var.kubernetes_version)[0], split(".", var.kubernetes_version)[1]])
control_plane_ip = brightbox_cloudip.control-plane.public_ipv4
})
}
Expand Down
9 changes: 6 additions & 3 deletions brightbox/server-configs/control-plane.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ storage:
path: /etc/extensions/kubernetes.raw
hard: false
files:
- path: /etc/sysupdate.kubernetes.d/kubernetes.conf
- path: /etc/sysupdate.kubernetes.d/kubernetes-${kubernetes_minor}.conf
contents:
source: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes.conf
source: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes-${kubernetes_minor}.conf
- path: /etc/sysupdate.d/noop.conf
contents:
source: https://github.com/flatcar/sysext-bakery/releases/download/latest/noop.conf
Expand All @@ -28,7 +28,10 @@ systemd:
ExecStartPre=/usr/bin/sh -c "readlink --canonicalize /etc/extensions/kubernetes.raw > /tmp/kubernetes"
ExecStartPre=/usr/lib/systemd/systemd-sysupdate -C kubernetes update
ExecStartPost=/usr/bin/sh -c "readlink --canonicalize /etc/extensions/kubernetes.raw > /tmp/kubernetes-new"
ExecStartPost=/usr/bin/sh -c "[[ $(cat /tmp/kubernetes) != $(cat /tmp/kubernetes-new) ]] && touch /run/reboot-required"
ExecStartPost=/usr/bin/sh -c "if ! cmp --silent /tmp/kubernetes /tmp/kubernetes-new; then touch /run/reboot-required; fi"
- name: locksmithd.service
# NOTE: To coordinate the node reboot in this context, we recommend to use Kured.
mask: true
- name: kubeadm.service
enabled: true
contents: |
Expand Down
9 changes: 6 additions & 3 deletions brightbox/server-configs/worker.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ storage:
path: /etc/extensions/kubernetes.raw
hard: false
files:
- path: /etc/sysupdate.kubernetes.d/kubernetes.conf
- path: /etc/sysupdate.kubernetes.d/kubernetes-${kubernetes_minor}.conf
contents:
source: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes.conf
source: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes-${kubernetes_minor}.conf
- path: /etc/sysupdate.d/noop.conf
contents:
source: https://github.com/flatcar/sysext-bakery/releases/download/latest/noop.conf
Expand All @@ -28,7 +28,10 @@ systemd:
ExecStartPre=/usr/bin/sh -c "readlink --canonicalize /etc/extensions/kubernetes.raw > /tmp/kubernetes"
ExecStartPre=/usr/lib/systemd/systemd-sysupdate -C kubernetes update
ExecStartPost=/usr/bin/sh -c "readlink --canonicalize /etc/extensions/kubernetes.raw > /tmp/kubernetes-new"
ExecStartPost=/usr/bin/sh -c "[[ $(cat /tmp/kubernetes) != $(cat /tmp/kubernetes-new) ]] && touch /run/reboot-required"
ExecStartPost=/usr/bin/sh -c "if ! cmp --silent /tmp/kubernetes /tmp/kubernetes-new; then touch /run/reboot-required; fi"
- name: locksmithd.service
# NOTE: To coordinate the node reboot in this context, we recommend to use Kured.
mask: true
- name: kubeadm.service
enabled: true
contents: |
Expand Down

0 comments on commit 22f6741

Please # to comment.