From 7cbba4cdf8bb7d2e49c2686a34790663b0ce5467 Mon Sep 17 00:00:00 2001 From: Joffrey Date: Wed, 25 Nov 2026 14:55:14 +0100 Subject: [PATCH] feat(helm): support atelet service account metadata Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/helm-verify.yaml | 2 +- charts/substrate-atelet/README.md | 6 +++ charts/substrate-atelet/templates/atelet.yaml | 8 +++ .../tests/service_account_test.yaml | 53 +++++++++++++++++++ charts/substrate-atelet/values.yaml | 3 ++ 5 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 charts/substrate-atelet/tests/service_account_test.yaml diff --git a/.github/workflows/helm-verify.yaml b/.github/workflows/helm-verify.yaml index 9c9a16d92d..54591d97fa 100644 --- a/.github/workflows/helm-verify.yaml +++ b/.github/workflows/helm-verify.yaml @@ -36,4 +36,4 @@ jobs: - name: Install helm-unittest run: .github/scripts/helm-verify/install-helm-unittest.sh - name: Run the chart unit tests - run: helm unittest charts/substrate + run: helm unittest charts/substrate charts/substrate-atelet diff --git a/charts/substrate-atelet/README.md b/charts/substrate-atelet/README.md index 4f756e6b0b..1b69bc3193 100644 --- a/charts/substrate-atelet/README.md +++ b/charts/substrate-atelet/README.md @@ -55,6 +55,12 @@ Object storage is set under `objectStore` instead of `rustfs` and | `objectStore.pathStyle` | `false` | Address buckets by path rather than by virtual host | | `objectStore.credentialsSecret` | `""` | Secret with `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` keys. Empty uses the SDK's default credential chain | +Set `atelet.serviceAccount.annotations` and `atelet.serviceAccount.labels` to +add metadata to the chart-managed ServiceAccount, for example to configure +workload identity for the node object-store plugin. Restart existing atelet +pods after changing an identity annotation so the identity provider can inject +credentials into newly created pods. + Set `substrateReleaseName` to the substrate release's name. It defaults to `substrate`. atelet's objects take their names from it, because the substrate release grants permissions to the atelet ServiceAccount by name. atelet also diff --git a/charts/substrate-atelet/templates/atelet.yaml b/charts/substrate-atelet/templates/atelet.yaml index c8374bbf94..3a3c44977f 100644 --- a/charts/substrate-atelet/templates/atelet.yaml +++ b/charts/substrate-atelet/templates/atelet.yaml @@ -28,6 +28,14 @@ kind: ServiceAccount metadata: name: {{ include "substrate.fullname" (list "atelet" .) }} namespace: {{ .Release.Namespace }} + {{- with .Values.atelet.serviceAccount.labels }} + labels: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.atelet.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} {{- if .Values.atelet.imageCredentialProviderConfigYAML }} --- apiVersion: v1 diff --git a/charts/substrate-atelet/tests/service_account_test.yaml b/charts/substrate-atelet/tests/service_account_test.yaml new file mode 100644 index 0000000000..7fc65631d8 --- /dev/null +++ b/charts/substrate-atelet/tests/service_account_test.yaml @@ -0,0 +1,53 @@ +# Copyright 2026 The Agent Substrate Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +suite: Atelet ServiceAccount metadata +templates: +- atelet.yaml +release: + name: node-agent + namespace: ate-system +tests: +- it: leaves metadata unchanged by default + documentSelector: + path: kind + value: ServiceAccount + asserts: + - notExists: + path: metadata.annotations + - notExists: + path: metadata.labels +- it: adds configured metadata to the existing ServiceAccount + set: + substrateReleaseName: custom + atelet.serviceAccount.labels: + team: agents + atelet.serviceAccount.annotations: + example.com/workload-identity: enabled + documentSelector: + path: kind + value: ServiceAccount + asserts: + - equal: + path: metadata.name + value: custom-atelet + - equal: + path: metadata.namespace + value: ate-system + - equal: + path: metadata.labels.team + value: agents + - equal: + path: metadata.annotations["example.com/workload-identity"] + value: enabled diff --git a/charts/substrate-atelet/values.yaml b/charts/substrate-atelet/values.yaml index b68515745e..8aa8ec1dac 100644 --- a/charts/substrate-atelet/values.yaml +++ b/charts/substrate-atelet/values.yaml @@ -46,6 +46,9 @@ objectStore: # extraArgs / extraEnv are appended verbatim for installer-specific knobs # (e.g. registry replacement for kind). atelet: + serviceAccount: + labels: {} + annotations: {} # Host paths for the node's kubelet credential provider. Set both to enable # private registry authentication (GKE: /etc/srv/kubernetes/cri_auth_config.yaml # and /home/kubernetes/bin). Leave empty on nodes without a provider, like Kind.