From 05056330dc755d232836a050fa826d23bc6d2208 Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Tue, 19 Mar 2024 14:02:29 -0400 Subject: [PATCH] fix: making the truststore name field optional (#28013) closes: #28012 Signed-off-by: Steve Hawkins --- .../operator/crds/v2alpha1/deployment/spec/Truststore.java | 3 ++- .../testsuite/integration/KeycloakTruststoresTests.java | 4 ++-- .../src/test/resources/test-serialization-keycloak-cr.yml | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/operator/src/main/java/org/keycloak/operator/crds/v2alpha1/deployment/spec/Truststore.java b/operator/src/main/java/org/keycloak/operator/crds/v2alpha1/deployment/spec/Truststore.java index 80a9cbbfb9..761189351d 100644 --- a/operator/src/main/java/org/keycloak/operator/crds/v2alpha1/deployment/spec/Truststore.java +++ b/operator/src/main/java/org/keycloak/operator/crds/v2alpha1/deployment/spec/Truststore.java @@ -21,12 +21,13 @@ import io.fabric8.generator.annotation.Required; import io.sundr.builder.annotations.Buildable; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; @JsonInclude(JsonInclude.Include.NON_NULL) @Buildable(editableEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder") public class Truststore { - @Required + @JsonPropertyDescription("Not used. To be removed in later versions.") private String name; @Required private TruststoreSource secret; diff --git a/operator/src/test/java/org/keycloak/operator/testsuite/integration/KeycloakTruststoresTests.java b/operator/src/test/java/org/keycloak/operator/testsuite/integration/KeycloakTruststoresTests.java index 61982aa374..890e939f09 100644 --- a/operator/src/test/java/org/keycloak/operator/testsuite/integration/KeycloakTruststoresTests.java +++ b/operator/src/test/java/org/keycloak/operator/testsuite/integration/KeycloakTruststoresTests.java @@ -39,7 +39,7 @@ public class KeycloakTruststoresTests extends BaseOperatorTest { public void testTruststoreMissing() { var kc = getTestKeycloakDeployment(true); var deploymentName = kc.getMetadata().getName(); - kc.getSpec().getTruststores().put("xyz", new TruststoreBuilder().withName("xyz").withNewSecret().withName("xyz").endSecret().build()); + kc.getSpec().getTruststores().put("xyz", new TruststoreBuilder().withNewSecret().withName("xyz").endSecret().build()); deployKeycloak(k8sclient, kc, false); Resource stsResource = k8sclient.resources(StatefulSet.class).withName(deploymentName); @@ -58,7 +58,7 @@ public class KeycloakTruststoresTests extends BaseOperatorTest { var deploymentName = kc.getMetadata().getName(); K8sUtils.set(k8sclient, getResourceFromFile("example-truststore-secret.yaml", Secret.class)); - kc.getSpec().getTruststores().put("example", new TruststoreBuilder().withName("example").withNewSecret().withName("example-truststore-secret").endSecret().build()); + kc.getSpec().getTruststores().put("example", new TruststoreBuilder().withNewSecret().withName("example-truststore-secret").endSecret().build()); deployKeycloak(k8sclient, kc, true); Resource stsResource = k8sclient.resources(StatefulSet.class).withName(deploymentName); diff --git a/operator/src/test/resources/test-serialization-keycloak-cr.yml b/operator/src/test/resources/test-serialization-keycloak-cr.yml index cad8830982..f6e5e48629 100644 --- a/operator/src/test/resources/test-serialization-keycloak-cr.yml +++ b/operator/src/test/resources/test-serialization-keycloak-cr.yml @@ -65,6 +65,10 @@ spec: memory: "1500M" proxy: headers: forwarded + truststores: + x: + secret: + name: my-secret unsupported: podTemplate: metadata: