From 93f43b988371f4d7c48fcc98cebb49d567f0f3cc Mon Sep 17 00:00:00 2001 From: "Dr. Christoph \"Schorsch\" Jung" Date: Fri, 10 May 2024 11:11:14 +0200 Subject: [PATCH] fix: get the charts to run sideways with the tx-connector chart in umbrellas. --- .../templates/NOTES.txt | 8 +- .../templates/_helpers.tpl | 88 +++++++++---------- .../templates/configmap-dataplane.yaml | 7 +- .../templates/deployment-dataplane.yaml | 60 ++++++------- .../templates/hpa-dataplane.yaml | 6 +- .../templates/ingress-dataplane.yaml | 6 +- .../templates/service-dataplane.yaml | 21 ++--- .../templates/serviceaccount.yaml | 4 +- .../tests/test-dataplane-readiness.yaml | 7 +- charts/agent-plane/templates/NOTES.txt | 8 +- charts/agent-plane/templates/_helpers.tpl | 88 +++++++++---------- .../templates/configmap-dataplane.yaml | 7 +- .../templates/deployment-dataplane.yaml | 60 ++++++------- .../agent-plane/templates/hpa-dataplane.yaml | 6 +- .../templates/ingress-dataplane.yaml | 6 +- .../templates/service-dataplane.yaml | 21 ++--- .../agent-plane/templates/serviceaccount.yaml | 4 +- .../tests/test-dataplane-readiness.yaml | 7 +- 18 files changed, 196 insertions(+), 218 deletions(-) diff --git a/charts/agent-plane-azure-vault/templates/NOTES.txt b/charts/agent-plane-azure-vault/templates/NOTES.txt index c0d295a6..ddd034b6 100644 --- a/charts/agent-plane-azure-vault/templates/NOTES.txt +++ b/charts/agent-plane-azure-vault/templates/NOTES.txt @@ -24,16 +24,16 @@ http{{ if .tls }}s{{ end }}://{{ .hostname }}{{ .path }} {{- end }} {{- else if contains "NodePort" $dataplane.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ $.Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "txdc.fullname" $ }}-{{ $dataplane.name }}) + export NODE_PORT=$(kubectl get --namespace {{ $.Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "txap.fullname" $ }}-{{ $dataplane.name }}) export NODE_IP=$(kubectl get nodes --namespace {{ $.Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" $dataplane.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ $.Release.Namespace }} svc -w {{ include "txdc.fullname" $ }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "txdc.fullname" $ }}-{{ $dataplane.name }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + You can watch the status of by running 'kubectl get --namespace {{ $.Release.Namespace }} svc -w {{ include "txap.fullname" $ }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "txap.fullname" $ }}-{{ $dataplane.name }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") echo http://$SERVICE_IP:{{ $dataplane.service.port }} {{- else if contains "ClusterIP" $dataplane.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ $.Release.Namespace }} -l "app.kubernetes.io/name={{ include "txdc.name" $ }}-{{ $dataplane.name }},app.kubernetes.io/instance={{ $.Release.Name }}-{{ $dataplane.name }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ $.Release.Namespace }} -l "app.kubernetes.io/name={{ include "txap.name" $ }}-{{ $dataplane.name }},app.kubernetes.io/instance={{ $.Release.Name }}-{{ $dataplane.name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ $.Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") kubectl --namespace {{ $.Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT echo "Visit http://127.0.0.1:8080 to use your application" diff --git a/charts/agent-plane-azure-vault/templates/_helpers.tpl b/charts/agent-plane-azure-vault/templates/_helpers.tpl index 55abab89..31e2678f 100644 --- a/charts/agent-plane-azure-vault/templates/_helpers.tpl +++ b/charts/agent-plane-azure-vault/templates/_helpers.tpl @@ -23,7 +23,7 @@ {{/* Expand the name of the chart. */}} -{{- define "txdc.name" -}} +{{- define "txap.name" -}} {{- default .Chart.Name .Values.nameOverride | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end }} @@ -32,7 +32,7 @@ Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). If release name contains chart name it will be used as a full name. */}} -{{- define "txdc.fullname" -}} +{{- define "txap.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -48,15 +48,15 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "txdc.chart" -}} +{{- define "txap.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Control Common labels */}} -{{- define "txdc.labels" -}} -helm.sh/chart: {{ include "txdc.chart" . }} +{{- define "txap.labels" -}} +helm.sh/chart: {{ include "txap.chart" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -66,9 +66,9 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Control Common labels */}} -{{- define "txdc.controlplane.labels" -}} -helm.sh/chart: {{ include "txdc.chart" . }} -{{ include "txdc.controlplane.selectorLabels" . }} +{{- define "txap.controlplane.labels" -}} +helm.sh/chart: {{ include "txap.chart" . }} +{{ include "txap.controlplane.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -80,13 +80,13 @@ app.kubernetes.io/part-of: edc {{/* Data Common labels (Expects the Chart Root to be accessible via .root, the current dataplane via .dataplane) */}} -{{- define "txdc.dataplane.labels" -}} -helm.sh/chart: {{ include "txdc.chart" .root }} -{{ include "txdc.dataplane.selectorLabels" . }} -{{- if .root.Chart.AppVersion }} -app.kubernetes.io/version: {{ .root.Chart.AppVersion | quote }} +{{- define "txap.dataplane.labels" -}} +helm.sh/chart: {{ include "txap.chart" . }} +{{ include "txap.dataplane.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} -app.kubernetes.io/managed-by: {{ .root.Release.Service }} +app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: edc-dataplane app.kubernetes.io/part-of: edc {{- end }} @@ -94,25 +94,25 @@ app.kubernetes.io/part-of: edc {{/* Control Selector labels */}} -{{- define "txdc.controlplane.selectorLabels" -}} -app.kubernetes.io/name: {{ include "txdc.name" . }}-controlplane +{{- define "txap.controlplane.selectorLabels" -}} +app.kubernetes.io/name: {{ include "txap.name" . }}-controlplane app.kubernetes.io/instance: {{ .Release.Name }}-controlplane {{- end }} {{/* Data Selector labels (Expects the Chart Root to be accessible via .root, the current dataplane via .dataplane) */}} -{{- define "txdc.dataplane.selectorLabels" -}} -app.kubernetes.io/name: {{ include "txdc.name" .root }}-{{ .dataplane.name }} -app.kubernetes.io/instance: {{ .root.Release.Name }}-{{ .dataplane.name }} +{{- define "txap.dataplane.selectorLabels" -}} +app.kubernetes.io/name: {{ include "txap.name" . }}-{{ .Values.name }} +app.kubernetes.io/instance: {{ .Release.Name }}-{{ .Values.name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "txdc.controlplane.serviceaccount.name" -}} +{{- define "txap.controlplane.serviceaccount.name" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "txdc.fullname" . ) .Values.serviceAccount.name }} +{{- default (include "txap.fullname" . ) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} @@ -121,9 +121,9 @@ Create the name of the service account to use {{/* Create the name of the service account to use */}} -{{- define "txdc.dataplane.serviceaccount.name" -}} +{{- define "txap.dataplane.serviceaccount.name" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "txdc.fullname" . ) .Values.serviceAccount.name }} +{{- default (include "txap.fullname" . ) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} @@ -132,7 +132,7 @@ Create the name of the service account to use {{/* Control DSP URL */}} -{{- define "txdc.controlplane.url.protocol" -}} +{{- define "txap.controlplane.url.protocol" -}} {{- if .Values.controlplane.url.protocol }}{{/* if dsp api url has been specified explicitly */}} {{- .Values.controlplane.url.protocol }} {{- else }}{{/* else when dsp api url has not been specified explicitly */}} @@ -144,7 +144,7 @@ Control DSP URL {{- printf "http://%s" .hostname -}} {{- end }}{{/* end if tls */}} {{- else }}{{/* else when ingress not enabled */}} -{{- printf "http://%s-controlplane:%v" ( include "txdc.fullname" $ ) $.Values.controlplane.endpoints.protocol.port -}} +{{- printf "http://%s-controlplane:%v" ( include "txap.fullname" $ ) .Values.controlplane.endpoints.protocol.port -}} {{- end }}{{/* end if ingress */}} {{- end }}{{/* end with ingress */}} {{- end }}{{/* end if .Values.controlplane.url.protocol */}} @@ -153,46 +153,44 @@ Control DSP URL {{/* Validation URL */}} -{{- define "txdc.controlplane.url.validation" -}} -{{- printf "http://%s-controlplane:%v%s/token" ( include "txdc.fullname" $ ) $.Values.controlplane.endpoints.control.port $.Values.controlplane.endpoints.control.path -}} +{{- define "txap.controlplane.url.validation" -}} +{{- printf "http://%s-controlplane:%v%s/token" ( include "txap.fullname" $ ) .Values.controlplane.endpoints.control.port .Values.controlplane.endpoints.control.path -}} {{- end }} {{/* Data Control URL (Expects the Chart Root to be accessible via .root, the current dataplane via .dataplane) */}} -{{- define "txdc.dataplane.url.control" -}} -{{- printf "http://%s-%s:%v%s" (include "txdc.fullname" .root ) .dataplane.name .dataplane.endpoints.control.port .dataplane.endpoints.control.path -}} +{{- define "txap.dataplane.url.signaling" -}} +{{- printf "http://%s-dataplane:%v%s" (include "txap.fullname" . ) .Values.endpoints.signaling.port .Values.endpoints.signaling.path -}} {{- end }} {{/* -Data Public URL (Expects the Chart Root to be accessible via .root, the current dataplane via .dataplane) +Data Public URL */}} -{{- define "txdc.dataplane.url.public" -}} -{{- $dataplane := .Values -}} -{{- $root := . -}} -{{- if $dataplane.url.public }}{{/* if public api url has been specified explicitly */}} -{{- $dataplane.url.public }} +{{- define "txap.agentplane.url.public" -}} +{{- if .Values.url.public }}{{/* if public api url has been specified explicitly */}} +{{- .Values.url.public }} {{- else }}{{/* else when public api url has not been specified explicitly */}} -{{- with (index $dataplane.ingresses 0) }} +{{- with (index .Values.ingresses 0) }} {{- if .enabled }}{{/* if ingress enabled */}} {{- if .tls.enabled }}{{/* if TLS enabled */}} -{{- printf "https://%s%s" .hostname $dataplane.endpoints.public.path -}} +{{- printf "https://%s%s" .hostname $.Values.endpoints.public.path -}} {{- else }}{{/* else when TLS not enabled */}} -{{- printf "http://%s%s" .hostname $dataplane.endpoints.public.path -}} +{{- printf "http://%s%s" .hostname $.Values.endpoints.public.path -}} {{- end }}{{/* end if tls */}} {{- else }}{{/* else when ingress not enabled */}} -{{- printf "http://%s-%s:%v%s" (include "txdc.fullname" $root ) $dataplane.name $dataplane.endpoints.public.port $dataplane.endpoints.public.path -}} +{{- printf "http://%s-dataplane:%v%s" (include "txdc.fullname" . ) $.Values.endpoints.public.port $.Values.endpoints.public.path -}} {{- end }}{{/* end if ingress */}} {{- end }}{{/* end with ingress */}} -{{- end }}{{/* end if .url.public */}} +{{- end }}{{/* end if .Values.url.public */}} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "txdc.serviceAccountName" -}} +{{- define "txap.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "txdc.fullname" .) .Values.serviceAccount.name }} +{{- default (include "txap.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} @@ -202,10 +200,10 @@ Create the name of the service account to use {{/* join a map */}} -{{- define "txdc.remotes" -}} +{{- define "txap.remotes" -}} {{- $res := dict "servers" (list) -}} {{- range $bpn, $connector := .Values.agent.connectors -}} -{{- $noop := printf "$s=%s" $bpn $connector | append $res.servers | set $res "servers" -}} +{{- $noop := printf "%s=%s" $bpn $connector | append $res.servers | set $res "servers" -}} {{- end -}} -{{- join "," $res.servers -}} +{{- join "," $res.servers }} {{- end -}} diff --git a/charts/agent-plane-azure-vault/templates/configmap-dataplane.yaml b/charts/agent-plane-azure-vault/templates/configmap-dataplane.yaml index 18068775..e85ddbd8 100644 --- a/charts/agent-plane-azure-vault/templates/configmap-dataplane.yaml +++ b/charts/agent-plane-azure-vault/templates/configmap-dataplane.yaml @@ -1,4 +1,3 @@ -{{ $root := . }} {{ $dataplane_name := .Values.name }} {{ $dataplane := .Values }} --- @@ -25,10 +24,10 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "txdc.fullname" $root }}-{{- $dataplane_name }} - namespace: {{ $root.Release.Namespace | default "default" | quote }} + name: {{ include "txap.fullname" . }}-{{- $dataplane_name }} + namespace: {{ .Release.Namespace | default "default" | quote }} labels: - {{- include "txdc.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} + {{- include "txap.dataplane.labels" . | nindent 4 }} data: opentelemetry.properties: |- {{- $dataplane.opentelemetry | nindent 4 }} diff --git a/charts/agent-plane-azure-vault/templates/deployment-dataplane.yaml b/charts/agent-plane-azure-vault/templates/deployment-dataplane.yaml index e9eaf243..0b50c622 100644 --- a/charts/agent-plane-azure-vault/templates/deployment-dataplane.yaml +++ b/charts/agent-plane-azure-vault/templates/deployment-dataplane.yaml @@ -1,4 +1,3 @@ -{{ $root := . }} {{ $dataplane_name := .Values.name }} {{ $dataplane := .Values }} --- @@ -27,16 +26,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "txdc.fullname" $root }}-{{ $dataplane.name }} + name: {{ include "txap.fullname" . }}-{{ $dataplane.name }} labels: - {{- include "txdc.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} + {{- include "txap.dataplane.labels" . | nindent 4 }} spec: {{- if not $dataplane.autoscaling.enabled }} replicas: {{ $dataplane.replicaCount }} {{- end }} selector: matchLabels: - {{- include "txdc.dataplane.selectorLabels" (dict "dataplane" $dataplane "root" $root) | nindent 6 }} + {{- include "txap.dataplane.selectorLabels" . | nindent 6 }} template: metadata: {{- with $dataplane.podAnnotations }} @@ -44,28 +43,28 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "txdc.dataplane.selectorLabels" (dict "dataplane" $dataplane "root" $root) | nindent 8 }} + {{- include "txap.dataplane.selectorLabels" . | nindent 8 }} {{- with $dataplane.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} spec: - {{- with $root.Values.imagePullSecrets }} + {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "txdc.serviceAccountName" $root }} + serviceAccountName: {{ include "txap.serviceAccountName" . }} securityContext: {{- toYaml $dataplane.podSecurityContext | nindent 8 }} initContainers: {{- toYaml $dataplane.initContainers | nindent 8 }} containers: - - name: {{ $root.Chart.Name }} + - name: {{ .Chart.Name }} securityContext: {{- toYaml $dataplane.securityContext | nindent 12 }} {{- if $dataplane.image.repository }} - image: "{{ $dataplane.image.repository }}:{{ $dataplane.image.tag | default $root.Chart.AppVersion }}" + image: "{{ $dataplane.image.repository }}:{{ $dataplane.image.tag | default .Chart.AppVersion }}" {{- else }} - image: "{{ $root.Values.imageRegistry }}tractusx/agentplane-azure-vault:{{ $dataplane.image.tag | default $root.Chart.AppVersion }}" + image: "{{ .Values.imageRegistry }}tractusx/agentplane-azure-vault:{{ $dataplane.image.tag | default .Chart.AppVersion }}" {{- end }} imagePullPolicy: {{ $dataplane.image.pullPolicy }} ports: @@ -117,7 +116,7 @@ spec: value: {{ .Values.participant.id | required ".Values.participant.id is required" | quote }} - name: "EDC_IAM_ISSUER_ID" value: {{ .Values.iatp.id | required ".Values.iatp.id is required" | quote}} - + ####### # API # ####### @@ -142,7 +141,7 @@ spec: value: {{ $dataplane.endpoints.callback.path | quote }} - name: "EDC_DATAPLANE_TOKEN_VALIDATION_ENDPOINT" - value: {{ include "txdc.controlplane.url.validation" $root}} + value: {{ include "txap.controlplane.url.validation" .}} ########### ## VAULT ## @@ -183,7 +182,7 @@ spec: value: {{ $dataplane.token.refresh.refresh_endpoint }} {{- else}} - name: "EDC_DATAPLANE_TOKEN_REFRESH_ENDPOINT" - value: {{ include "txdc.dataplane.url.public" . }}/token + value: {{ include "txap.agentplane.url.public" . }}/token {{- end}} - name: "EDC_TRANSFER_PROXY_TOKEN_SIGNER_PRIVATEKEY_ALIAS" @@ -196,7 +195,7 @@ spec: # AUTH (JWT) # ################### {{- if $dataplane.auth }} - {{- range $auth, $authDef := $dataplane.auth }} + {{- range $auth, $authDef := $dataplane.auth }} - name: {{ printf "TRACTUSX_AUTH_%s_TYPE" (upper $auth) | quote }} value: {{ $authDef.type | required "Authentication Service needs a type" | quote }} - name: {{ printf "TRACTUSX_AUTH_%s_PATHS" (upper $auth) | quote }} @@ -209,19 +208,19 @@ spec: - name: {{ printf "TRACTUSX_AUTH_%s_REGISTER" (upper $auth) | quote }} value: {{ $authDef.register | quote }} {{- end }} - {{- if $authDef.apiCode }} + {{- if $authDef.apiCode }} - name: {{ printf "TRACTUSX_AUTH_%s_APICODE" (upper $auth) | quote }} value: {{ $authDef.apiCode | quote }} {{- end }} - {{- if $authDef.vaultKey }} + {{- if $authDef.vaultKey }} - name: {{ printf "TRACTUSX_AUTH_%s_VAULTKEY" (upper $auth) | quote }} value: {{ $authDef.vaultKey | quote }} {{- end }} - {{- if $authDef.publicKey }} + {{- if $authDef.publicKey }} - name: {{ printf "TRACTUSX_AUTH_%s_PUBLICKEY" (upper $auth) | quote }} value: {{ $authDef.publicKey | quote }} {{- end }} - {{- if $authDef.checkExpiry }} + {{- if $authDef.checkExpiry }} - name: {{ printf "TRACTUSX_AUTH_%s_CHECKEXPIRY" (upper $auth) | quote }} value: {{ $authDef.checkExpiry | quote }} {{- end }} @@ -239,26 +238,26 @@ spec: value: {{ .Values.iatp.sts.oauth.client.secret_alias | required ".Values.iatp.sts.oauth.client.secret_alias is required" | quote}} - name: "EDC_IAM_STS_DIM_URL" value: {{ .Values.iatp.sts.dim.url | required ".Values.iatp.sts.dim.url is required" | quote}} - {{- range $key, $value := .Values.iatp.trustedIssuers }} - - name: {{- printf "EDC_IAM_TRUSTED-ISSUER_%s_ID" (upper $key) | quote }} - value: {{- $value | quote }} - {{- end }} + {{- range $index, $issuer := .Values.iatp.trustedIssuers }} + - name: "EDC_IAM_TRUSTED-ISSUER_{{$index}}-ISSUER_ID" + value: {{ $issuer | quote }} + {{- end }} ######################### ## DATA PLANE PUBLIC API ######################## - name: "EDC_DATAPLANE_API_PUBLIC_BASEURL" - value: {{ include "txdc.dataplane.url.public" . }} + value: {{ include "txap.agentplane.url.public" . }} ################### # AGENT CALLBACK # ################### - name: "CX_AGENT_CALLBACK" - value: {{ printf "http://%s-%s:%v%s/transfer-process-started" ( include "txdc.fullname" $root ) $dataplane.name $dataplane.endpoints.callback.port $dataplane.endpoints.callback.path | quote }} + value: {{ printf "http://%s-%s:%v%s/transfer-process-started" ( include "txap.fullname" . ) $dataplane.name $dataplane.endpoints.callback.port $dataplane.endpoints.callback.path | quote }} - name: "CX_AGENT_CONTROLPLANE_PROTOCOL" - value: {{ printf "http://%s-controlplane:%v" ( include "txdc.fullname" $root ) $root.Values.controlplane.endpoints.protocol.port | quote }} + value: {{ printf "http://%s-controlplane:%v" ( include "txap.fullname" . ) .Values.controlplane.endpoints.protocol.port | quote }} - name: "CX_AGENT_CONTROLPLANE_MANAGEMENT" - value: {{ printf "http://%s-controlplane:%v%s" ( include "txdc.fullname" $root ) $root.Values.controlplane.endpoints.management.port $root.Values.controlplane.endpoints.management.path | quote }} + value: {{ printf "http://%s-controlplane:%v%s" ( include "txap.fullname" . ) .Values.controlplane.endpoints.management.port .Values.controlplane.endpoints.management.path | quote }} {{- if $dataplane.agent.matchmaking }} - name: "CX_AGENT_MATCHMAKING" @@ -278,7 +277,6 @@ spec: value: {{ join "," $dataplane.agent.default | quote }} {{- end }} - {{- if $dataplane.agent.services }} ################### # AGENT SERVICES # @@ -307,7 +305,7 @@ spec: # AGENT SYNC # ################### - name: "CX_AGENT_DATASPACE_REMOTES" - value: {{- include "txdc.remotes" . }} + value: {{ include "txap.remotes" . }} - name: "CX_AGENT_DATASPACE_SYNCHRONIZATION" value: {{ $dataplane.agent.synchronization | required (printf ".Values.dataplane.%s.agent.synchronization should be set if connectors are specified" $dataplane_name) | quote }} - name: "CX_AGENT_FEDERATION_BATCH_MAX" @@ -367,7 +365,7 @@ spec: ## Additional environment variables ## ###################################### - name: "EDC_CONNECTOR_NAME" - value: {{ include "txdc.fullname" $root}}-{{ $dataplane.name }} + value: {{ include "txap.fullname" .}}-{{ $dataplane.name }} {{- range $key, $value := $dataplane.envValueFrom }} - name: {{ $key | quote }} valueFrom: @@ -406,7 +404,7 @@ spec: volumes: - name: "configuration" configMap: - name: {{ include "txdc.fullname" $root }}-{{ $dataplane_name }} + name: {{ include "txap.fullname" . }}-{{ $dataplane_name }} items: - key: "opentelemetry.properties" path: "opentelemetry.properties" @@ -429,4 +427,4 @@ spec: {{- with $dataplane.tolerations }} tolerations: {{- toYaml . | nindent 8 }} - {{- end }} \ No newline at end of file + {{- end }} diff --git a/charts/agent-plane-azure-vault/templates/hpa-dataplane.yaml b/charts/agent-plane-azure-vault/templates/hpa-dataplane.yaml index 5d74ae5c..bd8acaee 100644 --- a/charts/agent-plane-azure-vault/templates/hpa-dataplane.yaml +++ b/charts/agent-plane-azure-vault/templates/hpa-dataplane.yaml @@ -28,14 +28,14 @@ apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: - name: {{ include "txdc.fullname" $root }}-{{ $dataplane.name }} + name: {{ include "txap.fullname" $root }}-{{ $dataplane.name }} labels: - {{- include "txdc.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} + {{- include "txap.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ include "txdc.fullname" $root }}-{{ $dataplane.name }} + name: {{ include "txap.fullname" $root }}-{{ $dataplane.name }} minReplicas: {{ $dataplane.autoscaling.minReplicas }} maxReplicas: {{ $dataplane.autoscaling.maxReplicas }} metrics: diff --git a/charts/agent-plane-azure-vault/templates/ingress-dataplane.yaml b/charts/agent-plane-azure-vault/templates/ingress-dataplane.yaml index 4965796b..cb7955af 100644 --- a/charts/agent-plane-azure-vault/templates/ingress-dataplane.yaml +++ b/charts/agent-plane-azure-vault/templates/ingress-dataplane.yaml @@ -1,12 +1,10 @@ -{{- $fullName := include "txdc.fullname" . }} +{{- $fullName := include "txap.fullname" . }} {{- $gitVersion := .Capabilities.KubeVersion.GitVersion }} {{- $namespace := .Release.Namespace }} {{ $dataplane_name := .Values.name }} {{ $dataplane := .Values }} -{{ $root := . }} {{- $dataEdcEndpoints := $dataplane.endpoints }} -{{- $dataLabels := include "txdc.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} - +{{- $dataLabels := include "txap.dataplane.labels" . | nindent 4 }} {{- range $dataplane.ingresses }} {{- if and .enabled .endpoints }} {{- $dataIngressName := printf "%s-%s-%s" $fullName $dataplane.name .hostname }} diff --git a/charts/agent-plane-azure-vault/templates/service-dataplane.yaml b/charts/agent-plane-azure-vault/templates/service-dataplane.yaml index c543d252..7ddacef7 100644 --- a/charts/agent-plane-azure-vault/templates/service-dataplane.yaml +++ b/charts/agent-plane-azure-vault/templates/service-dataplane.yaml @@ -1,6 +1,3 @@ -{{ $root := . }} -{{ $dataplane_name := .Values.name }} -{{ $dataplane := .Values }} --- # # Copyright (c) 2024 T-Systems International GmbH @@ -24,28 +21,28 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "txdc.fullname" $root }}-{{ $dataplane.name }} - namespace: {{ $root.Release.Namespace | default "default" | quote }} + name: {{ include "txap.fullname" . }}-{{ .Values.name }} + namespace: {{.Release.Namespace | default "default" | quote }} labels: - {{- include "txdc.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} + {{- include "txap.dataplane.labels" . | nindent 4 }} spec: - type: {{ $dataplane.service.type }} + type: {{ .Values.service.type }} ports: - - port: {{ $dataplane.endpoints.default.port }} + - port: {{ .Values.endpoints.default.port }} targetPort: default protocol: TCP name: default - - port: {{ $dataplane.endpoints.signaling.port }} + - port: {{ .Values.endpoints.signaling.port }} targetPort: control protocol: TCP name: signaling - - port: {{ $dataplane.endpoints.public.port }} + - port: {{ .Values.endpoints.public.port }} targetPort: public protocol: TCP name: public - - port: {{ $dataplane.endpoints.callback.port }} + - port: {{ .Values.endpoints.callback.port }} targetPort: callback protocol: TCP name: callback selector: - {{- include "txdc.dataplane.selectorLabels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} \ No newline at end of file + {{- include "txap.dataplane.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/charts/agent-plane-azure-vault/templates/serviceaccount.yaml b/charts/agent-plane-azure-vault/templates/serviceaccount.yaml index 6d21ddc3..f3c5fecf 100644 --- a/charts/agent-plane-azure-vault/templates/serviceaccount.yaml +++ b/charts/agent-plane-azure-vault/templates/serviceaccount.yaml @@ -25,9 +25,9 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "txdc.serviceAccountName" . }} + name: {{ include "txap.serviceAccountName" . }} labels: - {{- include "txdc.labels" . | nindent 4 }} + {{- include "txap.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/agent-plane-azure-vault/templates/tests/test-dataplane-readiness.yaml b/charts/agent-plane-azure-vault/templates/tests/test-dataplane-readiness.yaml index 5aa323d9..7fa5ba0d 100644 --- a/charts/agent-plane-azure-vault/templates/tests/test-dataplane-readiness.yaml +++ b/charts/agent-plane-azure-vault/templates/tests/test-dataplane-readiness.yaml @@ -16,16 +16,15 @@ # # SPDX-License-Identifier: Apache-2.0 # -{{ $root := . }} {{ $dataplane_name := .Values.name }} {{ $dataplane := .Values }} --- apiVersion: v1 kind: Pod metadata: - name: "{{include "txdc.fullname" .}}test-dataplane-readiness" + name: "{{include "txap.fullname" .}}test-dataplane-readiness" labels: - {{- include "txdc.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} + {{- include "txap.dataplane.labels" . | nindent 4 }} annotations: "helm.sh/hook": test "helm.sh/hook-delete-policy": {{ .Values.tests.hookDeletePolicy }} @@ -34,5 +33,5 @@ spec: - name: wget image: curlimages/curl command: [ '/bin/sh','-c' ] - args: [ {{- printf "curl http://%s-%s:%v%s/check/readiness" (include "txdc.fullname" $root ) $dataplane.name $dataplane.endpoints.default.port $dataplane.endpoints.default.path | quote }} ] + args: [ {{- printf "curl http://%s-%s:%v%s/check/readiness" (include "txap.fullname" . ) $dataplane.name $dataplane.endpoints.default.port $dataplane.endpoints.default.path | quote }} ] restartPolicy: Never diff --git a/charts/agent-plane/templates/NOTES.txt b/charts/agent-plane/templates/NOTES.txt index c0d295a6..ddd034b6 100644 --- a/charts/agent-plane/templates/NOTES.txt +++ b/charts/agent-plane/templates/NOTES.txt @@ -24,16 +24,16 @@ http{{ if .tls }}s{{ end }}://{{ .hostname }}{{ .path }} {{- end }} {{- else if contains "NodePort" $dataplane.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ $.Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "txdc.fullname" $ }}-{{ $dataplane.name }}) + export NODE_PORT=$(kubectl get --namespace {{ $.Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "txap.fullname" $ }}-{{ $dataplane.name }}) export NODE_IP=$(kubectl get nodes --namespace {{ $.Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" $dataplane.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ $.Release.Namespace }} svc -w {{ include "txdc.fullname" $ }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "txdc.fullname" $ }}-{{ $dataplane.name }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + You can watch the status of by running 'kubectl get --namespace {{ $.Release.Namespace }} svc -w {{ include "txap.fullname" $ }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "txap.fullname" $ }}-{{ $dataplane.name }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") echo http://$SERVICE_IP:{{ $dataplane.service.port }} {{- else if contains "ClusterIP" $dataplane.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ $.Release.Namespace }} -l "app.kubernetes.io/name={{ include "txdc.name" $ }}-{{ $dataplane.name }},app.kubernetes.io/instance={{ $.Release.Name }}-{{ $dataplane.name }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ $.Release.Namespace }} -l "app.kubernetes.io/name={{ include "txap.name" $ }}-{{ $dataplane.name }},app.kubernetes.io/instance={{ $.Release.Name }}-{{ $dataplane.name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ $.Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") kubectl --namespace {{ $.Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT echo "Visit http://127.0.0.1:8080 to use your application" diff --git a/charts/agent-plane/templates/_helpers.tpl b/charts/agent-plane/templates/_helpers.tpl index 55abab89..31e2678f 100644 --- a/charts/agent-plane/templates/_helpers.tpl +++ b/charts/agent-plane/templates/_helpers.tpl @@ -23,7 +23,7 @@ {{/* Expand the name of the chart. */}} -{{- define "txdc.name" -}} +{{- define "txap.name" -}} {{- default .Chart.Name .Values.nameOverride | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end }} @@ -32,7 +32,7 @@ Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). If release name contains chart name it will be used as a full name. */}} -{{- define "txdc.fullname" -}} +{{- define "txap.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -48,15 +48,15 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "txdc.chart" -}} +{{- define "txap.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Control Common labels */}} -{{- define "txdc.labels" -}} -helm.sh/chart: {{ include "txdc.chart" . }} +{{- define "txap.labels" -}} +helm.sh/chart: {{ include "txap.chart" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -66,9 +66,9 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Control Common labels */}} -{{- define "txdc.controlplane.labels" -}} -helm.sh/chart: {{ include "txdc.chart" . }} -{{ include "txdc.controlplane.selectorLabels" . }} +{{- define "txap.controlplane.labels" -}} +helm.sh/chart: {{ include "txap.chart" . }} +{{ include "txap.controlplane.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -80,13 +80,13 @@ app.kubernetes.io/part-of: edc {{/* Data Common labels (Expects the Chart Root to be accessible via .root, the current dataplane via .dataplane) */}} -{{- define "txdc.dataplane.labels" -}} -helm.sh/chart: {{ include "txdc.chart" .root }} -{{ include "txdc.dataplane.selectorLabels" . }} -{{- if .root.Chart.AppVersion }} -app.kubernetes.io/version: {{ .root.Chart.AppVersion | quote }} +{{- define "txap.dataplane.labels" -}} +helm.sh/chart: {{ include "txap.chart" . }} +{{ include "txap.dataplane.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} -app.kubernetes.io/managed-by: {{ .root.Release.Service }} +app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: edc-dataplane app.kubernetes.io/part-of: edc {{- end }} @@ -94,25 +94,25 @@ app.kubernetes.io/part-of: edc {{/* Control Selector labels */}} -{{- define "txdc.controlplane.selectorLabels" -}} -app.kubernetes.io/name: {{ include "txdc.name" . }}-controlplane +{{- define "txap.controlplane.selectorLabels" -}} +app.kubernetes.io/name: {{ include "txap.name" . }}-controlplane app.kubernetes.io/instance: {{ .Release.Name }}-controlplane {{- end }} {{/* Data Selector labels (Expects the Chart Root to be accessible via .root, the current dataplane via .dataplane) */}} -{{- define "txdc.dataplane.selectorLabels" -}} -app.kubernetes.io/name: {{ include "txdc.name" .root }}-{{ .dataplane.name }} -app.kubernetes.io/instance: {{ .root.Release.Name }}-{{ .dataplane.name }} +{{- define "txap.dataplane.selectorLabels" -}} +app.kubernetes.io/name: {{ include "txap.name" . }}-{{ .Values.name }} +app.kubernetes.io/instance: {{ .Release.Name }}-{{ .Values.name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "txdc.controlplane.serviceaccount.name" -}} +{{- define "txap.controlplane.serviceaccount.name" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "txdc.fullname" . ) .Values.serviceAccount.name }} +{{- default (include "txap.fullname" . ) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} @@ -121,9 +121,9 @@ Create the name of the service account to use {{/* Create the name of the service account to use */}} -{{- define "txdc.dataplane.serviceaccount.name" -}} +{{- define "txap.dataplane.serviceaccount.name" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "txdc.fullname" . ) .Values.serviceAccount.name }} +{{- default (include "txap.fullname" . ) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} @@ -132,7 +132,7 @@ Create the name of the service account to use {{/* Control DSP URL */}} -{{- define "txdc.controlplane.url.protocol" -}} +{{- define "txap.controlplane.url.protocol" -}} {{- if .Values.controlplane.url.protocol }}{{/* if dsp api url has been specified explicitly */}} {{- .Values.controlplane.url.protocol }} {{- else }}{{/* else when dsp api url has not been specified explicitly */}} @@ -144,7 +144,7 @@ Control DSP URL {{- printf "http://%s" .hostname -}} {{- end }}{{/* end if tls */}} {{- else }}{{/* else when ingress not enabled */}} -{{- printf "http://%s-controlplane:%v" ( include "txdc.fullname" $ ) $.Values.controlplane.endpoints.protocol.port -}} +{{- printf "http://%s-controlplane:%v" ( include "txap.fullname" $ ) .Values.controlplane.endpoints.protocol.port -}} {{- end }}{{/* end if ingress */}} {{- end }}{{/* end with ingress */}} {{- end }}{{/* end if .Values.controlplane.url.protocol */}} @@ -153,46 +153,44 @@ Control DSP URL {{/* Validation URL */}} -{{- define "txdc.controlplane.url.validation" -}} -{{- printf "http://%s-controlplane:%v%s/token" ( include "txdc.fullname" $ ) $.Values.controlplane.endpoints.control.port $.Values.controlplane.endpoints.control.path -}} +{{- define "txap.controlplane.url.validation" -}} +{{- printf "http://%s-controlplane:%v%s/token" ( include "txap.fullname" $ ) .Values.controlplane.endpoints.control.port .Values.controlplane.endpoints.control.path -}} {{- end }} {{/* Data Control URL (Expects the Chart Root to be accessible via .root, the current dataplane via .dataplane) */}} -{{- define "txdc.dataplane.url.control" -}} -{{- printf "http://%s-%s:%v%s" (include "txdc.fullname" .root ) .dataplane.name .dataplane.endpoints.control.port .dataplane.endpoints.control.path -}} +{{- define "txap.dataplane.url.signaling" -}} +{{- printf "http://%s-dataplane:%v%s" (include "txap.fullname" . ) .Values.endpoints.signaling.port .Values.endpoints.signaling.path -}} {{- end }} {{/* -Data Public URL (Expects the Chart Root to be accessible via .root, the current dataplane via .dataplane) +Data Public URL */}} -{{- define "txdc.dataplane.url.public" -}} -{{- $dataplane := .Values -}} -{{- $root := . -}} -{{- if $dataplane.url.public }}{{/* if public api url has been specified explicitly */}} -{{- $dataplane.url.public }} +{{- define "txap.agentplane.url.public" -}} +{{- if .Values.url.public }}{{/* if public api url has been specified explicitly */}} +{{- .Values.url.public }} {{- else }}{{/* else when public api url has not been specified explicitly */}} -{{- with (index $dataplane.ingresses 0) }} +{{- with (index .Values.ingresses 0) }} {{- if .enabled }}{{/* if ingress enabled */}} {{- if .tls.enabled }}{{/* if TLS enabled */}} -{{- printf "https://%s%s" .hostname $dataplane.endpoints.public.path -}} +{{- printf "https://%s%s" .hostname $.Values.endpoints.public.path -}} {{- else }}{{/* else when TLS not enabled */}} -{{- printf "http://%s%s" .hostname $dataplane.endpoints.public.path -}} +{{- printf "http://%s%s" .hostname $.Values.endpoints.public.path -}} {{- end }}{{/* end if tls */}} {{- else }}{{/* else when ingress not enabled */}} -{{- printf "http://%s-%s:%v%s" (include "txdc.fullname" $root ) $dataplane.name $dataplane.endpoints.public.port $dataplane.endpoints.public.path -}} +{{- printf "http://%s-dataplane:%v%s" (include "txdc.fullname" . ) $.Values.endpoints.public.port $.Values.endpoints.public.path -}} {{- end }}{{/* end if ingress */}} {{- end }}{{/* end with ingress */}} -{{- end }}{{/* end if .url.public */}} +{{- end }}{{/* end if .Values.url.public */}} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "txdc.serviceAccountName" -}} +{{- define "txap.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "txdc.fullname" .) .Values.serviceAccount.name }} +{{- default (include "txap.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} @@ -202,10 +200,10 @@ Create the name of the service account to use {{/* join a map */}} -{{- define "txdc.remotes" -}} +{{- define "txap.remotes" -}} {{- $res := dict "servers" (list) -}} {{- range $bpn, $connector := .Values.agent.connectors -}} -{{- $noop := printf "$s=%s" $bpn $connector | append $res.servers | set $res "servers" -}} +{{- $noop := printf "%s=%s" $bpn $connector | append $res.servers | set $res "servers" -}} {{- end -}} -{{- join "," $res.servers -}} +{{- join "," $res.servers }} {{- end -}} diff --git a/charts/agent-plane/templates/configmap-dataplane.yaml b/charts/agent-plane/templates/configmap-dataplane.yaml index 18068775..e85ddbd8 100644 --- a/charts/agent-plane/templates/configmap-dataplane.yaml +++ b/charts/agent-plane/templates/configmap-dataplane.yaml @@ -1,4 +1,3 @@ -{{ $root := . }} {{ $dataplane_name := .Values.name }} {{ $dataplane := .Values }} --- @@ -25,10 +24,10 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "txdc.fullname" $root }}-{{- $dataplane_name }} - namespace: {{ $root.Release.Namespace | default "default" | quote }} + name: {{ include "txap.fullname" . }}-{{- $dataplane_name }} + namespace: {{ .Release.Namespace | default "default" | quote }} labels: - {{- include "txdc.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} + {{- include "txap.dataplane.labels" . | nindent 4 }} data: opentelemetry.properties: |- {{- $dataplane.opentelemetry | nindent 4 }} diff --git a/charts/agent-plane/templates/deployment-dataplane.yaml b/charts/agent-plane/templates/deployment-dataplane.yaml index 516466db..97e9608a 100644 --- a/charts/agent-plane/templates/deployment-dataplane.yaml +++ b/charts/agent-plane/templates/deployment-dataplane.yaml @@ -1,4 +1,3 @@ -{{ $root := . }} {{ $dataplane_name := .Values.name }} {{ $dataplane := .Values }} --- @@ -27,16 +26,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "txdc.fullname" $root }}-{{ $dataplane.name }} + name: {{ include "txap.fullname" . }}-{{ $dataplane.name }} labels: - {{- include "txdc.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} + {{- include "txap.dataplane.labels" . | nindent 4 }} spec: {{- if not $dataplane.autoscaling.enabled }} replicas: {{ $dataplane.replicaCount }} {{- end }} selector: matchLabels: - {{- include "txdc.dataplane.selectorLabels" (dict "dataplane" $dataplane "root" $root) | nindent 6 }} + {{- include "txap.dataplane.selectorLabels" . | nindent 6 }} template: metadata: {{- with $dataplane.podAnnotations }} @@ -44,28 +43,28 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "txdc.dataplane.selectorLabels" (dict "dataplane" $dataplane "root" $root) | nindent 8 }} + {{- include "txap.dataplane.selectorLabels" . | nindent 8 }} {{- with $dataplane.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} spec: - {{- with $root.Values.imagePullSecrets }} + {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "txdc.serviceAccountName" $root }} + serviceAccountName: {{ include "txap.serviceAccountName" . }} securityContext: {{- toYaml $dataplane.podSecurityContext | nindent 8 }} initContainers: {{- toYaml $dataplane.initContainers | nindent 8 }} containers: - - name: {{ $root.Chart.Name }} + - name: {{ .Chart.Name }} securityContext: {{- toYaml $dataplane.securityContext | nindent 12 }} {{- if $dataplane.image.repository }} - image: "{{ $dataplane.image.repository }}:{{ $dataplane.image.tag | default $root.Chart.AppVersion }}" + image: "{{ $dataplane.image.repository }}:{{ $dataplane.image.tag | default .Chart.AppVersion }}" {{- else }} - image: "{{ $root.Values.imageRegistry }}tractusx/agentplane-hashicorp:{{ $dataplane.image.tag | default $root.Chart.AppVersion }}" + image: "{{ .Values.imageRegistry }}tractusx/agentplane-hashicorp:{{ $dataplane.image.tag | default $root.Chart.AppVersion }}" {{- end }} imagePullPolicy: {{ $dataplane.image.pullPolicy }} ports: @@ -117,7 +116,7 @@ spec: value: {{ .Values.participant.id | required ".Values.participant.id is required" | quote }} - name: "EDC_IAM_ISSUER_ID" value: {{ .Values.iatp.id | required ".Values.iatp.id is required" | quote}} - + ####### # API # ####### @@ -142,7 +141,7 @@ spec: value: {{ $dataplane.endpoints.callback.path | quote }} - name: "EDC_DATAPLANE_TOKEN_VALIDATION_ENDPOINT" - value: {{ include "txdc.controlplane.url.validation" $root}} + value: {{ include "txap.controlplane.url.validation" .}} ########### ## VAULT ## @@ -182,7 +181,7 @@ spec: value: {{ $dataplane.token.refresh.refresh_endpoint }} {{- else}} - name: "EDC_DATAPLANE_TOKEN_REFRESH_ENDPOINT" - value: {{ include "txdc.dataplane.url.public" . }}/token + value: {{ include "txap.agentplane.url.public" . }}/token {{- end}} - name: "EDC_TRANSFER_PROXY_TOKEN_SIGNER_PRIVATEKEY_ALIAS" @@ -195,7 +194,7 @@ spec: # AUTH (JWT) # ################### {{- if $dataplane.auth }} - {{- range $auth, $authDef := $dataplane.auth }} + {{- range $auth, $authDef := $dataplane.auth }} - name: {{ printf "TRACTUSX_AUTH_%s_TYPE" (upper $auth) | quote }} value: {{ $authDef.type | required "Authentication Service needs a type" | quote }} - name: {{ printf "TRACTUSX_AUTH_%s_PATHS" (upper $auth) | quote }} @@ -208,19 +207,19 @@ spec: - name: {{ printf "TRACTUSX_AUTH_%s_REGISTER" (upper $auth) | quote }} value: {{ $authDef.register | quote }} {{- end }} - {{- if $authDef.apiCode }} + {{- if $authDef.apiCode }} - name: {{ printf "TRACTUSX_AUTH_%s_APICODE" (upper $auth) | quote }} value: {{ $authDef.apiCode | quote }} {{- end }} - {{- if $authDef.vaultKey }} + {{- if $authDef.vaultKey }} - name: {{ printf "TRACTUSX_AUTH_%s_VAULTKEY" (upper $auth) | quote }} value: {{ $authDef.vaultKey | quote }} {{- end }} - {{- if $authDef.publicKey }} + {{- if $authDef.publicKey }} - name: {{ printf "TRACTUSX_AUTH_%s_PUBLICKEY" (upper $auth) | quote }} value: {{ $authDef.publicKey | quote }} {{- end }} - {{- if $authDef.checkExpiry }} + {{- if $authDef.checkExpiry }} - name: {{ printf "TRACTUSX_AUTH_%s_CHECKEXPIRY" (upper $auth) | quote }} value: {{ $authDef.checkExpiry | quote }} {{- end }} @@ -238,26 +237,26 @@ spec: value: {{ .Values.iatp.sts.oauth.client.secret_alias | required ".Values.iatp.sts.oauth.client.secret_alias is required" | quote}} - name: "EDC_IAM_STS_DIM_URL" value: {{ .Values.iatp.sts.dim.url | required ".Values.iatp.sts.dim.url is required" | quote}} - {{- range $key, $value := .Values.iatp.trustedIssuers }} - - name: {{- printf "EDC_IAM_TRUSTED-ISSUER_%s_ID" (upper $key) | quote }} - value: {{- $value | quote }} - {{- end }} + {{- range $index, $issuer := .Values.iatp.trustedIssuers }} + - name: "EDC_IAM_TRUSTED-ISSUER_{{$index}}-ISSUER_ID" + value: {{ $issuer | quote }} + {{- end }} ######################### ## DATA PLANE PUBLIC API ######################## - name: "EDC_DATAPLANE_API_PUBLIC_BASEURL" - value: {{ include "txdc.dataplane.url.public" . }} + value: {{ include "txap.agentplane.url.public" . }} ################### # AGENT CALLBACK # ################### - name: "CX_AGENT_CALLBACK" - value: {{ printf "http://%s-%s:%v%s/transfer-process-started" ( include "txdc.fullname" $root ) $dataplane.name $dataplane.endpoints.callback.port $dataplane.endpoints.callback.path | quote }} + value: {{ printf "http://%s-%s:%v%s/transfer-process-started" ( include "txap.fullname" . ) $dataplane.name $dataplane.endpoints.callback.port $dataplane.endpoints.callback.path | quote }} - name: "CX_AGENT_CONTROLPLANE_PROTOCOL" - value: {{ printf "http://%s-controlplane:%v" ( include "txdc.fullname" $root ) $root.Values.controlplane.endpoints.protocol.port | quote }} + value: {{ printf "http://%s-controlplane:%v" ( include "txap.fullname" . ) .Values.controlplane.endpoints.protocol.port | quote }} - name: "CX_AGENT_CONTROLPLANE_MANAGEMENT" - value: {{ printf "http://%s-controlplane:%v%s" ( include "txdc.fullname" $root ) $root.Values.controlplane.endpoints.management.port $root.Values.controlplane.endpoints.management.path | quote }} + value: {{ printf "http://%s-controlplane:%v%s" ( include "txap.fullname" . ) .Values.controlplane.endpoints.management.port .Values.controlplane.endpoints.management.path | quote }} {{- if $dataplane.agent.matchmaking }} - name: "CX_AGENT_MATCHMAKING" @@ -277,7 +276,6 @@ spec: value: {{ join "," $dataplane.agent.default | quote }} {{- end }} - {{- if $dataplane.agent.services }} ################### # AGENT SERVICES # @@ -306,7 +304,7 @@ spec: # AGENT SYNC # ################### - name: "CX_AGENT_DATASPACE_REMOTES" - value: {{- include "txdc.remotes" . }} + value: {{ include "txap.remotes" . }} - name: "CX_AGENT_DATASPACE_SYNCHRONIZATION" value: {{ $dataplane.agent.synchronization | required (printf ".Values.dataplane.%s.agent.synchronization should be set if connectors are specified" $dataplane_name) | quote }} - name: "CX_AGENT_FEDERATION_BATCH_MAX" @@ -366,7 +364,7 @@ spec: ## Additional environment variables ## ###################################### - name: "EDC_CONNECTOR_NAME" - value: {{ include "txdc.fullname" $root}}-{{ $dataplane.name }} + value: {{ include "txap.fullname" .}}-{{ $dataplane.name }} {{- range $key, $value := $dataplane.envValueFrom }} - name: {{ $key | quote }} valueFrom: @@ -405,7 +403,7 @@ spec: volumes: - name: "configuration" configMap: - name: {{ include "txdc.fullname" $root }}-{{ $dataplane_name }} + name: {{ include "txap.fullname" . }}-{{ $dataplane_name }} items: - key: "opentelemetry.properties" path: "opentelemetry.properties" @@ -428,4 +426,4 @@ spec: {{- with $dataplane.tolerations }} tolerations: {{- toYaml . | nindent 8 }} - {{- end }} \ No newline at end of file + {{- end }} diff --git a/charts/agent-plane/templates/hpa-dataplane.yaml b/charts/agent-plane/templates/hpa-dataplane.yaml index 5d74ae5c..bd8acaee 100644 --- a/charts/agent-plane/templates/hpa-dataplane.yaml +++ b/charts/agent-plane/templates/hpa-dataplane.yaml @@ -28,14 +28,14 @@ apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: - name: {{ include "txdc.fullname" $root }}-{{ $dataplane.name }} + name: {{ include "txap.fullname" $root }}-{{ $dataplane.name }} labels: - {{- include "txdc.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} + {{- include "txap.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ include "txdc.fullname" $root }}-{{ $dataplane.name }} + name: {{ include "txap.fullname" $root }}-{{ $dataplane.name }} minReplicas: {{ $dataplane.autoscaling.minReplicas }} maxReplicas: {{ $dataplane.autoscaling.maxReplicas }} metrics: diff --git a/charts/agent-plane/templates/ingress-dataplane.yaml b/charts/agent-plane/templates/ingress-dataplane.yaml index 4965796b..cb7955af 100644 --- a/charts/agent-plane/templates/ingress-dataplane.yaml +++ b/charts/agent-plane/templates/ingress-dataplane.yaml @@ -1,12 +1,10 @@ -{{- $fullName := include "txdc.fullname" . }} +{{- $fullName := include "txap.fullname" . }} {{- $gitVersion := .Capabilities.KubeVersion.GitVersion }} {{- $namespace := .Release.Namespace }} {{ $dataplane_name := .Values.name }} {{ $dataplane := .Values }} -{{ $root := . }} {{- $dataEdcEndpoints := $dataplane.endpoints }} -{{- $dataLabels := include "txdc.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} - +{{- $dataLabels := include "txap.dataplane.labels" . | nindent 4 }} {{- range $dataplane.ingresses }} {{- if and .enabled .endpoints }} {{- $dataIngressName := printf "%s-%s-%s" $fullName $dataplane.name .hostname }} diff --git a/charts/agent-plane/templates/service-dataplane.yaml b/charts/agent-plane/templates/service-dataplane.yaml index c543d252..7ddacef7 100644 --- a/charts/agent-plane/templates/service-dataplane.yaml +++ b/charts/agent-plane/templates/service-dataplane.yaml @@ -1,6 +1,3 @@ -{{ $root := . }} -{{ $dataplane_name := .Values.name }} -{{ $dataplane := .Values }} --- # # Copyright (c) 2024 T-Systems International GmbH @@ -24,28 +21,28 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "txdc.fullname" $root }}-{{ $dataplane.name }} - namespace: {{ $root.Release.Namespace | default "default" | quote }} + name: {{ include "txap.fullname" . }}-{{ .Values.name }} + namespace: {{.Release.Namespace | default "default" | quote }} labels: - {{- include "txdc.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} + {{- include "txap.dataplane.labels" . | nindent 4 }} spec: - type: {{ $dataplane.service.type }} + type: {{ .Values.service.type }} ports: - - port: {{ $dataplane.endpoints.default.port }} + - port: {{ .Values.endpoints.default.port }} targetPort: default protocol: TCP name: default - - port: {{ $dataplane.endpoints.signaling.port }} + - port: {{ .Values.endpoints.signaling.port }} targetPort: control protocol: TCP name: signaling - - port: {{ $dataplane.endpoints.public.port }} + - port: {{ .Values.endpoints.public.port }} targetPort: public protocol: TCP name: public - - port: {{ $dataplane.endpoints.callback.port }} + - port: {{ .Values.endpoints.callback.port }} targetPort: callback protocol: TCP name: callback selector: - {{- include "txdc.dataplane.selectorLabels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} \ No newline at end of file + {{- include "txap.dataplane.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/charts/agent-plane/templates/serviceaccount.yaml b/charts/agent-plane/templates/serviceaccount.yaml index 6d21ddc3..f3c5fecf 100644 --- a/charts/agent-plane/templates/serviceaccount.yaml +++ b/charts/agent-plane/templates/serviceaccount.yaml @@ -25,9 +25,9 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "txdc.serviceAccountName" . }} + name: {{ include "txap.serviceAccountName" . }} labels: - {{- include "txdc.labels" . | nindent 4 }} + {{- include "txap.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/agent-plane/templates/tests/test-dataplane-readiness.yaml b/charts/agent-plane/templates/tests/test-dataplane-readiness.yaml index 5aa323d9..7fa5ba0d 100644 --- a/charts/agent-plane/templates/tests/test-dataplane-readiness.yaml +++ b/charts/agent-plane/templates/tests/test-dataplane-readiness.yaml @@ -16,16 +16,15 @@ # # SPDX-License-Identifier: Apache-2.0 # -{{ $root := . }} {{ $dataplane_name := .Values.name }} {{ $dataplane := .Values }} --- apiVersion: v1 kind: Pod metadata: - name: "{{include "txdc.fullname" .}}test-dataplane-readiness" + name: "{{include "txap.fullname" .}}test-dataplane-readiness" labels: - {{- include "txdc.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }} + {{- include "txap.dataplane.labels" . | nindent 4 }} annotations: "helm.sh/hook": test "helm.sh/hook-delete-policy": {{ .Values.tests.hookDeletePolicy }} @@ -34,5 +33,5 @@ spec: - name: wget image: curlimages/curl command: [ '/bin/sh','-c' ] - args: [ {{- printf "curl http://%s-%s:%v%s/check/readiness" (include "txdc.fullname" $root ) $dataplane.name $dataplane.endpoints.default.port $dataplane.endpoints.default.path | quote }} ] + args: [ {{- printf "curl http://%s-%s:%v%s/check/readiness" (include "txap.fullname" . ) $dataplane.name $dataplane.endpoints.default.port $dataplane.endpoints.default.path | quote }} ] restartPolicy: Never