From bba701437fce1c6f02a3ebdfa582a2616d512345 Mon Sep 17 00:00:00 2001 From: Alexander Schwartz Date: Tue, 5 Mar 2024 09:37:38 +0100 Subject: [PATCH] Use JDK17 features to simplify code with multiline strings (#27495) Closes #27494 Signed-off-by: Alexander Schwartz --- operator/pom.xml | 6 +- .../KeycloakSharedCsvMetadata.java | 93 ++++++++++--------- 2 files changed, 51 insertions(+), 48 deletions(-) diff --git a/operator/pom.xml b/operator/pom.xml index 340445f620..a9dd746c85 100644 --- a/operator/pom.xml +++ b/operator/pom.xml @@ -17,9 +17,9 @@ 3.8.1 true - 11 - 11 - 11 + 17 + 17 + 17 UTF-8 UTF-8 keycloak diff --git a/operator/src/main/java/org/keycloak/operator/controllers/KeycloakSharedCsvMetadata.java b/operator/src/main/java/org/keycloak/operator/controllers/KeycloakSharedCsvMetadata.java index 4a3d9d2bb0..525b57f660 100644 --- a/operator/src/main/java/org/keycloak/operator/controllers/KeycloakSharedCsvMetadata.java +++ b/operator/src/main/java/org/keycloak/operator/controllers/KeycloakSharedCsvMetadata.java @@ -77,43 +77,44 @@ import io.quarkiverse.operatorsdk.annotations.SharedCSVMetadata; capabilities = "Deep Insights", categories = "Security", certified = false, - // language=JSON almExamples = - "[\n" + - " {\n" + - " \"apiVersion\": \"k8s.keycloak.org/v2alpha1\",\n" + - " \"kind\": \"Keycloak\",\n" + - " \"metadata\": {\n" + - " \"name\": \"example-keycloak\",\n" + - " \"labels\": {\n" + - " \"app\": \"sso\"\n" + - " }\n" + - " },\n" + - " \"spec\": {\n" + - " \"instances\": 1,\n" + - " \"hostname\": {\n" + - " \"hostname\": \"example.org\"\n" + - " },\n" + - " \"http\": {\n" + - " \"tlsSecret\": \"my-tls-secret\"\n" + - " }\n" + - " }\n" + - " },\n" + - " {\n" + - " \"apiVersion\": \"k8s.keycloak.org/v2alpha1\",\n" + - " \"kind\": \"KeycloakRealmImport\",\n" + - " \"metadata\": {\n" + - " \"name\": \"example-keycloak-realm-import\",\n" + - " \"labels\": {\n" + - " \"app\": \"sso\"\n" + - " }\n" + - " },\n" + - " \"spec\": {\n" + - " \"keycloakCRName\": \"example-keycloak\",\n" + - " \"realm\": {}\n" + - " }\n" + - " }\n" + - "]", + // language=JSON + """ + [ + { + "apiVersion": "k8s.keycloak.org/v2alpha1", + "kind": "Keycloak", + "metadata": { + "name": "example-keycloak", + "labels": { + "app": "sso" + } + }, + "spec": { + "instances": 1, + "hostname": { + "hostname": "example.org" + }, + "http": { + "tlsSecret": "my-tls-secret" + } + } + }, + { + "apiVersion": "k8s.keycloak.org/v2alpha1", + "kind": "KeycloakRealmImport", + "metadata": { + "name": "example-keycloak-realm-import", + "labels": { + "app": "sso" + } + }, + "spec": { + "keycloakCRName": "example-keycloak", + "realm": {} + } + } + ]""", others = { @CSVMetadata.Annotations.Annotation( name = "support", @@ -126,15 +127,17 @@ import io.quarkiverse.operatorsdk.annotations.SharedCSVMetadata; } ), description = - "A Kubernetes Operator based on the Operator SDK for installing and managing Keycloak.\n" + - "\n" + - "Keycloak lets you add authentication to applications and secure services with minimum fuss. No need to deal with storing users or authenticating users. It's all available out of the box.\n" + - "\n" + - "The operator can deploy and manage Keycloak instances on Kubernetes and OpenShift.\n" + - "The following features are supported:\n" + - "\n" + - "* Install Keycloak to a namespace\n" + - "* Import Keycloak Realms\n", + """ + A Kubernetes Operator based on the Operator SDK for installing and managing Keycloak. + + Keycloak lets you add authentication to applications and secure services with minimum fuss. No need to deal with storing users or authenticating users. It's all available out of the box. + + The operator can deploy and manage Keycloak instances on Kubernetes and OpenShift. + The following features are supported: + + * Install Keycloak to a namespace + * Import Keycloak Realms + """, icon = @CSVMetadata.Icon( fileName = "KeycloakController.icon.png", mediatype = "image/png"