From c813339b660d9e798df50d15a3866218368eaa6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=85slund?= Date: Thu, 22 Oct 2026 14:44:51 +0000 Subject: [PATCH 1/2] Pin the TOE Deployment to the k3s server node TOE mounts hostPath /etc/teknoir and signs its MQTT JWT with the device keys in it. On a multi-node Robot the pod could land on a joined agent node, read that node's own keys and be refused by EMQX (reason 135). Add nodeSelector node-role.kubernetes.io/control-plane=true, which k3s sets on server nodes only. Goldens regenerated. Co-Authored-By: Claude Opus 5.5 --- pkg/templates/partials/manifests.yaml.tmpl | 5 +++++ pkg/templates/testdata/docker_server.golden.sh | 5 +++++ pkg/templates/testdata/server.golden.sh | 5 +++++ pkg/templates/testdata/server.roles.golden.sh | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/pkg/templates/partials/manifests.yaml.tmpl b/pkg/templates/partials/manifests.yaml.tmpl index d0eeed9..4c0c0dd 100644 --- a/pkg/templates/partials/manifests.yaml.tmpl +++ b/pkg/templates/partials/manifests.yaml.tmpl @@ -708,6 +708,11 @@ spec: control-plane: controller-manager spec: priorityClassName: high-priority-toe + # TOE mounts the device keys from hostPath /etc/teknoir and signs its MQTT JWT with them, so + # it must run on the k3s server node (the device identity). k3s labels server nodes with + # node-role.kubernetes.io/control-plane=true; joined agent nodes do not carry it. + nodeSelector: + node-role.kubernetes.io/control-plane: "true" containers: - args: - --health-probe-bind-address=:8081 diff --git a/pkg/templates/testdata/docker_server.golden.sh b/pkg/templates/testdata/docker_server.golden.sh index 134d25e..56cc1d3 100644 --- a/pkg/templates/testdata/docker_server.golden.sh +++ b/pkg/templates/testdata/docker_server.golden.sh @@ -856,6 +856,11 @@ spec: control-plane: controller-manager spec: priorityClassName: high-priority-toe + # TOE mounts the device keys from hostPath /etc/teknoir and signs its MQTT JWT with them, so + # it must run on the k3s server node (the device identity). k3s labels server nodes with + # node-role.kubernetes.io/control-plane=true; joined agent nodes do not carry it. + nodeSelector: + node-role.kubernetes.io/control-plane: "true" containers: - args: - --health-probe-bind-address=:8081 diff --git a/pkg/templates/testdata/server.golden.sh b/pkg/templates/testdata/server.golden.sh index 4964287..169a560 100644 --- a/pkg/templates/testdata/server.golden.sh +++ b/pkg/templates/testdata/server.golden.sh @@ -2764,6 +2764,11 @@ spec: control-plane: controller-manager spec: priorityClassName: high-priority-toe + # TOE mounts the device keys from hostPath /etc/teknoir and signs its MQTT JWT with them, so + # it must run on the k3s server node (the device identity). k3s labels server nodes with + # node-role.kubernetes.io/control-plane=true; joined agent nodes do not carry it. + nodeSelector: + node-role.kubernetes.io/control-plane: "true" containers: - args: - --health-probe-bind-address=:8081 diff --git a/pkg/templates/testdata/server.roles.golden.sh b/pkg/templates/testdata/server.roles.golden.sh index 96ad4bf..acf7aeb 100644 --- a/pkg/templates/testdata/server.roles.golden.sh +++ b/pkg/templates/testdata/server.roles.golden.sh @@ -2917,6 +2917,11 @@ spec: control-plane: controller-manager spec: priorityClassName: high-priority-toe + # TOE mounts the device keys from hostPath /etc/teknoir and signs its MQTT JWT with them, so + # it must run on the k3s server node (the device identity). k3s labels server nodes with + # node-role.kubernetes.io/control-plane=true; joined agent nodes do not carry it. + nodeSelector: + node-role.kubernetes.io/control-plane: "true" containers: - args: - --health-probe-bind-address=:8081 From e5b099ec118fdb49cf5d6d7dfe9082b64ead50de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=85slund?= Date: Thu, 22 Oct 2026 15:28:49 +0000 Subject: [PATCH 2/2] TOE manifest: put the nodeSelector comment above priorityClassName The ansible toe-image playbook recognises the pin only when nodeSelector is on the line directly after priorityClassName; the three comment lines between them made it report a conflict. Goldens regenerated. Co-Authored-By: Claude Opus 5.5 --- pkg/templates/partials/manifests.yaml.tmpl | 4 +++- pkg/templates/testdata/docker_server.golden.sh | 4 +++- pkg/templates/testdata/server.golden.sh | 4 +++- pkg/templates/testdata/server.roles.golden.sh | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pkg/templates/partials/manifests.yaml.tmpl b/pkg/templates/partials/manifests.yaml.tmpl index 4c0c0dd..4aa5476 100644 --- a/pkg/templates/partials/manifests.yaml.tmpl +++ b/pkg/templates/partials/manifests.yaml.tmpl @@ -707,10 +707,12 @@ spec: app: toe control-plane: controller-manager spec: - priorityClassName: high-priority-toe # TOE mounts the device keys from hostPath /etc/teknoir and signs its MQTT JWT with them, so # it must run on the k3s server node (the device identity). k3s labels server nodes with # node-role.kubernetes.io/control-plane=true; joined agent nodes do not carry it. + # Keep nodeSelector on the line right after priorityClassName: playbooks/toe-image.yml in the + # ansible repo recognises the pin only there. + priorityClassName: high-priority-toe nodeSelector: node-role.kubernetes.io/control-plane: "true" containers: diff --git a/pkg/templates/testdata/docker_server.golden.sh b/pkg/templates/testdata/docker_server.golden.sh index 56cc1d3..7b5f2e9 100644 --- a/pkg/templates/testdata/docker_server.golden.sh +++ b/pkg/templates/testdata/docker_server.golden.sh @@ -855,10 +855,12 @@ spec: app: toe control-plane: controller-manager spec: - priorityClassName: high-priority-toe # TOE mounts the device keys from hostPath /etc/teknoir and signs its MQTT JWT with them, so # it must run on the k3s server node (the device identity). k3s labels server nodes with # node-role.kubernetes.io/control-plane=true; joined agent nodes do not carry it. + # Keep nodeSelector on the line right after priorityClassName: playbooks/toe-image.yml in the + # ansible repo recognises the pin only there. + priorityClassName: high-priority-toe nodeSelector: node-role.kubernetes.io/control-plane: "true" containers: diff --git a/pkg/templates/testdata/server.golden.sh b/pkg/templates/testdata/server.golden.sh index 169a560..c1a2ed7 100644 --- a/pkg/templates/testdata/server.golden.sh +++ b/pkg/templates/testdata/server.golden.sh @@ -2763,10 +2763,12 @@ spec: app: toe control-plane: controller-manager spec: - priorityClassName: high-priority-toe # TOE mounts the device keys from hostPath /etc/teknoir and signs its MQTT JWT with them, so # it must run on the k3s server node (the device identity). k3s labels server nodes with # node-role.kubernetes.io/control-plane=true; joined agent nodes do not carry it. + # Keep nodeSelector on the line right after priorityClassName: playbooks/toe-image.yml in the + # ansible repo recognises the pin only there. + priorityClassName: high-priority-toe nodeSelector: node-role.kubernetes.io/control-plane: "true" containers: diff --git a/pkg/templates/testdata/server.roles.golden.sh b/pkg/templates/testdata/server.roles.golden.sh index acf7aeb..076a8ec 100644 --- a/pkg/templates/testdata/server.roles.golden.sh +++ b/pkg/templates/testdata/server.roles.golden.sh @@ -2916,10 +2916,12 @@ spec: app: toe control-plane: controller-manager spec: - priorityClassName: high-priority-toe # TOE mounts the device keys from hostPath /etc/teknoir and signs its MQTT JWT with them, so # it must run on the k3s server node (the device identity). k3s labels server nodes with # node-role.kubernetes.io/control-plane=true; joined agent nodes do not carry it. + # Keep nodeSelector on the line right after priorityClassName: playbooks/toe-image.yml in the + # ansible repo recognises the pin only there. + priorityClassName: high-priority-toe nodeSelector: node-role.kubernetes.io/control-plane: "true" containers: