Summary
Currently, the operator's resolveEnvVarValue function (in kubernetes/operator/internal/controller/env.go) returns an error when a CR spec env entry uses fieldRef or resourceFieldRef. This breaks the existing corev1.EnvVar contract for users who rely on the Downward API.
Background
PR #1753 moved all env var resolution to reconcile-time so values are embedded in the .env file rather than passed through to container.Env. However, fieldRef and resourceFieldRef are runtime-only sources that are only meaningful inside a running pod — they cannot be resolved at reconcile time. The safe handling is to leave them in Deployment.Spec.Template.Spec.Containers[*].Env unchanged, letting the kubelet resolve them at runtime.
Desired Behavior
fieldRef and resourceFieldRef entries in spec.env should not be added to the .env file.
- Instead, they should be passed through as-is into the pod template's
container.Env so the kubelet can resolve them at runtime.
- All other
ValueFrom types (secretKeyRef, configMapKeyRef) continue to be resolved at reconcile time and written to the .env file only.
Files Affected
kubernetes/operator/internal/controller/env.go — remove error returns for FieldRef / ResourceFieldRef in resolveEnvVarValue
kubernetes/operator/internal/controller/openrag_controller.go — update buildBackendEnv / buildLangflowEnv / Deployment construction to pass these entries into container.Env
References
Summary
Currently, the operator's
resolveEnvVarValuefunction (inkubernetes/operator/internal/controller/env.go) returns an error when a CR specenventry usesfieldReforresourceFieldRef. This breaks the existingcorev1.EnvVarcontract for users who rely on the Downward API.Background
PR #1753 moved all env var resolution to reconcile-time so values are embedded in the
.envfile rather than passed through tocontainer.Env. However,fieldRefandresourceFieldRefare runtime-only sources that are only meaningful inside a running pod — they cannot be resolved at reconcile time. The safe handling is to leave them inDeployment.Spec.Template.Spec.Containers[*].Envunchanged, letting the kubelet resolve them at runtime.Desired Behavior
fieldRefandresourceFieldRefentries inspec.envshould not be added to the.envfile.container.Envso the kubelet can resolve them at runtime.ValueFromtypes (secretKeyRef, configMapKeyRef) continue to be resolved at reconcile time and written to the.envfile only.Files Affected
kubernetes/operator/internal/controller/env.go— remove error returns forFieldRef/ResourceFieldRefinresolveEnvVarValuekubernetes/operator/internal/controller/openrag_controller.go— updatebuildBackendEnv/buildLangflowEnv/ Deployment construction to pass these entries intocontainer.EnvReferences