Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

brightbox: Align K8s systemd-sysext usage with CAPO #25

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion brightbox/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ variable "release_channel" {

validation {
condition = contains(["lts", "stable", "beta", "alpha"], var.release_channel)
error_message = "release_channel must be lts, stable, beta, or alpha."
error_message = "The variable 'release_channel' must be lts, stable, beta, or alpha."
}
}

Expand Down