Skip to content

fix(k8s): slugify agent/namespace names into valid k8s object names (studio#138 follow-up) - #141

Merged
brettchien merged 1 commit into
mainfrom
fix/k8s-slugify-agent-and-namespace-names
Aug 30, 2026
Merged

fix(k8s): slugify agent/namespace names into valid k8s object names (studio#138 follow-up)#141
brettchien merged 1 commit into
mainfrom
fix/k8s-slugify-agent-and-namespace-names

Conversation

@brettchien

Copy link
Copy Markdown
Contributor

Summary

Brett hit ConfigMap "Persephone-config" is invalid ... must be a lowercase RFC 1123 subdomain — the Agent name field's "suggest a Greek god name" default (#128) capitalizes the first letter, and nothing downstream lowercased it before using it in a k8s object name.

Change

  • New oabctl::k8s_safe_name (re-exported at crate root): lowercases, maps anything outside [a-z0-9-] to -, trims leading/trailing -.
  • k8s_deployment_name slugifies internally — every Deployment name is safe by construction now.
  • provision_acp_auth_k8s_secret / provision_config_k8s_configmap (studio-cp) slugify the agent name before building their Secret/ConfigMap names.
  • provision_agent_k8s / provision_from_library_k8s: the free-typed "+ Create new namespace…" field has the exact same risk, so namespace is normalized once up front and shadowed for the rest of the function — ensure_namespace_k8s (fix(k8s): auto-create target namespace if it doesn't exist (studio#138 follow-up) #140) and every object placed into that namespace now agree on the same slugified value.

Test plan

  • Added k8s_safe_name unit tests + a regression test reproducing the exact "Persephone" case
  • Could not compile locally (sandbox OOMs on aws-sdk-ec2) — CI (build-test) is the real gate
  • Brett to confirm in a live k8s deploy with the Greek-god-name default

🤖 Generated with Claude Code

…studio#138 follow-up)

Brett hit "ConfigMap \"Persephone-config\" is invalid ... must be a lowercase
RFC 1123 subdomain" — the Agent name field's "suggest a Greek god name"
default (studio#128) capitalizes the first letter, and nothing downstream
lowercased it before using it to build k8s object names.

## Change

- New `oabctl::k8s_safe_name` (in k8s_driver.rs, re-exported at crate root):
  lowercases and maps any character outside `[a-z0-9-]` to `-`, then trims
  leading/trailing `-` so the result still starts/ends alphanumeric per the
  RFC 1123 regex.
- `k8s_deployment_name` now slugifies internally — every Deployment name
  derived from an agent name is safe by construction.
- `provision_acp_auth_k8s_secret`/`provision_config_k8s_configmap` (studio-cp)
  now slugify the agent name before building their Secret/ConfigMap names.
- `provision_agent_k8s`/`provision_from_library_k8s`: the free-typed "+
  Create new namespace…" field has the exact same risk, so `namespace` is
  now normalized once up front and shadowed for the rest of the function —
  `ensure_namespace_k8s` (#140) and every object placed into that namespace
  now agree on the same slugified value, instead of `ensure_namespace_k8s`
  creating one casing while everything else tries to apply into another.

Verification: could not compile locally (sandbox OOMs on aws-sdk-ec2). Added
unit tests for `k8s_safe_name` and a regression test reproducing the exact
"Persephone" case Brett hit. CI is the real gate.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@brettchien
brettchien merged commit 1895570 into main Aug 30, 2026
2 checks passed
@brettchien
brettchien deleted the fix/k8s-slugify-agent-and-namespace-names branch August 30, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant