Skip to content

fix(controller): use '.' not '/' in mirrored-from label value#229

Merged
pallakatos merged 1 commit into
devfrom
fix/mirror-owner-label-slash
May 5, 2026
Merged

fix(controller): use '.' not '/' in mirrored-from label value#229
pallakatos merged 1 commit into
devfrom
fix/mirror-owner-label-slash

Conversation

@pallakatos
Copy link
Copy Markdown
Collaborator

Problem

azureclaw up on a fresh sandbox failed with the controller stuck reconciling, no sandbox pod created, WebUI port-forward target absent. Controller log:

ConfigMap "toolpolicy-<sandbox>-<ref>-profile" is invalid:
  metadata.labels: Invalid value: "toolpolicy/toolpolicy-<sandbox>-<ref>-profile":
  a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.'

Root cause

mirror_configmap / mirror_secret in reconciler/governance_mounts.rs built the azureclaw.azure.com/mirrored-from label value as <kind>/<name>. K8s allows / only in label keys (as a prefix), never in values.

Fix

Switch separator to . (allowed in label values). Doc-comment MIRROR_OWNER_LABEL so this stays put.

Test

cargo test --package azureclaw-controller governance_mounts — all 5 mount tests still pass. No test asserted the / format (no consumer parses this label value).

CI gap

Same class as #226 / #227: no integration test runs the patch against a real or fake apiserver, so K8s validation rules never fire on builders. Tracked for post-launch (CRD/object schema validation in npm test + Rust integration test for ConfigMap mirror).

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Kubernetes label values cannot contain '/' (only label keys may use the
'prefix/name' form). The mirror_configmap / mirror_secret helpers built
the value as '<kind>/<name>'.lower(), which K8s rejected with:

  ConfigMap "toolpolicy-<sandbox>-<ref>-profile" is invalid:
  metadata.labels: Invalid value: "toolpolicy/toolpolicy-...-profile"

This blocked the entire ClawSandbox reconcile (no sandbox pod created,
WebUI port-forward target absent), surfaced on launch-eve via 'azureclaw up'
on a fresh sandbox.

Switch separator to '.' (allowed in label values per the regex
'(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?') and add a doc comment on
MIRROR_OWNER_LABEL to prevent regression.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pallakatos pallakatos merged commit e2522b9 into dev May 5, 2026
18 checks passed
pallakatos added a commit that referenced this pull request May 12, 2026
Kubernetes label values cannot contain '/' (only label keys may use the
'prefix/name' form). The mirror_configmap / mirror_secret helpers built
the value as '<kind>/<name>'.lower(), which K8s rejected with:

  ConfigMap "toolpolicy-<sandbox>-<ref>-profile" is invalid:
  metadata.labels: Invalid value: "toolpolicy/toolpolicy-...-profile"

This blocked the entire ClawSandbox reconcile (no sandbox pod created,
WebUI port-forward target absent), surfaced on launch-eve via 'azureclaw up'
on a fresh sandbox.

Switch separator to '.' (allowed in label values per the regex
'(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?') and add a doc comment on
MIRROR_OWNER_LABEL to prevent regression.

Co-authored-by: Pal Lakatos-Toth <pallakatos@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pallakatos pallakatos deleted the fix/mirror-owner-label-slash branch June 1, 2026 14:39
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