From a5be0bc9c9c87ea8498de0e5e76b6d346b5938c6 Mon Sep 17 00:00:00 2001
From: Krzysztof <krzysztof.witukiewicz@mgm-tp.com>
Date: Fri, 21 Mar 2025 14:14:27 +0100
Subject: [PATCH] OZG-7573 OZG-7987 check if enabled

---
 src/main/helm/templates/deployment.yaml       |  7 ++++---
 .../helm/deployment_forwarder_env_test.yaml   | 21 +++++++++++++++++--
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml
index ca7565997..a59322362 100644
--- a/src/main/helm/templates/deployment.yaml
+++ b/src/main/helm/templates/deployment.yaml
@@ -163,11 +163,12 @@ spec:
           - name: grpc_client_zufi-manager_negotiationType
             value: {{ (.Values.zufiManager).grpcClientNegotiationType | default "PLAINTEXT" }}
           {{- end}}
+          {{- if (.Values.forwarding).enabled }}
           - name: grpc_client_forwarder_address
-            value: {{ (.Values.forwarder).address }}
+            value: {{ (.Values.forwarding).address }}
           - name: grpc_client_forwarder_negotiationType
-            value: {{ (.Values.forwarder).grpcClientNegotiationType | default "TLS" }}
-
+            value: {{ (.Values.forwarding).grpcClientNegotiationType | default "TLS" }}
+          {{- end }}
           {{- if not (.Values.database).useExternal }}
           - name: spring_data_mongodb_uri
             valueFrom:
diff --git a/src/test/helm/deployment_forwarder_env_test.yaml b/src/test/helm/deployment_forwarder_env_test.yaml
index fefb761dc..fd7a77f81 100644
--- a/src/test/helm/deployment_forwarder_env_test.yaml
+++ b/src/test/helm/deployment_forwarder_env_test.yaml
@@ -35,9 +35,22 @@ set:
     bezeichner: helm
   imagePullSecret: test-image-pull-secret
 tests:
+  - it: should be disabled by default
+    asserts:
+      - notContains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: ozgcloud_forwarder_address
+          any: true
+      - notContains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: grpc_client_forwarder_negotiationType
+          any: true
   - it: should set the grpc forwarder client address
     set:
-      forwarder:
+      forwarding:
+        enabled: true
         address: https://forwarder.my-wonderful-domain.local:9000
     asserts:
       - contains:
@@ -46,6 +59,9 @@ tests:
             name: grpc_client_forwarder_address
             value: https://forwarder.my-wonderful-domain.local:9000
   - it: should set the default negotiation type
+    set:
+      forwarding:
+        enabled: true
     asserts:
       - contains:
           path: spec.template.spec.containers[0].env
@@ -54,7 +70,8 @@ tests:
             value: TLS
   - it: should set the negotiation type
     set:
-      forwarder:
+      forwarding:
+        enabled: true
         grpcClientNegotiationType: PLAINTEXT
     asserts:
       - contains:
-- 
GitLab