Files
Matthew Grossman 90161fbd7d feat(kubernetes): add operator allowlists for sandbox pod annotations and labels (#4497)
* feat(kubernetes): add operator allowlist for sandbox pod annotations

Add allowed_pod_annotations to the Kubernetes driver config. Sandbox
template annotations must match an exact key or a <domain>/* entry, and
the default empty list rejects all of them. Keys in the openshell.ai and
agents.x-k8s.io domains are always rejected. Expose the setting through
the server.allowedPodAnnotations Helm value.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

* test(kubernetes): cover pod annotation rejection on sandbox create

Assert the exact rejected annotation keys, exercise create_sandbox_inner
with a disallowed annotation, and point the rejection error at the Helm
gatewayConfig path.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

* fix(kubernetes): drop Helm path from pod annotation rejection error

The rejection error reaches API callers, not operators, so name only the
gateway config key. Spell the Helm path in the runtimes docs with the
quoted table key to avoid an invalid nested gatewayConfig rendering.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

* test(kubernetes): condense pod annotation allowlist tests

Fold the allowlist matching and validation cases into table-driven tests,
reuse the json_struct helper for templates, and document why the
openshell.ai and agents.x-k8s.io domains are reserved.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

* feat(kubernetes): add operator allowlist for sandbox pod labels

Sandbox template labels were copied onto workload pods unfiltered. Labels
select pods for NetworkPolicy rules and Services, so a caller could place a
sandbox under rules meant for other workloads or set OpenShell-owned labels.

Add allowed_pod_labels, sharing the allowed_pod_annotations entry format,
validation, and reserved openshell.ai / agents.x-k8s.io domains. Empty by
default, which rejects every template label.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

---------

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
2026-10-13 22:57:24 +00:00
..