feat: add envVars field for Workbench, Connect, and Package Manager#141
feat: add envVars field for Workbench, Connect, and Package Manager#141stevenolen wants to merge 3 commits into
Conversation
Add an envVars field ([]corev1.EnvVar) to the Workbench, Connect, and Package Manager product specs, supporting valueFrom (e.g. secretKeyRef) for secret-backed environment variables. This is exposed on both the standalone product CRs and the Site-embedded specs. Deprecate the existing addEnv (map[string]string) field in favor of envVars, which is more consistent and supports the standard Kubernetes EnvVar structure. addEnv continues to work; envVars is appended last so it takes precedence on a name conflict.
|
@claude review |
|
Claude finished @stevenolen's task in 2m 22s —— View job Code Review:
|
Add TestConnectReconciler_EnvVars and TestWorkbenchReconciler_EnvVars, mirroring TestPackageManagerReconciler_EnvVars, to verify that both a plain value and a valueFrom.secretKeyRef entry set on Spec.EnvVars reach the rendered product container's Env. Package Manager already had this coverage; this extends it to the other two products, whose Env slices are more complex.
Clarify on the deprecated addEnv field that when the same variable name is set in both addEnv and envVars, envVars wins: it is rendered after addEnv, and Kubernetes resolves a duplicate env var name to the last occurrence. Regenerated CRD descriptions and updated the API reference.
|
Addressing the review points: Point 2 (env var precedence) is incorrect — Kubernetes uses the last occurrence of a duplicate env var name, not the first. The kubelet builds the container environment from a name-keyed map with last-write-wins: Point 3 (missing render tests): addressed in 6183fa7 — added Point 1 (deprecation warning): intentionally deferred to keep this change minimal; |
Summary
Adds a new
envVarsfield ([]corev1.EnvVar) to the Workbench, Connect, and Package Manager product specs (both the standalone product CRs and the Site-embedded specs). Unlike the existingaddEnv(map[string]string, literals only),envVarssupports the standard KubernetesEnvVarstructure includingvalueFrom(e.g.secretKeyRef), so secrets can be injected the Kubernetes-native way.The existing
addEnvfield is deprecated in favor ofenvVarsbut continues to work.envVarsis appended last when assembling the containerEnv, so it takes precedence on a name conflict.Scope is intentionally limited to the three "product itself" pods. Workbench sessions already have
sessionEnvVars; Connect content and Chronicle are not included.Usage
The same
envVarsfield is available underspec.connectandspec.workbench.Changes
envVarsadded to Connect/Workbench/PackageManager specs and their Site-embedded internal specs;addEnvmarked deprecated.envVars;envVarsappended to the containerEnvrender path for all three products.docs/api-reference.mdupdated withenvVarsrows andaddEnvdeprecation notes.Testing
TestSiteReconciler_EnvVars— verifies Site → product CR propagation (including asecretKeyRefentry) for all three products.TestPackageManagerReconciler_EnvVars— verifies both a plain var and asecretKeyRefvar reach the rendered Package Manager containerEnv.make manifests generate-allidempotent,make verify-crds,make fmt vet build, andmake testall pass.