From 6de6db986bb695952817a9a9e966c74a1f59e831 Mon Sep 17 00:00:00 2001 From: Malte Sander Date: Tue, 5 Aug 2025 09:44:15 +0200 Subject: [PATCH 1/4] add env to product config --- rust/operator-binary/src/controller.rs | 1 + tests/templates/kuttl/smoke/10-install-opa.yaml.j2 | 6 +++++- tests/templates/kuttl/smoke/32-assert.yaml | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/templates/kuttl/smoke/32-assert.yaml diff --git a/rust/operator-binary/src/controller.rs b/rust/operator-binary/src/controller.rs index 0c6f0384..d0f97a90 100644 --- a/rust/operator-binary/src/controller.rs +++ b/rust/operator-binary/src/controller.rs @@ -449,6 +449,7 @@ pub async fn reconcile_opa( ( vec![ PropertyNameKind::File(CONFIG_FILE.to_string()), + PropertyNameKind::Env, PropertyNameKind::Cli, ], opa.spec.servers.clone(), diff --git a/tests/templates/kuttl/smoke/10-install-opa.yaml.j2 b/tests/templates/kuttl/smoke/10-install-opa.yaml.j2 index 78b443bb..f5b21dab 100644 --- a/tests/templates/kuttl/smoke/10-install-opa.yaml.j2 +++ b/tests/templates/kuttl/smoke/10-install-opa.yaml.j2 @@ -38,5 +38,9 @@ spec: config: logging: enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} + envOverrides: + SERVER_ROLE_LEVEL_ENV_VAR: "SERVER_ROLE_LEVEL_ENV_VAR" roleGroups: - default: {} + default: + envOverrides: + SERVER_ROLE_GROUP_LEVEL_ENV_VAR: "SERVER_ROLE_GROUP_LEVEL_ENV_VAR" diff --git a/tests/templates/kuttl/smoke/32-assert.yaml b/tests/templates/kuttl/smoke/32-assert.yaml new file mode 100644 index 00000000..5ae3315f --- /dev/null +++ b/tests/templates/kuttl/smoke/32-assert.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +metadata: + name: test-env-overrides +commands: + - script: kubectl exec -n $NAMESPACE -c opa svc/test-opa-server -- env | grep SERVER_ROLE_GROUP_LEVEL_ENV_VAR From 0ceaabb3ce3120dae7868d24209e70a7370f9fc9 Mon Sep 17 00:00:00 2001 From: Malte Sander Date: Tue, 5 Aug 2025 10:11:38 +0200 Subject: [PATCH 2/4] add changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0e81585..45a1b187 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,8 +16,13 @@ All notable changes to this project will be documented in this file. - BREAKING: The per-role server service is now prefixed with `-server` to be consistent with other operators ([#748]). - The User info fetcher is no longer an experimental feature ([#752]). +### Fixed + +- Fixed `envOverrides` which was ignored due to not being added to the product config machinery ([#754]). + [#748]: https://github.com/stackabletech/opa-operator/pull/748 [#752]: https://github.com/stackabletech/opa-operator/pull/752 +[#754]: https://github.com/stackabletech/opa-operator/pull/754 ## [25.7.0] - 2025-07-23 From 347c01f39a6c7713e4ef2236a8e9c417cbfb3466 Mon Sep 17 00:00:00 2001 From: Malte Sander Date: Tue, 5 Aug 2025 10:16:03 +0200 Subject: [PATCH 3/4] check for role env var --- tests/templates/kuttl/smoke/10-install-opa.yaml.j2 | 2 +- tests/templates/kuttl/smoke/32-assert.yaml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/templates/kuttl/smoke/10-install-opa.yaml.j2 b/tests/templates/kuttl/smoke/10-install-opa.yaml.j2 index f5b21dab..25d5aa57 100644 --- a/tests/templates/kuttl/smoke/10-install-opa.yaml.j2 +++ b/tests/templates/kuttl/smoke/10-install-opa.yaml.j2 @@ -39,7 +39,7 @@ spec: logging: enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} envOverrides: - SERVER_ROLE_LEVEL_ENV_VAR: "SERVER_ROLE_LEVEL_ENV_VAR" + SERVER_ROLE_LEVEL_ENV_VAR: "SERVER_ROLE_LEVEL_ENV_VAR" roleGroups: default: envOverrides: diff --git a/tests/templates/kuttl/smoke/32-assert.yaml b/tests/templates/kuttl/smoke/32-assert.yaml index 5ae3315f..f6044238 100644 --- a/tests/templates/kuttl/smoke/32-assert.yaml +++ b/tests/templates/kuttl/smoke/32-assert.yaml @@ -4,4 +4,7 @@ kind: TestAssert metadata: name: test-env-overrides commands: + # Role level env var + - script: kubectl exec -n $NAMESPACE -c opa svc/test-opa-server -- env | grep SERVER_ROLE_LEVEL_ENV_VAR + # RoleGroup level env var - script: kubectl exec -n $NAMESPACE -c opa svc/test-opa-server -- env | grep SERVER_ROLE_GROUP_LEVEL_ENV_VAR From 81ac73555d1dcac860aaa04fa9c148e452fddbdc Mon Sep 17 00:00:00 2001 From: Malte Sander Date: Tue, 5 Aug 2025 10:24:35 +0200 Subject: [PATCH 4/4] Update CHANGELOG.md Co-authored-by: Sebastian Bernauer --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45a1b187..1644d6bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ All notable changes to this project will be documented in this file. ### Fixed -- Fixed `envOverrides` which was ignored due to not being added to the product config machinery ([#754]). +- Fixed `envOverrides` not getting applied due to not being added to the product config machinery ([#754]). [#748]: https://github.com/stackabletech/opa-operator/pull/748 [#752]: https://github.com/stackabletech/opa-operator/pull/752