From d7161f86bda005206371c4cae7ce3359096bc06d Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Tue, 26 Nov 2024 18:09:36 +0100 Subject: [PATCH] OZG-6477 OZG-6439 Configure collaboration-manager grpc client --- .../src/main/resources/application-local.yml | 3 +- .../src/main/resources/application.yml | 3 ++ .../CollaborationRemoteService.java | 2 +- .../de/ozgcloud/alfa/common/GrpcUtil.java | 2 +- src/main/helm/templates/_helpers.tpl | 4 ++ src/main/helm/templates/deployment.yaml | 4 ++ ...ollaboration_manager_address_env_test.yaml | 49 +++++++++++++++++++ .../helm/deployment_defaults_env_test.yaml | 23 +++++++++ 8 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 src/test/helm/deployment_collaboration_manager_address_env_test.yaml diff --git a/alfa-server/src/main/resources/application-local.yml b/alfa-server/src/main/resources/application-local.yml index 1dd7f05bdf..5e6e64ccac 100644 --- a/alfa-server/src/main/resources/application-local.yml +++ b/alfa-server/src/main/resources/application-local.yml @@ -10,12 +10,13 @@ server: grpc: client: user-manager: - address: static://127.0.0.1:9000 negotiationType: PLAINTEXT vorgang-manager: negotiationType: PLAINTEXT zufi-manager: negotiationType: PLAINTEXT + collaboration-manager: + negotiationType: PLAINTEXT ozgcloud: feature: diff --git a/alfa-server/src/main/resources/application.yml b/alfa-server/src/main/resources/application.yml index f5642fefec..9ac1e23e2b 100644 --- a/alfa-server/src/main/resources/application.yml +++ b/alfa-server/src/main/resources/application.yml @@ -66,6 +66,9 @@ grpc: zufi-manager: address: static://127.0.0.1:9190 negotiationType: TLS + collaboration-manager: + address: static://127.0.0.1:9090 + negotiationType: TLS ozgcloud: auth: diff --git a/alfa-service/src/main/java/de/ozgcloud/alfa/collaboration/CollaborationRemoteService.java b/alfa-service/src/main/java/de/ozgcloud/alfa/collaboration/CollaborationRemoteService.java index 6baedde96a..6d5d3aaac9 100644 --- a/alfa-service/src/main/java/de/ozgcloud/alfa/collaboration/CollaborationRemoteService.java +++ b/alfa-service/src/main/java/de/ozgcloud/alfa/collaboration/CollaborationRemoteService.java @@ -14,7 +14,7 @@ import net.devh.boot.grpc.client.inject.GrpcClient; @Service public class CollaborationRemoteService { - @GrpcClient(GrpcUtil.VORGANG_MANAGER_GRPC_CLIENT) // TODO: eigener Client für collaboration manager? + @GrpcClient(GrpcUtil.COLLABORATION_MANAGER_GRPC_CLIENT) private CollaborationRequestServiceBlockingStub serviceStub; @Autowired diff --git a/alfa-service/src/main/java/de/ozgcloud/alfa/common/GrpcUtil.java b/alfa-service/src/main/java/de/ozgcloud/alfa/common/GrpcUtil.java index fc033f658d..8dd478e953 100644 --- a/alfa-service/src/main/java/de/ozgcloud/alfa/common/GrpcUtil.java +++ b/alfa-service/src/main/java/de/ozgcloud/alfa/common/GrpcUtil.java @@ -37,8 +37,8 @@ import lombok.NoArgsConstructor; public class GrpcUtil { public static final String VORGANG_MANAGER_GRPC_CLIENT = "vorgang-manager"; - public static final String ZUFI_MANAGER_GRPC_CLIENT = "zufi-manager"; + public static final String COLLABORATION_MANAGER_GRPC_CLIENT = "collaboration-manager"; public static final String SERVICE_KEY = "GRPC_SERVICE"; diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl index 35797e5181..11ad653d35 100644 --- a/src/main/helm/templates/_helpers.tpl +++ b/src/main/helm/templates/_helpers.tpl @@ -57,6 +57,10 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} {{ printf "dns:///%s.%s:9000" ( coalesce .Values.usermanagerName "user-manager" ) .Release.Namespace }} {{- end -}} +{{- define "app.grpc_client_collaboration-manager_address" -}} +{{ printf "dns:///%s.%s:9090" ( coalesce .Values.collaborationManagerName "vorgang-manager" ) .Release.Namespace | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end -}} + {{- define "app.spring_cloud_config_administration_address" -}} {{ printf "http://%s.%s:8080" ( coalesce .Values.administrationName "administration" ) .Release.Namespace }} {{- end -}} diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index 585408d9e5..717b964ab4 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -78,6 +78,10 @@ spec: value: {{ include "app.grpc_client_user-manager_address" . }} - name: grpc_client_user-manager_negotiationType value: {{ (.Values.userManager).grpcClientNegotiationType | default "TLS" }} + - name: grpc_client_collaboration-manager_address + value: {{ include "app.grpc_client_collaboration-manager_address" . }} + - name: grpc_client_collaboration-manager_negotiationType + value: {{ (.Values.collaborationManager).grpcClientNegotiationType | default "TLS" }} - name: spring_profiles_active value: {{ include "app.envSpringProfiles" . }} - name: keycloak_realm diff --git a/src/test/helm/deployment_collaboration_manager_address_env_test.yaml b/src/test/helm/deployment_collaboration_manager_address_env_test.yaml new file mode 100644 index 0000000000..d5b281eb44 --- /dev/null +++ b/src/test/helm/deployment_collaboration_manager_address_env_test.yaml @@ -0,0 +1,49 @@ +# +# Copyright (C) 2024 Das Land Schleswig-Holstein vertreten durch den +# Ministerpräsidenten des Landes Schleswig-Holstein +# Staatskanzlei +# Abteilung Digitalisierung und zentrales IT-Management der Landesregierung +# +# Lizenziert unter der EUPL, Version 1.2 oder - sobald +# diese von der Europäischen Kommission genehmigt wurden - +# Folgeversionen der EUPL ("Lizenz"); +# Sie dürfen dieses Werk ausschließlich gemäß +# dieser Lizenz nutzen. +# Eine Kopie der Lizenz finden Sie hier: +# +# https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 +# +# Sofern nicht durch anwendbare Rechtsvorschriften +# gefordert oder in schriftlicher Form vereinbart, wird +# die unter der Lizenz verbreitete Software "so wie sie +# ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN - +# ausdrücklich oder stillschweigend - verbreitet. +# Die sprachspezifischen Genehmigungen und Beschränkungen +# unter der Lizenz sind dem Lizenztext zu entnehmen. +# + +suite: test deployment collaboration-manager address +release: + name: alfa + namespace: sh-helm-test +templates: + - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local + imagePullSecret: image-pull-secret +tests: + - it: should set the collaboration-manager name + set: + collaborationManagerName: my-test-collaboration-manager-name + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: grpc_client_collaboration-manager_address + value: dns:///my-test-collaboration-manager-name.sh-helm-test:9090 diff --git a/src/test/helm/deployment_defaults_env_test.yaml b/src/test/helm/deployment_defaults_env_test.yaml index 9bdb30b9dc..a4d636a94c 100644 --- a/src/test/helm/deployment_defaults_env_test.yaml +++ b/src/test/helm/deployment_defaults_env_test.yaml @@ -54,6 +54,11 @@ tests: content: name: grpc_client_user-manager_address value: dns:///user-manager.sh-helm-test:9000 + - contains: + path: spec.template.spec.containers[0].env + content: + name: grpc_client_collaboration-manager_address + value: dns:///vorgang-manager.sh-helm-test:9090 - it: should have service binding root set: @@ -150,3 +155,21 @@ tests: content: name: grpc_client_vorgang-manager_negotiationType value: TLS + + - it: should set collaboration-manager negotiationType plaintext + set: + collaborationManager.grpcClientNegotiationType: PLAINTEXT + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: grpc_client_collaboration-manager_negotiationType + value: PLAINTEXT + + - it: should contain default collaboration-manager negotiationType tls + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: grpc_client_collaboration-manager_negotiationType + value: TLS -- GitLab