From ab34824bc180c6c5f14cd3a379b7e18bfe062355 Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Thu, 23 May 2024 15:10:33 +0200
Subject: [PATCH] ozg-3938 disable grpc tls

---
 src/main/helm/templates/deployment.yaml       | 13 +++++++-
 ...oyment_grpc_info_manager_address_test.yaml | 24 ++++++++++++--
 src/test/helm/deployment_grpc_tls_test.yaml   | 31 ++++++++++++++++++-
 3 files changed, 64 insertions(+), 4 deletions(-)

diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml
index d39c08c77..21cff757b 100644
--- a/src/main/helm/templates/deployment.yaml
+++ b/src/main/helm/templates/deployment.yaml
@@ -146,7 +146,8 @@ spec:
             value: {{ (.Values.userManager).grpcClientNegotiationType | default "TLS" }}
           - name: grpc_client_info-manager_address
             value:  {{ ((.Values.ozgcloud).infoManager).address }}
-
+          - name: grpc_client_info-manager_negotiationType
+            value:  {{ ((.Values.ozgcloud).infoManager).grpcClientNegotiationType | default "TLS" }}
           - name: ozgcloud_user-manager_url
             value: {{ include "app.ozgcloud_migration_user-manager_address" . }}
           - name: ozgcloud_zufi-manager_address
@@ -222,6 +223,16 @@ spec:
           {{- if .Values.disableGrpcTls }}
           - name: grpc_server_security_enabled
             value: "false"
+          - name: grpc_client_pluto_negotiationType
+            value: PLAINTEXT
+          - name: grpc_client_vorgang-manager_negotiationType
+            value: PLAINTEXT
+          - name: grpc_client_email_negotiationType
+            value: PLAINTEXT
+          - name: grpc_client_nachrichten-manager_negotiationType
+            value: PLAINTEXT
+          - name: grpc_client_command-manager_negotiationType
+            value: PLAINTEXT
           {{- end }}
 
         {{- if or (.Values.database).useExternal (.Values.ozgcloudProxyApi).apikey }}
diff --git a/src/test/helm/deployment_grpc_info_manager_address_test.yaml b/src/test/helm/deployment_grpc_info_manager_address_test.yaml
index 763578ba5..a04833c32 100644
--- a/src/test/helm/deployment_grpc_info_manager_address_test.yaml
+++ b/src/test/helm/deployment_grpc_info_manager_address_test.yaml
@@ -28,17 +28,37 @@ release:
   namespace: sh-helm-test
 templates:
   - templates/deployment.yaml
+set:
+  ozgcloud:
+    environment: dev
+  imagePullSecret: test-image-pull-secret
 tests:
   - it: should set the grpc info-manager client address
     set:
       ozgcloud:
-        environment: dev
         infoManager: 
           address: https://info-manager.my-wonderful-domain.local:9000
-      imagePullSecret: test-image-pull-secret
     asserts:
       - contains:
           path: spec.template.spec.containers[0].env
           content:
             name: grpc_client_info-manager_address
             value: https://info-manager.my-wonderful-domain.local:9000
+  - it: check default info-manager negotiationType
+    asserts:
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: grpc_client_info-manager_negotiationType
+            value: TLS
+  - it: should set info-manager negotiationType
+    set:
+      ozgcloud:
+        infoManager:
+          grpcClientNegotiationType: PLAINTEXT
+    asserts:
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: grpc_client_info-manager_negotiationType
+            value: PLAINTEXT
\ No newline at end of file
diff --git a/src/test/helm/deployment_grpc_tls_test.yaml b/src/test/helm/deployment_grpc_tls_test.yaml
index 120c32436..abdf517b6 100644
--- a/src/test/helm/deployment_grpc_tls_test.yaml
+++ b/src/test/helm/deployment_grpc_tls_test.yaml
@@ -93,4 +93,33 @@ tests:
           path: spec.template.spec.containers[0].env
           content:
             name: grpc_server_security_enabled
-            value: "false"
\ No newline at end of file
+            value: "false"
+  - it: should set grpc negotiationType Plaintext
+    set:
+      disableGrpcTls: true
+    asserts:
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: grpc_client_pluto_negotiationType
+            value: PLAINTEXT
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: grpc_client_vorgang-manager_negotiationType
+            value: PLAINTEXT
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: grpc_client_email_negotiationType
+            value: PLAINTEXT
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: grpc_client_nachrichten-manager_negotiationType
+            value: PLAINTEXT
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: grpc_client_command-manager_negotiationType
+            value: PLAINTEXT
\ No newline at end of file
-- 
GitLab