From 20538a97fd52bf5b66027b81bb11b96b293197bc Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Mon, 20 Nov 2023 10:11:37 +0100
Subject: [PATCH] OZG-4183 OZG-4584 rename kop to ozgcloud

---
 src/main/helm/templates/_helpers.tpl          | 28 +++++++++----------
 src/main/helm/templates/ingress.yaml          |  2 +-
 .../helm/deployment_defaults_labels_test.yaml |  2 +-
 .../helm/deplyoment_cert_bindings_test.yaml   |  2 +-
 src/test/helm/keycloak-user-crd-test.yaml     | 12 ++++----
 src/test/unit-values.yaml                     |  4 +--
 6 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl
index 95ed6b69..8c613dac 100644
--- a/src/main/helm/templates/_helpers.tpl
+++ b/src/main/helm/templates/_helpers.tpl
@@ -32,7 +32,7 @@ app.kubernetes.io/instance: user-manager
 app.kubernetes.io/managed-by: {{ include "app.managedBy" . }}
 app.kubernetes.io/name: {{ include "app.name" . }}
 app.kubernetes.io/namespace: {{ include "app.namespace" . }}
-app.kubernetes.io/part-of: kop
+app.kubernetes.io/part-of: ozgcloud
 app.kubernetes.io/version: {{ include "app.version" . }}
 helm.sh/chart: {{ include "app.chart" . }}
 {{- end -}}
@@ -52,8 +52,8 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
 {{- printf "%d %d * * *" (div (randNumeric 2) 2) (div (randNumeric 1) 2) -}}
 {{- end -}}
 
-{{- define "app.kopEnvironment" -}}
-{{- required "Environment muss angegeben sein" (.Values.kop).environment -}}
+{{- define "app.ozgcloudEnvironment" -}}
+{{- required "Environment muss angegeben sein" (.Values.ozgcloud).environment -}}
 {{- end -}}
 
 {{- define "app.ssoServerUrl" -}}
@@ -64,26 +64,26 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
 {{- end -}}
 {{- end -}}
 
-{{- define "app.kopBundesland" -}}
-{{- required "kop.bundesland must be set " (.Values.kop).bundesland }}
+{{- define "app.ozgcloudBundesland" -}}
+{{- required "ozgcloud.bundesland must be set " (.Values.ozgcloud).bundesland }}
 {{- end -}}
 
-{{- define "app.kopBezeichner" -}}
-{{- if (.Values.kop).bezeichner -}}
+{{- define "app.ozgcloudBezeichner" -}}
+{{- if (.Values.ozgcloud).bezeichner -}}
 
-{{ $length := len (.Values.kop).bezeichner }}
+{{ $length := len (.Values.ozgcloud).bezeichner }}
 {{- if lt 27 $length -}}
-{{ required (printf "Bezeichner %s ist zu lang (max. 27 Zeichen)" (.Values.kop).bezeichner) nil }}
+{{ required (printf "Bezeichner %s ist zu lang (max. 27 Zeichen)" (.Values.ozgcloud).bezeichner) nil }}
 {{- else -}}
-{{- required "Bezeichner muss angegeben sein" (.Values.kop).bezeichner -}}
+{{- required "Bezeichner muss angegeben sein" (.Values.ozgcloud).bezeichner -}}
 {{- end -}}
 {{- else -}}
-{{- required "Bezeichner muss angegeben sein" (.Values.kop).bezeichner -}}
+{{- required "Bezeichner muss angegeben sein" (.Values.ozgcloud).bezeichner -}}
 {{- end -}}
 {{- end -}}
 
 {{- define "app.ssoRealm" -}}
-{{ printf "%s-%s-%s" (include "app.kopBundesland" .) ( include "app.kopBezeichner" . ) ( include "app.kopEnvironment" . ) | trunc 63 | trimSuffix "-" }}
+{{ printf "%s-%s-%s" (include "app.ozgcloudBundesland" .) ( include "app.ozgcloudBezeichner" . ) ( include "app.ozgcloudEnvironment" . ) | trunc 63 | trimSuffix "-" }}
 {{- end -}}
 
 {{- define "app.ssoClientName" -}}
@@ -95,11 +95,11 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
 {{- end -}}
 
 {{- define "app.baseUrl" -}}
-{{ printf "https://%s-%s.%s" (include "app.kopBezeichner" .) (include "app.name" .) .Values.baseUrl }}
+{{ printf "https://%s-%s.%s" (include "app.ozgcloudBezeichner" .) (include "app.name" .) .Values.baseUrl }}
 {{- end -}}
 
 {{- define "app.alfaAddress" -}}
