From 9bc692db2708f03b010fe5461d16cc113b64b20e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwydion=20Mart=C3=ADn?= <118427625+gwydionmv@users.noreply.github.com> Date: Thu, 13 Jun 2024 13:15:35 +0200 Subject: [PATCH] feat(keycloak-operator): disable operator templates generation (#1272) Introduce `operator.enabled` value. --------- Co-authored-by: Gwydion Martin --- README.md | 2 +- charts/keycloak-operator/Chart.yaml | 24 ++++--------------- charts/keycloak-operator/README.md | 2 +- .../keycloak-operator/ci/default-values.yaml | 3 +-- .../keycloak-operator/ci/operand-values.yaml | 2 -- charts/keycloak-operator/templates/NOTES.txt | 6 +++-- .../templates/operator/clusterrole.yaml | 2 ++ .../templates/operator/deployment.yaml | 2 ++ .../templates/operator/rolebinding.yaml | 2 ++ .../templates/operator/roles.yaml | 2 ++ .../templates/operator/service.yaml | 2 ++ .../templates/operator/serviceaccount.yaml | 2 ++ .../tests/__snapshot__/default_test.yaml.snap | 20 ++++++++-------- .../tests/__snapshot__/operand_test.yaml.snap | 4 ++-- 14 files changed, 35 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index b0a1496a8..1fec37814 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Chart for HedgeDoc, a fork of CodiMD [hedgedoc](charts/hedgedoc) #### [keycloak-operator](charts/keycloak-operator) chart -![Version: 1.1.x](https://img.shields.io/badge/version-1.1.x-brightgreen) ![App version: 24..x](https://img.shields.io/badge/app%20version-24..x-brightgreen) +![Version: 1.2.x](https://img.shields.io/badge/version-1.2.x-brightgreen) ![App version: 24..x](https://img.shields.io/badge/app%20version-24..x-brightgreen) Deploy Keycloak Operator and Keycloak diff --git a/charts/keycloak-operator/Chart.yaml b/charts/keycloak-operator/Chart.yaml index f4c8c92ae..746b37a19 100644 --- a/charts/keycloak-operator/Chart.yaml +++ b/charts/keycloak-operator/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: keycloak-operator description: Deploy Keycloak Operator and Keycloak type: application -version: 1.1.0 +version: 1.2.0 appVersion: "24.0.4" icon: https://www.keycloak.org/resources/images/logo-stacked.svg home: https://www.keycloak.org @@ -16,23 +16,7 @@ maintainers: annotations: artifacthub.io/changes: | - kind: changed - description: "Bump Keycloak 23.0.3 to 24.0.4" + description: "New feature: disable Operator templates generation" links: - - name: "Release 24.0.4" - url: https://www.keycloak.org/2024/05/keycloak-2404-released.html - - name: "Release 24.0.3" - url: https://www.keycloak.org/2024/04/keycloak-2403-released.html - - name: "Release 24.0.2" - url: https://www.keycloak.org/2024/03/keycloak-2402-released.html - - name: "Release 24.0.1" - url: https://www.keycloak.org/2024/03/keycloak-2401-released.html - - name: "Release 24.0.0" - url: https://www.keycloak.org/2024/03/keycloak-2400-released.html - - name: "Release 23.0.7" - url: https://www.keycloak.org/2024/02/keycloak-2307-released.html - - name: "Release 23.0.6" - url: https://www.keycloak.org/2024/02/keycloak-2306-released.html - - name: "Release 23.0.5" - url: https://www.keycloak.org/2024/01/keycloak-2305-released.html - - name: "Release 23.0.4" - url: https://www.keycloak.org/2024/01/keycloak-2304-released.html + - name: "Issue 1270" + url: https://github.com/adfinis/helm-charts/issues/1270 diff --git a/charts/keycloak-operator/README.md b/charts/keycloak-operator/README.md index e01dfb440..267ef4f69 100644 --- a/charts/keycloak-operator/README.md +++ b/charts/keycloak-operator/README.md @@ -1,6 +1,6 @@ # keycloak-operator -![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 24.0.4](https://img.shields.io/badge/AppVersion-24.0.4-informational?style=flat-square) +![Version: 1.2.0](https://img.shields.io/badge/Version-1.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 24.0.4](https://img.shields.io/badge/AppVersion-24.0.4-informational?style=flat-square) Deploy Keycloak Operator and Keycloak diff --git a/charts/keycloak-operator/ci/default-values.yaml b/charts/keycloak-operator/ci/default-values.yaml index 7666ae427..4d0ed5bd3 100644 --- a/charts/keycloak-operator/ci/default-values.yaml +++ b/charts/keycloak-operator/ci/default-values.yaml @@ -1,4 +1,3 @@ operator: + enabled: true replicaCount: 1 -keycloak: - enabled: false diff --git a/charts/keycloak-operator/ci/operand-values.yaml b/charts/keycloak-operator/ci/operand-values.yaml index 99fc19069..fccffdde1 100644 --- a/charts/keycloak-operator/ci/operand-values.yaml +++ b/charts/keycloak-operator/ci/operand-values.yaml @@ -1,5 +1,3 @@ -operator: - replicaCount: 1 keycloak: enabled: true name: keycloak diff --git a/charts/keycloak-operator/templates/NOTES.txt b/charts/keycloak-operator/templates/NOTES.txt index b850811d1..ecab2e26d 100644 --- a/charts/keycloak-operator/templates/NOTES.txt +++ b/charts/keycloak-operator/templates/NOTES.txt @@ -1,7 +1,9 @@ -1. The Operator has been deployed, view the logs by running this command: +{{- if .Values.operator.enabled }} +- The Operator has been deployed, view the logs by running this command: kubectl --namespace {{ .Release.Namespace }} logs deployment/{{ include "keycloak-operator.operator.fullname" . }} +{{- end }} {{- if .Values.keycloak.enabled }} -2. A Keycloak instance has been deployed, connect to it at "{{ .Values.keycloak.hostname.hostname }}" +- A Keycloak instance has been deployed, connect to it at "{{ .Values.keycloak.hostname.hostname }}" {{- if .Values.keycloak.realmimport.enabled }} Additionally the following realms have been imported: {{- range .Values.keycloak.realmimport.realms }} diff --git a/charts/keycloak-operator/templates/operator/clusterrole.yaml b/charts/keycloak-operator/templates/operator/clusterrole.yaml index d471ddfd7..4761673c3 100644 --- a/charts/keycloak-operator/templates/operator/clusterrole.yaml +++ b/charts/keycloak-operator/templates/operator/clusterrole.yaml @@ -1,3 +1,4 @@ +{{- if .Values.operator.enabled }} apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: @@ -41,3 +42,4 @@ rules: - delete - patch - update +{{- end }} diff --git a/charts/keycloak-operator/templates/operator/deployment.yaml b/charts/keycloak-operator/templates/operator/deployment.yaml index 4beeb3d7d..860c497f6 100644 --- a/charts/keycloak-operator/templates/operator/deployment.yaml +++ b/charts/keycloak-operator/templates/operator/deployment.yaml @@ -1,3 +1,4 @@ +{{- if .Values.operator.enabled }} apiVersion: apps/v1 kind: Deployment metadata: @@ -80,3 +81,4 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} +{{- end }} diff --git a/charts/keycloak-operator/templates/operator/rolebinding.yaml b/charts/keycloak-operator/templates/operator/rolebinding.yaml index e616838b7..923b7aa4b 100644 --- a/charts/keycloak-operator/templates/operator/rolebinding.yaml +++ b/charts/keycloak-operator/templates/operator/rolebinding.yaml @@ -1,3 +1,4 @@ +{{- if .Values.operator.enabled }} apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: @@ -53,3 +54,4 @@ roleRef: subjects: - kind: ServiceAccount name: {{ include "keycloak-operator.operator.serviceAccountName" . }} +{{- end }} diff --git a/charts/keycloak-operator/templates/operator/roles.yaml b/charts/keycloak-operator/templates/operator/roles.yaml index 541abd1dc..45425a208 100644 --- a/charts/keycloak-operator/templates/operator/roles.yaml +++ b/charts/keycloak-operator/templates/operator/roles.yaml @@ -1,3 +1,4 @@ +{{- if .Values.operator.enabled }} apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: @@ -56,3 +57,4 @@ rules: - delete - patch - update +{{- end }} diff --git a/charts/keycloak-operator/templates/operator/service.yaml b/charts/keycloak-operator/templates/operator/service.yaml index fe8fb7a55..61c49caef 100644 --- a/charts/keycloak-operator/templates/operator/service.yaml +++ b/charts/keycloak-operator/templates/operator/service.yaml @@ -1,3 +1,4 @@ +{{- if .Values.operator.enabled }} {{- if .Values.operator.service.enabled }} apiVersion: v1 kind: Service @@ -15,3 +16,4 @@ spec: selector: {{- include "keycloak-operator.operator.selectorLabels" . | nindent 4 }} {{- end }} +{{- end }} diff --git a/charts/keycloak-operator/templates/operator/serviceaccount.yaml b/charts/keycloak-operator/templates/operator/serviceaccount.yaml index 0e551cc22..c46c734fe 100644 --- a/charts/keycloak-operator/templates/operator/serviceaccount.yaml +++ b/charts/keycloak-operator/templates/operator/serviceaccount.yaml @@ -1,3 +1,4 @@ +{{- if .Values.operator.enabled }} {{- if .Values.operator.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount @@ -10,3 +11,4 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} {{- end }} +{{- end }} diff --git a/charts/keycloak-operator/tests/__snapshot__/default_test.yaml.snap b/charts/keycloak-operator/tests/__snapshot__/default_test.yaml.snap index ea5cb5b0d..2ec0ad566 100644 --- a/charts/keycloak-operator/tests/__snapshot__/default_test.yaml.snap +++ b/charts/keycloak-operator/tests/__snapshot__/default_test.yaml.snap @@ -9,7 +9,7 @@ should match snapshot: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: keycloak-operator app.kubernetes.io/version: 24.0.4 - helm.sh/chart: keycloak-operator-1.1.0 + helm.sh/chart: keycloak-operator-1.2.0 name: keycloakcontroller-cluster-role rules: - apiGroups: @@ -36,7 +36,7 @@ should match snapshot: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: keycloak-operator app.kubernetes.io/version: 24.0.4 - helm.sh/chart: keycloak-operator-1.1.0 + helm.sh/chart: keycloak-operator-1.2.0 name: keycloakrealmimportcontroller-cluster-role rules: - apiGroups: @@ -63,7 +63,7 @@ should match snapshot: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: keycloak-operator app.kubernetes.io/version: 24.0.4 - helm.sh/chart: keycloak-operator-1.1.0 + helm.sh/chart: keycloak-operator-1.2.0 name: RELEASE-NAME-keycloak-operator-operator spec: replicas: 1 @@ -128,7 +128,7 @@ should match snapshot: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: keycloak-operator app.kubernetes.io/version: 24.0.4 - helm.sh/chart: keycloak-operator-1.1.0 + helm.sh/chart: keycloak-operator-1.2.0 name: keycloak-operator-role-binding roleRef: apiGroup: rbac.authorization.k8s.io @@ -147,7 +147,7 @@ should match snapshot: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: keycloak-operator app.kubernetes.io/version: 24.0.4 - helm.sh/chart: keycloak-operator-1.1.0 + helm.sh/chart: keycloak-operator-1.2.0 name: keycloak-operator-view roleRef: apiGroup: rbac.authorization.k8s.io @@ -166,7 +166,7 @@ should match snapshot: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: keycloak-operator app.kubernetes.io/version: 24.0.4 - helm.sh/chart: keycloak-operator-1.1.0 + helm.sh/chart: keycloak-operator-1.2.0 name: keycloakcontroller-role-binding roleRef: apiGroup: rbac.authorization.k8s.io @@ -185,7 +185,7 @@ should match snapshot: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: keycloak-operator app.kubernetes.io/version: 24.0.4 - helm.sh/chart: keycloak-operator-1.1.0 + helm.sh/chart: keycloak-operator-1.2.0 name: keycloakrealmimportcontroller-role-binding roleRef: apiGroup: rbac.authorization.k8s.io @@ -204,7 +204,7 @@ should match snapshot: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: keycloak-operator app.kubernetes.io/version: 24.0.4 - helm.sh/chart: keycloak-operator-1.1.0 + helm.sh/chart: keycloak-operator-1.2.0 name: keycloak-operator-role rules: - apiGroups: @@ -267,7 +267,7 @@ should match snapshot: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: keycloak-operator app.kubernetes.io/version: 24.0.4 - helm.sh/chart: keycloak-operator-1.1.0 + helm.sh/chart: keycloak-operator-1.2.0 name: RELEASE-NAME-keycloak-operator-operator spec: ports: @@ -290,5 +290,5 @@ should match snapshot: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: keycloak-operator app.kubernetes.io/version: 24.0.4 - helm.sh/chart: keycloak-operator-1.1.0 + helm.sh/chart: keycloak-operator-1.2.0 name: RELEASE-NAME-keycloak-operator diff --git a/charts/keycloak-operator/tests/__snapshot__/operand_test.yaml.snap b/charts/keycloak-operator/tests/__snapshot__/operand_test.yaml.snap index c5ca0ac88..e4590e6b2 100644 --- a/charts/keycloak-operator/tests/__snapshot__/operand_test.yaml.snap +++ b/charts/keycloak-operator/tests/__snapshot__/operand_test.yaml.snap @@ -7,7 +7,7 @@ should match snapshot: app.kubernetes.io/component: keycloak app.kubernetes.io/managed-by: Helm app.kubernetes.io/version: 24.0.4 - helm.sh/chart: keycloak-operator-1.1.0 + helm.sh/chart: keycloak-operator-1.2.0 name: keycloak spec: features: @@ -35,7 +35,7 @@ should match snapshot: labels: app.kubernetes.io/managed-by: Helm app.kubernetes.io/version: 24.0.4 - helm.sh/chart: keycloak-operator-1.1.0 + helm.sh/chart: keycloak-operator-1.2.0 name: RELEASE-NAME-keycloak-operator-test spec: keycloakCRName: keycloak