From e7148d4dd0dfb0f7d50f579d71aa60284d94d07f Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Thu, 29 Aug 2024 22:09:40 +0200 Subject: [PATCH] OZG-6004 zufi only set env vars when zufi is enabled --- src/main/helm/templates/deployment.yaml | 5 ++- ...oyment_grpc_zufi_manager_address_test.yaml | 43 +++++++++++++++++-- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index c39176436..0f2f269f6 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -152,11 +152,14 @@ spec: value: {{ (.Values.userManager).grpcClientNegotiationType | default "TLS" }} - name: grpc_client_info-manager_address value: {{ ((.Values.ozgcloud).infoManager).address }} + + {{- if (.Values.zufiManager).enabled }} - name: grpc_client_zufi-manager_address value: {{ .Values.zufiManager.address }} - name: grpc_client_zufi-manager_negotiationType value: {{ (.Values.zufiManager).grpcClientNegotiationType | default "TLS" }} - + {{- end }} + - name: ozgcloud_user-manager_url value: {{ include "app.ozgcloud_migration_user-manager_address" . }} {{- if not (.Values.database).useExternal }} diff --git a/src/test/helm/deployment_grpc_zufi_manager_address_test.yaml b/src/test/helm/deployment_grpc_zufi_manager_address_test.yaml index ab703213d..da5b9372d 100644 --- a/src/test/helm/deployment_grpc_zufi_manager_address_test.yaml +++ b/src/test/helm/deployment_grpc_zufi_manager_address_test.yaml @@ -32,27 +32,64 @@ set: ozgcloud: environment: dev imagePullSecret: test-image-pull-secret + tests: - - it: should set the grpc zufi-manager client address + - it: should set default grpc zufi-manager address + set: + zufiManager: + enabled: true asserts: - contains: path: spec.template.spec.containers[0].env content: name: grpc_client_zufi-manager_address - value: dns://zufi-server.zufi:9090 + value: zufi-server.zufi:9090 + + - it: should set custom grpc zufi-manager address + set: + zufiManager: + enabled: true + address: customAddress + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: grpc_client_zufi-manager_address + value: customAddress + + - it: should contain default zufi-manager grpc negotiationType tls + set: + zufiManager: + enabled: true asserts: - contains: path: spec.template.spec.containers[0].env content: name: grpc_client_zufi-manager_negotiationType value: TLS + - it: should contain zufi-manager grpc negotiationType plaintext set: - zufiManager.grpcClientNegotiationType: PLAINTEXT + zufiManager: + grpcClientNegotiationType: PLAINTEXT + enabled: true asserts: - contains: path: spec.template.spec.containers[0].env content: name: grpc_client_zufi-manager_negotiationType value: PLAINTEXT + + - it: should not set zufi env vars by default + asserts: + - notContains: + path: spec.template.spec.containers[0].env + content: + name: grpc_client_zufi-manager_address + any: true + - notContains: + path: spec.template.spec.containers[0].env + content: + name: grpc_client_zufi-manager_negotiationType + any: true -- GitLab