From f96db79ea580e0230387210c0638b54ccdda2890 Mon Sep 17 00:00:00 2001 From: Brett Chien Date: Thu, 27 Aug 2026 21:42:14 +0800 Subject: [PATCH] feat(console): wire list_service_accounts into New Fleet's k8s field group (studio#104) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fifth sub-item of #104, stacked on #108. Service account (optional) becomes a + ) a plain select with no free-text escape hatch is the right shape here, matching context's treatment. Reload triggers: context change (cascades into namespace + service-account reload) and namespace field's "change" event (fires on blur/commit, not per keystroke — avoids a tool call per character typed). Per #104's design this tool's failures are deliberately silent — unlike list_k8s_contexts/list_namespaces (which show a status message on failure), any error here, including an RBAC-denied list (common against a scoped-down cluster identity), just falls back to the "namespace default" option with no status shown. The field is optional and the whole point of default-SA fallback is that it's fine not to have a definitive answer here. Verified locally: npm run typecheck clean, npm test 102/102, npm run build succeeds. Ref: studio#104. --- console/index.html | 4 +++- console/src/deploy.ts | 45 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/console/index.html b/console/index.html index ca357aa..6329d00 100644 --- a/console/index.html +++ b/console/index.html @@ -124,7 +124,9 @@
diff --git a/console/src/deploy.ts b/console/src/deploy.ts index e190f3b..5f3dc0d 100644 --- a/console/src/deploy.ts +++ b/console/src/deploy.ts @@ -46,6 +46,9 @@ interface K8sContextsResponse { interface K8sNamespacesResponse { namespaces: string[]; } +interface K8sServiceAccountsResponse { + service_accounts: string[]; +} export type DeployMode = { kind: "new-fleet" } | { kind: "add-instance"; fleetName: string }; @@ -97,6 +100,10 @@ export function initDeployPanel(deps: DeployPanelDeps): DeployPanelHandle | null // choice and a plain select can't express "not in this list yet". const k8sNamespaceInput = document.getElementById("deploy-k8s-namespace") as HTMLInputElement | null; const k8sNamespaceOptions = document.getElementById("deploy-k8s-namespace-options") as HTMLDataListElement | null; + // Service account, unlike namespace, must already exist for k8s to accept + // it as a pod's serviceAccountName — so (unlike namespace) a plain