From 77581d25278b6819a5cbc802943764557a366c2f Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Thu, 8 Feb 2024 09:03:20 -0500 Subject: [PATCH] fix: change from operator. to kc.operator. keys (#26414) closes #12352 Signed-off-by: Steve Hawkins --- .github/workflows/operator-ci.yml | 12 +++++------- .../topics/keycloak/changes-24_0_0.adoc | 4 ++++ operator/README.md | 6 +++--- operator/scripts/olm-testing.sh | 2 +- .../main/java/org/keycloak/operator/Config.java | 16 +--------------- .../main/resources/application-rhbk.properties | 14 +++++++------- .../src/main/resources/application.properties | 10 +++++----- .../src/test/resources/application.properties | 6 +++--- 8 files changed, 29 insertions(+), 41 deletions(-) diff --git a/.github/workflows/operator-ci.yml b/.github/workflows/operator-ci.yml index 6cff0a90f7..d8fa7efc98 100644 --- a/.github/workflows/operator-ci.yml +++ b/.github/workflows/operator-ci.yml @@ -91,10 +91,9 @@ jobs: run: | ./mvnw install -Poperator -pl :keycloak-operator -am \ -Dquarkus.kubernetes.image-pull-policy=IfNotPresent \ - -Doperator.keycloak.image=keycloak:${{ env.version_local }} \ + -Dkc.operator.keycloak.image=keycloak:${{ env.version_local }} \ -Dtest.operator.custom.image=custom-keycloak:${{ env.version_local }} \ - -Doperator.keycloak.image-pull-policy=Never \ - -Dtest.operator.kubernetes.ip=$(minikube ip) + -Dkc.operator.keycloak.image-pull-policy=Never test-remote: name: Test remote @@ -138,11 +137,10 @@ jobs: ./mvnw install -Poperator -pl :keycloak-operator -am \ -Dquarkus.container-image.build=true \ -Dquarkus.kubernetes.image-pull-policy=IfNotPresent \ - -Doperator.keycloak.image=keycloak:${{ env.version_remote }} \ - -Dquarkus.kubernetes.env.vars.operator-keycloak-image-pull-policy=Never \ + -Dkc.operator.keycloak.image=keycloak:${{ env.version_remote }} \ + -Dquarkus.kubernetes.env.vars.kc-operator-keycloak-image-pull-policy=Never \ -Dtest.operator.custom.image=custom-keycloak:${{ env.version_remote }} \ - --no-transfer-progress -Dtest.operator.deployment=remote \ - -Dtest.operator.kubernetes.ip=$(minikube ip) + --no-transfer-progress -Dtest.operator.deployment=remote test-olm: name: Test OLM installation diff --git a/docs/documentation/upgrading/topics/keycloak/changes-24_0_0.adoc b/docs/documentation/upgrading/topics/keycloak/changes-24_0_0.adoc index fb2002b511..d0efbc02b6 100644 --- a/docs/documentation/upgrading/topics/keycloak/changes-24_0_0.adoc +++ b/docs/documentation/upgrading/topics/keycloak/changes-24_0_0.adoc @@ -341,6 +341,10 @@ Use the setting `spi-events-listener-jboss-logging-success-level` as described i To trigger custom actions or custom log entries, write a custom event listener as described in the Event Listener SPI in the link:{developerguide_link}[{developerguide_name}]. += Operator Customization Property Keys + +The property keys used by the operator for advanced configuration have changed from operator.keycloak to kc.operator.keycloak. + = Updates to cookies As part of refactoring cookie handling in Keycloak there are some changes to how cookies are set: diff --git a/operator/README.md b/operator/README.md index 6204cf94d6..01b40585c0 100644 --- a/operator/README.md +++ b/operator/README.md @@ -30,13 +30,13 @@ This will build a container image from `Dockerfile`, using `docker` by default. The Keycloak image can be configured, when starting the operator, using the Java property: ``` -operator.keycloak.image +kc.operator.keycloak.image ``` And the imagePullPolicy with: ``` -operator.keycloak.image-pull-policy +kc.operator.keycloak.image-pull-policy ``` ## Contributing @@ -109,7 +109,7 @@ To avoid skipping tests that are depending on custom Keycloak images, you need t And run the tests passing an extra Java property: ```bash --Dtest.operator.custom.image=custom-keycloak:latest +-Dtest.kc.operator.custom.image=custom-keycloak:latest ``` ### Testing using a pre-built operator image from a remote registry diff --git a/operator/scripts/olm-testing.sh b/operator/scripts/olm-testing.sh index 32a8997b3a..fc952154c0 100755 --- a/operator/scripts/olm-testing.sh +++ b/operator/scripts/olm-testing.sh @@ -26,7 +26,7 @@ VERSION="86400000.0.0" mvn clean package -Poperator -pl :keycloak-operator -am \ -Dquarkus.container-image.build=true \ -Dquarkus.container-image.image="ttl.sh/${UUID}keycloak-operator:${VERSION}" \ - -Doperator.keycloak.image="ttl.sh/${UUID}keycloak:${VERSION}" \ + -Dkc.operator.keycloak.image="ttl.sh/${UUID}keycloak:${VERSION}" \ -DskipTests # JIB patching on images doesn't work reliably with ttl.sh docker push "ttl.sh/${UUID}keycloak-operator:${VERSION}" diff --git a/operator/src/main/java/org/keycloak/operator/Config.java b/operator/src/main/java/org/keycloak/operator/Config.java index c673fba235..608af0bf65 100644 --- a/operator/src/main/java/org/keycloak/operator/Config.java +++ b/operator/src/main/java/org/keycloak/operator/Config.java @@ -18,14 +18,13 @@ package org.keycloak.operator; import io.smallrye.config.ConfigMapping; -import io.smallrye.config.WithDefault; import java.util.Map; /** * @author Vaclav Muzikar */ -@ConfigMapping(prefix = "operator") +@ConfigMapping(prefix = "kc.operator") public interface Config { Keycloak keycloak(); @@ -37,17 +36,4 @@ public interface Config { Map podLabels(); } - - // workarounds for OLM env values - // to be removed after https://github.com/keycloak/keycloak/issues/12352 - - @WithDefault("keycloak-operator") - String name(); - - interface Condition { - @WithDefault("keycloak-operator.v999-SNAPSHOT") - String name(); - } - - Condition condition(); } diff --git a/operator/src/main/resources/application-rhbk.properties b/operator/src/main/resources/application-rhbk.properties index d817376958..b0df7e46d7 100644 --- a/operator/src/main/resources/application-rhbk.properties +++ b/operator/src/main/resources/application-rhbk.properties @@ -1,7 +1,7 @@ -operator.keycloak.pod-labels."com.company"=Red_Hat -operator.keycloak.pod-labels."rht.prod_name"=Red_Hat_Runtimes -operator.keycloak.pod-labels."rht.prod_ver"=${SSO_QUARTER:sso_quarter_placeholder} -operator.keycloak.pod-labels."rht.comp"=SSO -operator.keycloak.pod-labels."rht.comp_ver"=${SSO_VER:${quarkus.application.version}} -operator.keycloak.pod-labels."rht.subcomp"=SSO_Server -operator.keycloak.pod-labels."rht.subcomp_t"=application \ No newline at end of file +kc.operator.keycloak.pod-labels."com.company"=Red_Hat +kc.operator.keycloak.pod-labels."rht.prod_name"=Red_Hat_Runtimes +kc.operator.keycloak.pod-labels."rht.prod_ver"=${SSO_QUARTER:sso_quarter_placeholder} +kc.operator.keycloak.pod-labels."rht.comp"=SSO +kc.operator.keycloak.pod-labels."rht.comp_ver"=${SSO_VER:${quarkus.application.version}} +kc.operator.keycloak.pod-labels."rht.subcomp"=SSO_Server +kc.operator.keycloak.pod-labels."rht.subcomp_t"=application \ No newline at end of file diff --git a/operator/src/main/resources/application.properties b/operator/src/main/resources/application.properties index 410dcc91ba..31a7193ccd 100644 --- a/operator/src/main/resources/application.properties +++ b/operator/src/main/resources/application.properties @@ -5,13 +5,13 @@ quarkus.operator-sdk.crd.validate=false quarkus.banner.enabled=false # Operator config -operator.keycloak.image=${RELATED_IMAGE_KEYCLOAK:quay.io/keycloak/keycloak:nightly} -operator.keycloak.image-pull-policy=Always -operator.keycloak.start-optimized=false -operator.keycloak.poll-interval-seconds=60 +kc.operator.keycloak.image=${RELATED_IMAGE_KEYCLOAK:quay.io/keycloak/keycloak:nightly} +kc.operator.keycloak.image-pull-policy=Always +kc.operator.keycloak.start-optimized=false +kc.operator.keycloak.poll-interval-seconds=60 # https://quarkus.io/guides/deploying-to-kubernetes#environment-variables-from-keyvalue-pairs -quarkus.kubernetes.env.vars.related-image-keycloak=${operator.keycloak.image} +quarkus.kubernetes.env.vars.related-image-keycloak=${kc.operator.keycloak.image} # Bundle config quarkus.operator-sdk.bundle.package-name=keycloak-operator diff --git a/operator/src/test/resources/application.properties b/operator/src/test/resources/application.properties index 2933da9783..680977d3c3 100644 --- a/operator/src/test/resources/application.properties +++ b/operator/src/test/resources/application.properties @@ -5,7 +5,7 @@ quarkus.operator-sdk.start-operator=false quarkus.log.level=INFO -operator.keycloak.pod-labels."test.label"=foobar -operator.keycloak.pod-labels."testLabelWithExpression"=${OPERATOR_TEST_LABEL_EXPRESSION} +kc.operator.keycloak.pod-labels."test.label"=foobar +kc.operator.keycloak.pod-labels."testLabelWithExpression"=${OPERATOR_TEST_LABEL_EXPRESSION} # allow the watching tests to complete more quickly -operator.keycloak.poll-interval-seconds=10 \ No newline at end of file +kc.operator.keycloak.poll-interval-seconds=10 \ No newline at end of file