diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index 5881fb8f..53edf5ac 100644 --- a/charts/hono/templates/_helpers.tpl +++ b/charts/hono/templates/_helpers.tpl @@ -16,8 +16,8 @@ Expand the name of the chart. */}} {{- define "hono.name" -}} - {{- $nameOverride := .Values.global.hono.nameOverride -}} - {{- empty $nameOverride | ternary .Chart.Name (tpl $nameOverride $) | trunc 63 | trimSuffix "-" -}} + {{- $nameOverride := .dot.Values.nameOverride -}} + {{- empty $nameOverride | ternary .dot.Chart.Name (tpl $nameOverride .dot ) | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* @@ -26,16 +26,16 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this If release name contains chart name it will be used as a full name. */}} {{- define "hono.fullname" -}} - {{- $fullnameOverride := .Values.global.hono.fullnameOverride -}} + {{- $fullnameOverride := .dot.Values.fullnameOverride -}} {{- if $fullnameOverride -}} - {{- (tpl $fullnameOverride $) | trunc 63 | trimSuffix "-" -}} + {{- (tpl $fullnameOverride .dot) | trunc 63 | trimSuffix "-" -}} {{- else -}} - {{- $nameOverride := .Values.global.hono.nameOverride -}} - {{- $name := empty $nameOverride | ternary .Chart.Name (tpl $nameOverride $) -}} - {{- if contains $name .Release.Name -}} - {{- .Release.Name | trunc 63 | trimSuffix "-" -}} + {{- $nameOverride := .dot.Values.nameOverride -}} + {{- $name := empty $nameOverride | ternary .dot.Chart.Name (tpl $nameOverride .dot) -}} + {{- if contains $name .dot.Release.Name -}} + {{- .dot.Release.Name | trunc 63 | trimSuffix "-" -}} {{- else -}} - {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} + {{- printf "%s-%s" .dot.Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{- end -}} {{- end -}} @@ -44,7 +44,7 @@ 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 "hono.chart" }} - {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} + {{- printf "%s-%s" .dot.Chart.Name .dot.Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* @@ -91,9 +91,9 @@ Add standard labels for resources as recommended by Helm best practices. {{- define "hono.std.labels" -}} app.kubernetes.io/name: {{ include "hono.name" . | quote }} helm.sh/chart: {{ include "hono.chart" . | quote }} -app.kubernetes.io/managed-by: {{ .Release.Service | quote }} -app.kubernetes.io/instance: {{ .Release.Name | quote }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +app.kubernetes.io/managed-by: {{ .dot.Release.Service | quote }} +app.kubernetes.io/instance: {{ .dot.Release.Name | quote }} +app.kubernetes.io/version: {{ .dot.Chart.AppVersion | quote }} {{- end }} @@ -105,11 +105,11 @@ The scope passed in is expected to be a dict with keys - "component": the value to use for the "app.kubernetes.io/component" label */}} {{- define "hono.metadata" -}} -name: {{ printf "%s-%s" (include "hono.fullname" .dot ) .name | quote }} +name: {{ printf "%s-%s" (include "hono.fullname" . ) .name | quote }} namespace: {{ .dot.Release.Namespace | quote }} labels: - app.kubernetes.io/name: {{ include "hono.name" .dot | quote }} - helm.sh/chart: {{ include "hono.chart" .dot | quote }} + app.kubernetes.io/name: {{ include "hono.name" . | quote }} + helm.sh/chart: {{ include "hono.chart" . | quote }} app.kubernetes.io/managed-by: {{ .dot.Release.Service | quote }} app.kubernetes.io/instance: {{ .dot.Release.Name | quote }} app.kubernetes.io/version: {{ .dot.Chart.AppVersion | quote }} @@ -125,7 +125,7 @@ The scope passed in is expected to be a dict with keys - "component": the value of the "app.kubernetes.io/component" label to match */}} {{- define "hono.matchLabels" -}} -app.kubernetes.io/name: {{ include "hono.name" .dot | quote }} +app.kubernetes.io/name: {{ include "hono.name" . | quote }} app.kubernetes.io/instance: {{ .dot.Release.Name | quote }} app.kubernetes.io/component: {{ .component | quote }} {{- end }} @@ -266,7 +266,7 @@ The scope passed in is expected to be a dict with keys kafka: {{- if .dot.Values.kafkaMessagingClusterExample.enabled }} commonClientConfig: - {{- $bootstrapServers := printf "%[1]s-%[2]s-0.%[1]s-%[2]s-headless:%d" ( include "hono.fullname" .dot ) .dot.Values.kafka.nameOverride ( .dot.Values.kafka.service.ports.client | int ) }} + {{- $bootstrapServers := printf "%[1]s-%[2]s-0.%[1]s-%[2]s-headless:%d" ( include "hono.fullname" . ) .dot.Values.kafka.nameOverride ( .dot.Values.kafka.service.ports.client | int ) }} bootstrap.servers: {{ $bootstrapServers | quote }} {{- if eq .dot.Values.kafka.auth.clientProtocol "sasl_tls" }} security.protocol: "SASL_SSL" @@ -607,22 +607,22 @@ The scope passed in is expected to be a dict with keys {{- if ( ne $keySecretName "none" ) }} - name: "tls-keys" secret: - secretName: {{ ternary ( printf "%s-%s-example-keys" ( include "hono.fullname" .dot ) .name ) $keySecretName ( eq $keySecretName "example" ) | quote }} + secretName: {{ ternary ( printf "%s-%s-example-keys" ( include "hono.fullname" . ) .name ) $keySecretName ( eq $keySecretName "example" ) | quote }} {{- end }} {{- $trustStoreConfigMapName := ( default "none" .componentConfig.tlsTrustStoreConfigMap | toString ) }} {{- if ( ne $trustStoreConfigMapName "none" ) }} - name: "tls-trust-store" configMap: - name: {{ ternary ( printf "%s-example-trust-store" ( include "hono.fullname" .dot )) $trustStoreConfigMapName ( eq $trustStoreConfigMapName "example" ) | quote }} + name: {{ ternary ( printf "%s-example-trust-store" ( include "hono.fullname" . )) $trustStoreConfigMapName ( eq $trustStoreConfigMapName "example" ) | quote }} {{- end }} - name: "default-logging-config" configMap: - name: {{ printf "%s-default-logging-config" ( include "hono.fullname" .dot ) | quote }} + name: {{ printf "%s-default-logging-config" ( include "hono.fullname" . ) | quote }} optional: true {{- $volumeName := printf "%s-conf" .name }} - name: {{ $volumeName | quote }} secret: - secretName: {{ printf "%s-%s" ( include "hono.fullname" .dot ) $volumeName | quote }} + secretName: {{ printf "%s-%s" ( include "hono.fullname" . ) $volumeName | quote }} {{- if and .dot.Values.otelCollectorAgentConfigMap ( not .dot.Values.jaegerBackendExample.enabled ) }} - name: "otel-collector-config" configMap: diff --git a/charts/hono/templates/example-data-grid/statefulset.yaml b/charts/hono/templates/example-data-grid/statefulset.yaml index 37757441..f21ac8e0 100644 --- a/charts/hono/templates/example-data-grid/statefulset.yaml +++ b/charts/hono/templates/example-data-grid/statefulset.yaml @@ -18,7 +18,7 @@ metadata: {{- include "hono.metadata" $args | nindent 2 }} spec: replicas: 1 - serviceName: {{ printf "%s-%s" (include "hono.fullname" .) $args.name }} + serviceName: {{ printf "%s-%s" (include "hono.fullname" $args) $args.name }} selector: matchLabels: {{- include "hono.matchLabels" $args | nindent 6 }} @@ -43,7 +43,7 @@ spec: - name: JDK_JAVA_OPTIONS value: "-XX:MinRAMPercentage=85 -XX:MaxRAMPercentage=85" - name: JAVA_OPTIONS - value: {{ printf "-Djgroups.dns.query=%s-%s" (include "hono.fullname" .) $args.name }} + value: {{ printf "-Djgroups.dns.query=%s-%s" (include "hono.fullname" $args) $args.name }} ports: - name: hotrod containerPort: 11222 diff --git a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-post-install-configmap.yaml b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-post-install-configmap.yaml index 7c6b25fd..e84d7bf8 100644 --- a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-post-install-configmap.yaml +++ b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-post-install-configmap.yaml @@ -18,7 +18,8 @@ metadata: {{- include "hono.metadata" $args | nindent 2 }} data: add_example_data_device_registry.sh: | - {{- tpl (.Files.Get "example/add_example_data_device_registry.sh") . | nindent 4 }} + {{- $_ := set $ "dot" $args.dot }} + {{- tpl (.Files.Get "example/add_example_data_device_registry.sh") $ | nindent 4 }} example-tenants.sh: | {{ .Files.Get "example/example-tenants.sh" | nindent 4 }} example-devices.sh: | diff --git a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-post-install-job.yaml b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-post-install-job.yaml index 3d9d519a..9117f7d9 100644 --- a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-post-install-job.yaml +++ b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-post-install-job.yaml @@ -25,7 +25,7 @@ metadata: spec: template: metadata: - name: {{ printf "%s-%s" ( include "hono.fullname" . ) "post-install" | quote }} + name: {{ printf "%s-%s" ( include "hono.fullname" $args ) "post-install" | quote }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: @@ -48,6 +48,6 @@ spec: volumes: - name: post-install-data configMap: - name: {{ printf "%s-post-install-device-registry-conf" ( include "hono.fullname" . ) }} + name: {{ printf "%s-post-install-device-registry-conf" ( include "hono.fullname" $args ) }} defaultMode: 0555 {{- end }} diff --git a/charts/hono/templates/hono-service-device-registry-embedded/hono-service-device-registry-secret.yaml b/charts/hono/templates/hono-service-device-registry-embedded/hono-service-device-registry-secret.yaml index 7226d521..ca19a753 100644 --- a/charts/hono/templates/hono-service-device-registry-embedded/hono-service-device-registry-secret.yaml +++ b/charts/hono/templates/hono-service-device-registry-embedded/hono-service-device-registry-secret.yaml @@ -26,7 +26,7 @@ stringData: {{- if .Values.deviceRegistryExample.hono.auth }} {{- .Values.deviceRegistryExample.hono.auth | toYaml | nindent 8 }} {{- else }} - host: {{ printf "%s-service-auth" ( include "hono.fullname" . ) | quote }} + host: {{ printf "%s-service-auth" ( include "hono.fullname" $args ) | quote }} port: 5671 trustStorePath: "/opt/hono/tls/ca.crt" hostnameVerificationRequired: false diff --git a/charts/hono/templates/hono-service-device-registry-embedded/hono-service-device-registry-statefulset.yaml b/charts/hono/templates/hono-service-device-registry-embedded/hono-service-device-registry-statefulset.yaml index cd85cf1f..fb0c0f22 100644 --- a/charts/hono/templates/hono-service-device-registry-embedded/hono-service-device-registry-statefulset.yaml +++ b/charts/hono/templates/hono-service-device-registry-embedded/hono-service-device-registry-statefulset.yaml @@ -83,5 +83,5 @@ spec: {{- include "hono.pod.volumes" ( dict "dot" $args.dot "name" $args.name "componentConfig" .Values.deviceRegistryExample ) | indent 6 }} - name: "registry" persistentVolumeClaim: - claimName: {{ printf "%s-%s" ( include "hono.fullname" . ) $args.name | quote }} + claimName: {{ printf "%s-%s" ( include "hono.fullname" $args ) $args.name | quote }} {{- end }} diff --git a/charts/hono/templates/hono-service-device-registry-mongodb/hono-service-device-registry-secret.yaml b/charts/hono/templates/hono-service-device-registry-mongodb/hono-service-device-registry-secret.yaml index 5e8109cd..001b93dc 100644 --- a/charts/hono/templates/hono-service-device-registry-mongodb/hono-service-device-registry-secret.yaml +++ b/charts/hono/templates/hono-service-device-registry-mongodb/hono-service-device-registry-secret.yaml @@ -26,7 +26,7 @@ stringData: {{- if .Values.deviceRegistryExample.hono.auth }} {{- .Values.deviceRegistryExample.hono.auth | toYaml | nindent 8 }} {{- else }} - host: {{ printf "%s-service-auth" ( include "hono.fullname" . ) | quote }} + host: {{ printf "%s-service-auth" ( include "hono.fullname" $args ) | quote }} port: 5671 trustStorePath: "/opt/hono/tls/ca.crt" hostnameVerificationRequired: false diff --git a/charts/hono/templates/kafka/kafka-example-keys.yaml b/charts/hono/templates/kafka/kafka-example-keys.yaml index 63eee9b7..63f9a2fd 100644 --- a/charts/hono/templates/kafka/kafka-example-keys.yaml +++ b/charts/hono/templates/kafka/kafka-example-keys.yaml @@ -14,7 +14,7 @@ apiVersion: v1 kind: Secret metadata: - {{- $args := dict "dot" . "component" "kafka" "name" "kafka-example-keys" }} + {{- $args := dict "dot" (. | deepCopy | merge (dict "Values" (pick .Values.kafka "nameOverride" "fullnameOverride"))) "component" "kafka" "name" "kafka-example-keys" }} {{- include "hono.metadata" $args | nindent 2 }} type: Opaque data: diff --git a/charts/hono/values.yaml b/charts/hono/values.yaml index 9b6aee96..6fa05b27 100755 --- a/charts/hono/values.yaml +++ b/charts/hono/values.yaml @@ -14,10 +14,8 @@ # Default values for eclipse-hono. # Declare variables to be passed into your templates. -global: - hono: - nameOverride: "" - fullnameOverride: "" +nameOverride: "" +fullnameOverride: "" # honoImagesTag contains the (common) tag name of the Hono component # container images to deploy. @@ -1687,7 +1685,7 @@ kafka: type: "pem" pemChainIncluded: true existingSecrets: - - "{{ include \"hono.fullname\" . }}-kafka-example-keys" + - "{{ include \"hono.fullname\" (dict \"dot\" .) }}-kafka-example-keys" service: ports: diff --git a/packages/cloud2edge/templates/post-install-job.yaml b/packages/cloud2edge/templates/post-install-job.yaml index cdb15f55..d454ee69 100644 --- a/packages/cloud2edge/templates/post-install-job.yaml +++ b/packages/cloud2edge/templates/post-install-job.yaml @@ -87,7 +87,8 @@ spec: secret: secretName: {{ printf "%s-%s" .Release.Name "ditto-gateway-secret" }} {{- if and .Values.hono.kafkaMessagingClusterExample .Values.hono.kafkaMessagingClusterExample.enabled }} + {{- $args := dict "dot" (. | deepCopy | merge (dict "Values" (pick .Values.kafka "nameOverride" "fullnameOverride"))) }} - name: kafka-connection-cert secret: - secretName: {{ printf "%s-%s" .Release.Name "kafka-example-keys" }} + secretName: {{ printf "%s-%s" (include "hono.fullname" $args) "kafka-example-keys" }} {{- end}}