Summary
ActorTemplate container env currently accepts Kubernetes corev1.EnvVar in the CRD schema, so users can write valueFrom.configMapKeyRef and valueFrom.secretKeyRef in manifests. At runtime, Substrate flattens env vars into its atelet workload protobuf, which historically carried only literal name/value pairs. That means valueFrom entries are accepted by the API but are not usable by actors.
Add support for resolving valueFrom.configMapKeyRef and valueFrom.secretKeyRef for ActorTemplate container env before handing the workload spec to atelet.
Why this matters
- Secret-backed env vars are the standard Kubernetes pattern for API keys and credentials. Without this, demos and real workloads either inline secrets as plain env values in rendered manifests or need custom workaround scripts.
- ConfigMap-backed env vars are the standard Kubernetes pattern for non-secret runtime configuration.
- The current behavior is surprising because the CRD schema exposes Kubernetes EnvVar, including
valueFrom, but Substrate silently loses the source and sends an empty literal value to atelet.
- Supporting these two common
valueFrom sources makes ActorTemplate behavior closer to what Kubernetes users expect while keeping unsupported sources explicit.
Proposed scope
- Support literal
env.value as before.
- Support
env.valueFrom.configMapKeyRef from the ActorTemplate namespace.
- Support
env.valueFrom.secretKeyRef from the ActorTemplate namespace.
- Preserve Kubernetes
optional: true behavior by skipping the env var if the referenced object or key is missing.
- Return a clear error for missing required objects/keys.
- Return a clear error for unsupported sources such as
fieldRef, resourceFieldRef, and fileKeyRef.
Security / design note
Resolving Secret and ConfigMap references in ate-api means ate-api needs read access to those resources. The straightforward implementation grants the ate-api service account get access to ConfigMaps and Secrets so ActorTemplates work without custom per-namespace RBAC. This is a conscious tradeoff for now, but it should remain a security TODO/design choice.
Possible future designs include per-namespace delegated RBAC, admission-time validation/materialization, or another scoped credential model that avoids broad Secret read access in the control plane.
Acceptance criteria
- ActorTemplate env with
valueFrom.secretKeyRef reaches the actor process with the referenced Secret value.
- ActorTemplate env with
valueFrom.configMapKeyRef reaches the actor process with the referenced ConfigMap value.
- Missing required refs fail clearly instead of becoming empty env vars.
- Optional missing refs are skipped.
- Unsupported
valueFrom sources fail clearly.
- Docs call out supported sources and the security/design tradeoff.
Summary
ActorTemplate container env currently accepts Kubernetes
corev1.EnvVarin the CRD schema, so users can writevalueFrom.configMapKeyRefandvalueFrom.secretKeyRefin manifests. At runtime, Substrate flattens env vars into its atelet workload protobuf, which historically carried only literalname/valuepairs. That meansvalueFromentries are accepted by the API but are not usable by actors.Add support for resolving
valueFrom.configMapKeyRefandvalueFrom.secretKeyReffor ActorTemplate container env before handing the workload spec to atelet.Why this matters
valueFrom, but Substrate silently loses the source and sends an empty literal value to atelet.valueFromsources makes ActorTemplate behavior closer to what Kubernetes users expect while keeping unsupported sources explicit.Proposed scope
env.valueas before.env.valueFrom.configMapKeyReffrom the ActorTemplate namespace.env.valueFrom.secretKeyReffrom the ActorTemplate namespace.optional: truebehavior by skipping the env var if the referenced object or key is missing.fieldRef,resourceFieldRef, andfileKeyRef.Security / design note
Resolving Secret and ConfigMap references in ate-api means ate-api needs read access to those resources. The straightforward implementation grants the ate-api service account
getaccess to ConfigMaps and Secrets so ActorTemplates work without custom per-namespace RBAC. This is a conscious tradeoff for now, but it should remain a security TODO/design choice.Possible future designs include per-namespace delegated RBAC, admission-time validation/materialization, or another scoped credential model that avoids broad Secret read access in the control plane.
Acceptance criteria
valueFrom.secretKeyRefreaches the actor process with the referenced Secret value.valueFrom.configMapKeyRefreaches the actor process with the referenced ConfigMap value.valueFromsources fail clearly.