feat: allow WASI workloads

This commit is contained in:
Peter 2024-11-07 22:15:35 +01:00
parent e9afbb2f9f
commit f234b8fcab
Signed by: prskr
GPG key ID: F56BED6903BC5E37
4 changed files with 55 additions and 12 deletions

View file

@ -3,13 +3,40 @@ version: 1.1.0
systemd:
units:
- name: containerd.service
enabled: false
dropins:
- name: 10-use-custom-config.conf
contents: |
[Service]
ExecStart=
ExecStart=/usr/bin/containerd
- name: spin-shim-install.service
enabled: true
contents: |
[Unit]
Description=Run Spin Shim script
Wants = network-online.target
After = network.target network-online.target
StartLimitBurst=100
StartLimitIntervalSec=300
ConditionPathExists=!/var/lib/rancher/k3s/data/current/bin/containerd-shim-spin-v2
[Service]
Type=oneshot
TimeoutStartSec=300
RemainAfterExit=yes
KillMode=process
ExecStart=/usr/bin/bash -c "until [ -d /var/lib/rancher/k3s/data/current/bin ]; do sleep 5; done; curl -L https://github.com/spinkube/containerd-shim-spin/releases/download/${spin_shim_version}/containerd-shim-spin-v2-linux-${arch}.tar.gz | tar -xz -C /var/lib/rancher/k3s/data/current/bin/"
[Install]
WantedBy=multi-user.target
- name: k3s-install.service
enabled: true
contents: |
[Unit]
Description=Run K3s script
Wants = network-online.target
After = network.target network-online.target
After = network.target network-online.target
ConditionPathExists=/opt/k3s-install.sh
ConditionPathExists=!/opt/bin/k3s
[Service]
@ -34,4 +61,13 @@ storage:
- path: /opt/k3s-install.sh
mode: 0777
contents:
source: https://get.k3s.io
source: https://get.k3s.io
- path: /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl
mode: 0644
contents:
inline: |
{{- template "base" . }}
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin]
runtime_type = "io.containerd.spin.v2"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin.options]
BinaryName = "/opt/bin/containerd-shim-spin-v2"

View file

@ -146,11 +146,13 @@ data "ct_config" "machine-ignitions" {
content = templatefile(
"${path.module}/configs/workers/k3s-flatcar.yaml",
{
"host" = "${each.key}"
"k3s_token" = "${var.k3s_token}"
"node_ip" = "${each.value.private_ip}"
"k3s_version" = "${var.worker_k3s_version}"
"host" = each.key
"k3s_token" = var.k3s_token
"node_ip" = each.value.private_ip
"k3s_version" = var.worker_k3s_version
"storage_node" = each.value.storage_node
"spin_shim_version" = var.spin_shim_version
"arch" = startswith(each.value.server_type, "cax") ? "aarch64" : "x86_64"
}
)
snippets = [

View file

@ -37,6 +37,11 @@ variable "litestream_version" {
default = "v0.3.13"
}
variable "spin_shim_version" {
type = string
default = "v0.16.0"
}
variable "control_plane_k3s_version" {
type = string
default = "v1.30.5+k3s1"

View file

@ -17,7 +17,7 @@ k3s_sans = [
k3s_workers = {
"w1-cx22-hel1" = {
server_type = "cx22"
generation = 1
generation = 10
private_ip = "172.23.2.20"
location = "hel1"
storage_node = false
@ -25,7 +25,7 @@ k3s_workers = {
"w2-cax11-hel1" = {
server_type = "cax11"
generation = 1
generation = 10
private_ip = "172.23.2.21"
location = "hel1"
storage_node = true
@ -33,7 +33,7 @@ k3s_workers = {
"w3-cax11-hel1" = {
server_type = "cax11"
generation = 1
generation = 6
private_ip = "172.23.2.22"
location = "hel1"
storage_node = true
@ -41,7 +41,7 @@ k3s_workers = {
"w4-cax11-hel1" = {
server_type = "cax11"
generation = 1
generation = 3
private_ip = "172.23.2.23"
location = "hel1"
storage_node = true
@ -49,7 +49,7 @@ k3s_workers = {
"w5-cax11-hel1" = {
server_type = "cax11"
generation = 1
generation = 3
private_ip = "172.23.2.24"
location = "hel1"
storage_node = true
@ -57,7 +57,7 @@ k3s_workers = {
"w6-cax11-hel1" = {
server_type = "cax11"
generation = 1
generation = 4
private_ip = "172.23.2.25"
location = "hel1"
storage_node = true