diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl index ecd259464808431a11dfd5d2a656fce034da5ce7..8aef70cf6b97a391e3cc7befe478936dcbb62600 100644 --- a/src/main/helm/templates/_helpers.tpl +++ b/src/main/helm/templates/_helpers.tpl @@ -73,7 +73,7 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} {{- end -}} {{- end -}} -{{- define "app.grpc_client_vorgang_manager_address" -}} +{{- define "app.grpcClientVorgangManagerAddress" -}} {{ printf "dns:///%s.%s:9090" ( coalesce .Values.vorgangManagerName "vorgang-manager" ) .Release.Namespace | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end -}} @@ -85,6 +85,14 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} {{ printf "dns:///%s.%s:9000" ( coalesce .Values.usermanagerName "user-manager" ) .Release.Namespace }} {{- end -}} +{{- define "app.zufiNamespace" -}} +{{ printf "%s" ( required "zufiManager.namespace must be set if zufiManager server is enabled" (.Values.zufiManager).namespace ) }} +{{- end -}} + +{{- define "app.grpcClientZufiServerAddress" -}} +{{ printf "dns:///%s.%s:9090" .Values.zufiManager.serverName (include "app.zufiNamespace" . ) }} +{{- 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 -}} diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index 57682225e76d0e7f3d049de49ec1e08d9b66cc4e..6048e63b56257bb1b427aa53470d7733b203bff4 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -71,7 +71,7 @@ spec: - name: SERVICE_BINDING_ROOT value: "/bindings" - name: grpc_client_vorgang-manager_address - value: {{ include "app.grpc_client_vorgang_manager_address" . }} + value: {{ include "app.grpcClientVorgangManagerAddress" . }} - name: grpc_client_vorgang-manager_negotiationType value: {{ (.Values.vorgangManager).grpcClientNegotiationType | default "TLS" }} - name: grpc_client_user-manager_address @@ -113,10 +113,12 @@ spec: {{- end}} - name: ozgcloud_administration_address value: {{ include "app.spring_cloud_config_administration_address" . }} +{{- if ((.Values.ozgcloud).feature).collaborationEnabled }} - name: grpc_client_zufi-manager_address - value: {{ .Values.zufiManager.address }} + value: {{ include "app.grpcClientZufiServerAddress" . }} - name: grpc_client_zufi-manager_negotiationType value: {{ (.Values.zufiManager).grpcClientNegotiationType | default "TLS" }} +{{- end }} {{- if ((.Values.ozgcloud).feature).collaborationEnabled }} - name: ozgcloud_feature_collaborationEnabled value: {{ ((.Values.ozgcloud).feature).collaborationEnabled | quote }} diff --git a/src/main/helm/templates/network_policy.yaml b/src/main/helm/templates/network_policy.yaml index bbfd07c190fe4c849ba31161bdbfcc5ffc74a695..f1e383bf84bb7247521187b08ec2d3e58a02d265 100644 --- a/src/main/helm/templates/network_policy.yaml +++ b/src/main/helm/templates/network_policy.yaml @@ -56,7 +56,7 @@ spec: - to: - namespaceSelector: matchLabels: - kubernetes.io/metadata.name: {{ required "zufiManager.namespace must be set if zufiManager server is enabled" (.Values.zufiManager).namespace }} + kubernetes.io/metadata.name: {{ include "app.zufiNamespace" . }} podSelector: matchLabels: component: zufi-server diff --git a/src/main/helm/values.yaml b/src/main/helm/values.yaml index 1a13c1ebe2980adc97be000d735850ee5d59b900..f096912a363c18e1a932ffcc91401255a5366b6a 100644 --- a/src/main/helm/values.yaml +++ b/src/main/helm/values.yaml @@ -32,7 +32,7 @@ replicaCount: 2 # [default: 2] usermanagerName: user-manager zufiManager: - address: zufi-server.zufi:9090 + serverName: zufi-server # env: # overrideSpringProfiles: "oc,prod" diff --git a/src/test/helm-linter-values.yaml b/src/test/helm-linter-values.yaml index ef1e815825384e1a8704b3f950d4d753c94bf190..19666c081eeaac51667ffaf96c141145af63e042 100644 --- a/src/test/helm-linter-values.yaml +++ b/src/test/helm-linter-values.yaml @@ -40,4 +40,4 @@ sso: imagePullSecret: image-pull-secret zufiManager: - address: https://url.url \ No newline at end of file + namespace: namespace diff --git a/src/test/helm/deployment_collaboration_env_test.yaml b/src/test/helm/deployment_collaboration_env_test.yaml index ba02d181e1dc7319c84f18e0f999eb88b600d265..5c3f8cffca25edc716ec5b20a9e78bf1d36654c5 100644 --- a/src/test/helm/deployment_collaboration_env_test.yaml +++ b/src/test/helm/deployment_collaboration_env_test.yaml @@ -39,18 +39,30 @@ set: serverUrl: https://sso.company.local imagePullSecret: image-pull-secret tests: - - it: should have set zufi server address + - it: should set zufi server address set: zufiManager: - address: url://url.url + namespace: namespace + ozgcloud: + feature: + collaborationEnabled: true asserts: - contains: path: spec.template.spec.containers[0].env content: name: grpc_client_zufi-manager_address - value: url://url.url + value: dns:///zufi-server.namespace:9090 + - it: should not set zufi server address + asserts: + - notContains: + path: spec.template.spec.containers[0].env + content: + name: grpc_client_zufi-manager_address + any: true - it: should enable collaboration set: + zufiManager: + namespace: namespace ozgcloud: feature: collaborationEnabled: true @@ -61,10 +73,6 @@ tests: name: ozgcloud_feature_collaborationEnabled value: "true" - it: should not enable collaboration - set: - ozgcloud: - feature: - collaborationEnabled: false asserts: - notContains: path: spec.template.spec.containers[0].env @@ -74,7 +82,11 @@ tests: - it: should set negotiation type set: zufiManager: + namespace: namespace grpcClientNegotiationType: PLAINTEXT + ozgcloud: + feature: + collaborationEnabled: true asserts: - contains: path: spec.template.spec.containers[0].env @@ -83,9 +95,21 @@ tests: value: PLAINTEXT - it: negotiation type is TLS in standard set: + zufiManager: + namespace: namespace + ozgcloud: + feature: + collaborationEnabled: true asserts: - contains: path: spec.template.spec.containers[0].env content: name: grpc_client_zufi-manager_negotiationType - value: TLS \ No newline at end of file + value: TLS + - it: should not set negotiation type + asserts: + - notContains: + path: spec.template.spec.containers[0].env + content: + name: grpc_client_zufi-manager_negotiationType + any: true