-{{ printf "https://%s.%s" (include "app.kopBezeichner" .) .Values.baseUrl }}
+{{ printf "https://%s.%s" (include "app.ozgcloudBezeichner" .) .Values.baseUrl }}
 {{- end -}}
 
 {{- define "app.replaceAllNonAlphanumeric" -}}
diff --git a/src/main/helm/templates/ingress.yaml b/src/main/helm/templates/ingress.yaml
index f64baed6..cb19ba1f 100644
--- a/src/main/helm/templates/ingress.yaml
+++ b/src/main/helm/templates/ingress.yaml
@@ -55,5 +55,5 @@ spec:
     - hosts:
       - {{ trimPrefix "https://" ( include "app.baseUrl" . ) }}
       {{- if ne (.Values).cluster_env "dataport" }}
-      secretName: {{ .Values.kop.bezeichner }}-{{ include "app.name" . }}-tls
+      secretName: {{ .Values.ozgcloud.bezeichner }}-{{ include "app.name" . }}-tls
       {{- end }}
\ No newline at end of file
diff --git a/src/test/helm/deployment_defaults_labels_test.yaml b/src/test/helm/deployment_defaults_labels_test.yaml
index 5df25d60..5510fba2 100644
--- a/src/test/helm/deployment_defaults_labels_test.yaml
+++ b/src/test/helm/deployment_defaults_labels_test.yaml
@@ -41,7 +41,7 @@ tests:
           value: user-manager
       - equal:
           path: metadata.labels.[app.kubernetes.io/part-of]
-          value: kop
+          value: ozgcloud
       - equal:
           path: metadata.labels.[app.kubernetes.io/namespace]
           value: sh-helm-test
diff --git a/src/test/helm/deplyoment_cert_bindings_test.yaml b/src/test/helm/deplyoment_cert_bindings_test.yaml
index abcccc1b..bab2e877 100644
--- a/src/test/helm/deplyoment_cert_bindings_test.yaml
+++ b/src/test/helm/deplyoment_cert_bindings_test.yaml
@@ -31,7 +31,7 @@ templates:
 tests:
   - it: should mount volumes for user-manager root ca
     set:
-      kop.environment: dev
+      ozgcloud.environment: dev
     asserts:
        - contains:
            path: spec.template.spec.containers[0].volumeMounts
diff --git a/src/test/helm/keycloak-user-crd-test.yaml b/src/test/helm/keycloak-user-crd-test.yaml
index b7a7a844..59177f41 100644
--- a/src/test/helm/keycloak-user-crd-test.yaml
+++ b/src/test/helm/keycloak-user-crd-test.yaml
@@ -53,7 +53,7 @@ tests:
           value: by-helm-test
   - it: should have default Values
     set:
-      kop:
+      ozgcloud:
         bundesland: by
         bezeichner: helm
         environment: test
@@ -85,7 +85,7 @@ tests:
 
   - it: should have Keycloak User without roles
     set:
-      kop:
+      ozgcloud:
         bundesland: by
         bezeichner: helm
         environment: test
@@ -122,7 +122,7 @@ tests:
 
   - it: should have Keycloak User with client role
     set:
-      kop:
+      ozgcloud:
         bundesland: by
         bezeichner: helm
         environment: test
@@ -165,7 +165,7 @@ tests:
 
   - it: should have Keycloak User with realm role
     set:
-      kop:
+      ozgcloud:
         bundesland: by
         bezeichner: helm
         environment: test
@@ -206,7 +206,7 @@ tests:
 
   - it: should have Keycloak User with group
     set:
-      kop:
+      ozgcloud:
         bundesland: by
         bezeichner: helm
         environment: test
@@ -247,7 +247,7 @@ tests:
 
   - it: should have lowercase username
     set:
-      kop:
+      ozgcloud:
         bundesland: by
         bezeichner: helm
         environment: test
diff --git a/src/test/unit-values.yaml b/src/test/unit-values.yaml
index ef7bd06c..b770b562 100644
--- a/src/test/unit-values.yaml
+++ b/src/test/unit-values.yaml
@@ -24,12 +24,10 @@
 
 baseUrl: test.sh.ozg-cloud.de
 
-kop:
+ozgcloud:
   bundesland: sh
   bezeichner: helm
   environment: test
-
-ozgcloud:
   keycloak:
     api:
       password: geheim
-- 
GitLab