From 299cc8ef49195f69907436199c8e89e587369adb Mon Sep 17 00:00:00 2001 From: Dirk Van Haerenborgh Date: Mon, 26 Sep 2022 15:45:43 +0200 Subject: [PATCH 01/22] allow overriding release name Signed-off-by: Dirk Van Haerenborgh --- charts/hono/Chart.yaml | 2 +- charts/hono/templates/_helpers.tpl | 24 +++++++++---------- .../dispatch-router-route.yaml | 2 +- .../example-data-grid/statefulset.yaml | 6 ++--- .../hono-adapter-amqp-route.yaml | 2 +- .../hono-adapter-amqp-sec-route.yaml | 2 +- .../hono-adapter-http-route.yaml | 2 +- .../hono-adapter-http-sec-route.yaml | 2 +- .../hono-adapter-lora-route.yaml | 2 +- .../hono-adapter-lora-sec-route.yaml | 2 +- .../hono-adapter-mqtt-route.yaml | 2 +- .../hono-adapter-mqtt-sec-route.yaml | 2 +- .../hono-service-auth-route.yaml | 2 +- ...ono-service-command-router-deployment.yaml | 2 +- ...no-service-command-router-rolebinding.yaml | 4 ++-- .../hono-service-command-router-route.yaml | 2 +- .../hono-service-command-router-secret.yaml | 6 ++--- ...o-service-device-registry-amqps-route.yaml | 2 +- ...no-service-device-registry-http-route.yaml | 2 +- ...o-service-device-registry-https-route.yaml | 2 +- ...vice-device-registry-post-install-job.yaml | 4 ++-- .../hono-service-device-registry-secret.yaml | 2 +- ...o-service-device-registry-statefulset.yaml | 2 +- .../hono-service-device-registry-secret.yaml | 2 +- .../hono-service-device-registry-secret.yaml | 4 ++-- .../prometheus/prometheus-config.yaml | 2 +- 26 files changed, 44 insertions(+), 44 deletions(-) diff --git a/charts/hono/Chart.yaml b/charts/hono/Chart.yaml index 0a486cde..9fd0150e 100755 --- a/charts/hono/Chart.yaml +++ b/charts/hono/Chart.yaml @@ -15,7 +15,7 @@ name: hono description: | Eclipse Hono™ provides remote service interfaces for connecting large numbers of IoT devices to a back end and interacting with them in a uniform way regardless of the device communication protocol. -version: 2.4.4 +version: 2.5.0 # Version of Hono being deployed by the chart appVersion: 2.4.0 keywords: diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index 4ccb9bf6..8169f873 100644 --- a/charts/hono/templates/_helpers.tpl +++ b/charts/hono/templates/_helpers.tpl @@ -102,7 +102,7 @@ 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" .dot.Release.Name .name | quote }} +name: {{ printf "%s-%s" (include "hono.fullname" .dot ) .name | quote }} namespace: {{ .dot.Release.Namespace | quote }} labels: app.kubernetes.io/name: {{ include "hono.name" .dot | quote }} @@ -237,7 +237,7 @@ messaging: {{- if .dot.Values.amqpMessagingNetworkExample.enabled }} name: {{ printf "Hono %s" .component | quote }} amqpHostname: "hono-internal" - host: {{ printf "%s-dispatch-router" .dot.Release.Name | quote }} + host: {{ printf "%s-dispatch-router" ( include "hono.fullname" .dot ) | quote }} port: 5673 keyPath: {{ .dot.Values.adapters.amqpMessagingNetworkSpec.keyPath | quote }} certPath: {{ .dot.Values.adapters.amqpMessagingNetworkSpec.certPath | quote }} @@ -263,7 +263,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" .dot.Release.Name .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 ) .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" @@ -321,7 +321,7 @@ The scope passed in is expected to be a dict with keys */}} {{- define "hono.deviceRegistryExampleClientConfig" -}} name: {{ printf "Hono %s" .component | quote }} -host: {{ printf "%s-service-device-registry" .dot.Release.Name | quote }} +host: {{ printf "%s-service-device-registry" ( include "hono.fullname" .dot ) | quote }} port: 5671 credentialsPath: "/opt/hono/config/adapter.credentials" trustStorePath: {{ .dot.Values.deviceRegistryExample.clientTrustStorePath | default "/opt/hono/tls/ca.crt" | quote }} @@ -343,7 +343,7 @@ command: {{- if .dot.Values.amqpMessagingNetworkExample.enabled }} name: {{ printf "Hono %s" $adapter | quote }} amqpHostname: "hono-internal" - host: {{ printf "%s-dispatch-router" .dot.Release.Name | quote }} + host: {{ printf "%s-dispatch-router" ( include "hono.fullname" .dot ) | quote }} port: 5673 keyPath: {{ .dot.Values.adapters.commandAndControlSpec.keyPath | quote }} certPath: {{ .dot.Values.adapters.commandAndControlSpec.certPath | quote }} @@ -384,7 +384,7 @@ commandRouter: {{- .dot.Values.adapters.commandRouterSpec | toYaml | nindent 2 }} {{- else }} name: {{ printf "Hono %s" $adapter | quote }} - host: {{ printf "%s-service-command-router" .dot.Release.Name | quote }} + host: {{ printf "%s-service-command-router" ( include "hono.fullname" .dot ) | quote }} port: 5671 credentialsPath: "/opt/hono/config/adapter.credentials" trustStorePath: {{ .dot.Values.commandRouterService.clientTrustStorePath | default "/opt/hono/tls/ca.crt" | quote }} @@ -461,7 +461,7 @@ quarkus: exporter: otlp: {{- if .dot.Values.jaegerBackendExample.enabled }} - endpoint: {{ printf "http://%s-jaeger-collector:4317" .dot.Release.Name | quote }} + endpoint: {{ printf "http://%s-jaeger-collector:4317" ( include "hono.fullname" .dot ) | quote }} {{- else }} endpoint: "http://127.0.0.1:4317" {{- end }} @@ -532,7 +532,7 @@ The scope passed in is expected to be a dict with keys {{- $component := .componentConfig -}} {{- $probes := mergeOverwrite ( $global.probes | deepCopy ) ( $component.probes | default dict | deepCopy ) -}} {{- $deprecatedLivenessProbeInitialDelaySeconds := default .dot.Values.livenessProbeInitialDelaySeconds .componentConfig.livenessProbeInitialDelaySeconds -}} -{{- $deprecatedReadinessProbeInitialDelaySeconds := default .dot.Values.readinessProbeInitialDelaySeconds .componentConfig.readinessProbeInitialDelaySeconds -}} +{{- $deprecatedReadinessProbeInitialDelaySeconds := default .dot.Values.readinessProbeInitialDelaySeconds .componentConfig.readinessProbeInitialDelaySeconds -}} livenessProbe: httpGet: path: {{ $probes.livenessProbe.httpGet.path }} @@ -610,22 +610,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" .dot.Release.Name .name ) $keySecretName ( eq $keySecretName "example" ) | quote }} + secretName: {{ ternary ( printf "%s-%s-example-keys" ( include "hono.fullname" .dot ) .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" .dot.Release.Name ) $trustStoreConfigMapName ( eq $trustStoreConfigMapName "example" ) | quote }} + name: {{ ternary ( printf "%s-example-trust-store" ( include "hono.fullname" .dot )) $trustStoreConfigMapName ( eq $trustStoreConfigMapName "example" ) | quote }} {{- end }} - name: "default-logging-config" configMap: - name: {{ printf "%s-default-logging-config" .dot.Release.Name | quote }} + name: {{ printf "%s-default-logging-config" ( include "hono.fullname" .dot ) | quote }} optional: true {{- $volumeName := printf "%s-conf" .name }} - name: {{ $volumeName | quote }} secret: - secretName: {{ printf "%s-%s" .dot.Release.Name $volumeName | quote }} + secretName: {{ printf "%s-%s" ( include "hono.fullname" .dot ) $volumeName | quote }} {{- if and .dot.Values.otelCollectorAgentConfigMap ( not .dot.Values.jaegerBackendExample.enabled ) }} - name: "otel-collector-config" configMap: diff --git a/charts/hono/templates/dispatch-router/dispatch-router-route.yaml b/charts/hono/templates/dispatch-router/dispatch-router-route.yaml index e563ff4e..730d7b8b 100644 --- a/charts/hono/templates/dispatch-router/dispatch-router-route.yaml +++ b/charts/hono/templates/dispatch-router/dispatch-router-route.yaml @@ -24,5 +24,5 @@ spec: termination: passthrough to: kind: Service - name: {{ .Release.Name }}-dispatch-router-ext + name: {{ printf "%s-dispatch-router-ext" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/example-data-grid/statefulset.yaml b/charts/hono/templates/example-data-grid/statefulset.yaml index 6d509c8f..561b95fa 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" .Release.Name $args.name }} + serviceName: {{ printf "%s-%s" (include "hono.name" .) $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" .Release.Name $args.name }} + value: {{ printf "-Djgroups.dns.query=%s-%s" (include "hono.name" .) $args.name }} ports: - name: hotrod containerPort: 11222 @@ -74,5 +74,5 @@ spec: volumes: - name: conf configMap: - name: {{ printf "%s-%s-conf" .Release.Name $args.name }} + name: {{ printf "%s-%s-conf" (include "hono.name" .) $args.name }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-route.yaml b/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-route.yaml index f3479e87..ea7e34de 100644 --- a/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-route.yaml +++ b/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: amqp to: kind: Service - name: {{ .Release.Name }}-adapter-amqp + name: {{ printf "%s-adapter-amqp" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-sec-route.yaml b/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-sec-route.yaml index 57bcb029..dd3ddbf1 100644 --- a/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-sec-route.yaml +++ b/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-sec-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ .Release.Name }}-adapter-amqp + name: {{ printf "%s-adapter-amqp" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-http/hono-adapter-http-route.yaml b/charts/hono/templates/hono-adapter-http/hono-adapter-http-route.yaml index db1eff27..313bc54b 100644 --- a/charts/hono/templates/hono-adapter-http/hono-adapter-http-route.yaml +++ b/charts/hono/templates/hono-adapter-http/hono-adapter-http-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: http to: kind: Service - name: {{ .Release.Name }}-adapter-http + name: {{ printf "%s-adapter-http" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-http/hono-adapter-http-sec-route.yaml b/charts/hono/templates/hono-adapter-http/hono-adapter-http-sec-route.yaml index 04ee6a14..c4941b39 100644 --- a/charts/hono/templates/hono-adapter-http/hono-adapter-http-sec-route.yaml +++ b/charts/hono/templates/hono-adapter-http/hono-adapter-http-sec-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ .Release.Name }}-adapter-http + name: {{ printf "%s-adapter-http" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-route.yaml b/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-route.yaml index 54315c9c..cd444fc4 100644 --- a/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-route.yaml +++ b/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: http to: kind: Service - name: {{ .Release.Name }}-adapter-lora + name: {{ printf "%s-adapter-lora" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-sec-route.yaml b/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-sec-route.yaml index 42c5ff09..cd276266 100644 --- a/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-sec-route.yaml +++ b/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-sec-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ .Release.Name }}-adapter-lora + name: {{ printf "%s-adapter-lora" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-route.yaml b/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-route.yaml index e5304c3a..b3eea192 100644 --- a/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-route.yaml +++ b/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: mqtt to: kind: Service - name: {{ .Release.Name }}-adapter-mqtt + name: {{ printf "%s-adapter-mqtt" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-sec-route.yaml b/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-sec-route.yaml index ee92f7ae..b10db49f 100644 --- a/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-sec-route.yaml +++ b/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-sec-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ .Release.Name }}-adapter-mqtt + name: {{ printf "%s-adapter-mqtt" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-service-auth/hono-service-auth-route.yaml b/charts/hono/templates/hono-service-auth/hono-service-auth-route.yaml index fb073bf3..1ba037eb 100644 --- a/charts/hono/templates/hono-service-auth/hono-service-auth-route.yaml +++ b/charts/hono/templates/hono-service-auth/hono-service-auth-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ .Release.Name }}-service-auth + name: {{ printf "%s-service-auth" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-service-command-router/hono-service-command-router-deployment.yaml b/charts/hono/templates/hono-service-command-router/hono-service-command-router-deployment.yaml index 0e886698..06f71c10 100644 --- a/charts/hono/templates/hono-service-command-router/hono-service-command-router-deployment.yaml +++ b/charts/hono/templates/hono-service-command-router/hono-service-command-router-deployment.yaml @@ -72,4 +72,4 @@ spec: {{- include "hono.component.healthChecks" $args | nindent 8 }} volumes: {{- include "hono.pod.volumes" $args | indent 6 }} - serviceAccountName: {{ printf "%s-%s" .Release.Name $args.name | quote }} + serviceAccountName: {{ printf "%s-%s" ( include "hono.fullname" . ) $args.name | quote }} diff --git a/charts/hono/templates/hono-service-command-router/hono-service-command-router-rolebinding.yaml b/charts/hono/templates/hono-service-command-router/hono-service-command-router-rolebinding.yaml index 9ccdd020..ab9c0ae3 100644 --- a/charts/hono/templates/hono-service-command-router/hono-service-command-router-rolebinding.yaml +++ b/charts/hono/templates/hono-service-command-router/hono-service-command-router-rolebinding.yaml @@ -5,9 +5,9 @@ metadata: {{- include "hono.metadata" $args | nindent 2 }} roleRef: kind: Role - name: {{ printf "%s-%s" .Release.Name $args.name | quote }} + name: {{ printf "%s-%s" ( include "hono.fullname" . ) $args.name | quote }} apiGroup: rbac.authorization.k8s.io subjects: - kind: ServiceAccount - name: {{ printf "%s-%s" .Release.Name $args.name | quote }} + name: {{ printf "%s-%s" ( include "hono.fullname" . ) $args.name | quote }} namespace: {{ .Release.Namespace }} diff --git a/charts/hono/templates/hono-service-command-router/hono-service-command-router-route.yaml b/charts/hono/templates/hono-service-command-router/hono-service-command-router-route.yaml index 08c54e15..931b4f9b 100644 --- a/charts/hono/templates/hono-service-command-router/hono-service-command-router-route.yaml +++ b/charts/hono/templates/hono-service-command-router/hono-service-command-router-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: 5671 to: kind: Service - name: {{ .Release.Name}}-service-command-router + name: {{ printf "%s-service-command-router" ( include "hono.fullname" . ) }} {{end}} diff --git a/charts/hono/templates/hono-service-command-router/hono-service-command-router-secret.yaml b/charts/hono/templates/hono-service-command-router/hono-service-command-router-secret.yaml index 8d1b570a..4dab06b2 100644 --- a/charts/hono/templates/hono-service-command-router/hono-service-command-router-secret.yaml +++ b/charts/hono/templates/hono-service-command-router/hono-service-command-router-secret.yaml @@ -33,7 +33,7 @@ stringData: {{- if .Values.commandRouterService.hono.auth }} {{- .Values.commandRouterService.hono.auth | toYaml | nindent 8 }} {{- else }} - host: {{ printf "%s-service-auth" .Release.Name | quote }} + host: {{ printf "%s-service-auth" ( include "hono.fullname" . ) | quote }} port: 5671 trustStorePath: "/opt/hono/tls/ca.crt" hostnameVerificationRequired: false @@ -56,7 +56,7 @@ stringData: {{- .Values.dataGridSpec | toYaml | nindent 12 }} {{- else if .Values.dataGridExample.enabled }} remote: - {{- $serverName := printf "%s-data-grid" .Release.Name }} + {{- $serverName := printf "%s-data-grid" ( include "hono.fullname" . ) }} serverList: {{ printf "%s:11222" $serverName | quote }} authServerName: {{ $serverName | quote }} authUsername: {{ .Values.dataGridExample.authUsername | quote }} @@ -82,7 +82,7 @@ stringData: {{- if .Values.amqpMessagingNetworkExample.enabled }} name: {{ printf "Hono %s" $args.component | quote }} amqpHostname: hono-internal - host: {{ .Release.Name }}-dispatch-router + host: {{ ( include "hono.fullname" . ) }}-dispatch-router port: 5673 keyPath: {{ .Values.adapters.commandAndControlSpec.keyPath }} certPath: {{ .Values.adapters.commandAndControlSpec.certPath }} diff --git a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-amqps-route.yaml b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-amqps-route.yaml index 4d35f578..d59970f9 100644 --- a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-amqps-route.yaml +++ b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-amqps-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ .Release.Name }}-service-device-registry + name: {{ printf "%s-service-device-registry" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-http-route.yaml b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-http-route.yaml index 20b0a61c..b896c95a 100644 --- a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-http-route.yaml +++ b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-http-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: http to: kind: Service - name: {{ .Release.Name }}-service-device-registry + name: {{ printf "%s-service-device-registry" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-https-route.yaml b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-https-route.yaml index eba3e15c..47e113cd 100644 --- a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-https-route.yaml +++ b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-https-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ .Release.Name }}-service-device-registry + name: {{ printf "%s-service-device-registry" ( include "hono.fullname" . ) }} {{- end }} 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 3e93205f..a6bac3cd 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" .Release.Name "post-install" | quote }} + name: {{ printf "%s-%s" ( include "hono.fullname" . ) "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" .Release.Name }} + name: {{ printf "%s-post-install-device-registry-conf" ( include "hono.fullname" . ) }} 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 4749f864..a00cda38 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" .Release.Name | quote }} + host: {{ printf "%s-service-auth" ( include "hono.fullname" . ) | 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 b0fd79ad..d050b7b3 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" .Release.Name $args.name | quote }} + claimName: {{ printf "%s-%s" ( include "hono.fullname" . ) $args.name | quote }} {{- end }} diff --git a/charts/hono/templates/hono-service-device-registry-jdbc/hono-service-device-registry-secret.yaml b/charts/hono/templates/hono-service-device-registry-jdbc/hono-service-device-registry-secret.yaml index 472818cb..ab525c15 100644 --- a/charts/hono/templates/hono-service-device-registry-jdbc/hono-service-device-registry-secret.yaml +++ b/charts/hono/templates/hono-service-device-registry-jdbc/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" .Release.Name | quote }} + host: {{ printf "%s-service-auth" ( include "hono.fullname" . ) | quote }} port: 5671 trustStorePath: "/opt/hono/tls/ca.crt" hostnameVerificationRequired: false 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 d293182d..e1797b3a 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" .Release.Name | quote }} + host: {{ printf "%s-service-auth" ( include "hono.fullname" . ) | quote }} port: 5671 trustStorePath: "/opt/hono/tls/ca.crt" hostnameVerificationRequired: false @@ -63,7 +63,7 @@ stringData: {{- if not ( empty .Values.deviceRegistryExample.mongoDBBasedDeviceRegistry.mongodb ) }} {{- .Values.deviceRegistryExample.mongoDBBasedDeviceRegistry.mongodb | toYaml | nindent 8 }} {{- else }} - host: {{ printf "%s-%s" .Release.Name .Values.mongodb.nameOverride | quote }} + host: {{ printf "%s-%s" ( include "hono.fullname" . ) .Values.mongodb.nameOverride | quote }} port: {{ .Values.mongodb.service.port }} dbName: {{ first .Values.mongodb.auth.databases | quote }} username: {{ first .Values.mongodb.auth.usernames | quote }} diff --git a/charts/hono/templates/prometheus/prometheus-config.yaml b/charts/hono/templates/prometheus/prometheus-config.yaml index a5efc9d3..a2d6288c 100644 --- a/charts/hono/templates/prometheus/prometheus-config.yaml +++ b/charts/hono/templates/prometheus/prometheus-config.yaml @@ -47,7 +47,7 @@ data: - {{ .Release.Namespace }} selectors: - role: pod - label: {{ printf "app.kubernetes.io/instance=%s,helm.sh/chart=%s" .Release.Name ( include "hono.chart" . ) }} + label: {{ printf "app.kubernetes.io/instance=%s,helm.sh/chart=%s" ( include "hono.fullname" . ) ( include "hono.chart" . ) }} relabel_configs: - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] From eec3a50491b3a41c570771c3b5d4d58507734197 Mon Sep 17 00:00:00 2001 From: Dirk Van Haerenborgh Date: Fri, 21 Oct 2022 10:38:58 +0200 Subject: [PATCH 02/22] fix remarks Signed-off-by: Dirk Van Haerenborgh --- charts/hono/README.md | 6 +++- .../hono/config/infinispan/hono-data-grid.xml | 10 +++---- charts/hono/config/router/qdrouterd.json | 6 ++-- .../add_example_data_device_registry.sh | 2 +- charts/hono/templates/NOTES.txt | 28 +++++++++---------- .../example-data-grid/statefulset.yaml | 6 ++-- charts/hono/values.yaml | 2 +- 7 files changed, 32 insertions(+), 28 deletions(-) diff --git a/charts/hono/README.md b/charts/hono/README.md index 65eacf8f..f4f9ec6d 100644 --- a/charts/hono/README.md +++ b/charts/hono/README.md @@ -143,6 +143,10 @@ The command removes all the Kubernetes components associated with the chart and * Update to MongoDB chart version 13.x (using Mongo DB 6.x). * Limit Kafka and Zookeeper JVM's memory consumption. +### 2.2.1 + +* Allow customizing the pod/service names irrespective or .Release.Name + ### 2.2.0 * Use Hono 2.2.0 container images. @@ -403,7 +407,7 @@ amqpMessagingNetworkExample: # mount (existing) Kubernetes secret which contains # credentials for connecting to AMQP network -# into Command Router and protocol adapter containers +# into Command Router and protocol adapter containers commandRouterService: extraVolumes: - name: "amqp-network" diff --git a/charts/hono/config/infinispan/hono-data-grid.xml b/charts/hono/config/infinispan/hono-data-grid.xml index 654b3ea3..eb94ca92 100644 --- a/charts/hono/config/infinispan/hono-data-grid.xml +++ b/charts/hono/config/infinispan/hono-data-grid.xml @@ -1,14 +1,14 @@ - diff --git a/charts/hono/config/router/qdrouterd.json b/charts/hono/config/router/qdrouterd.json index 14d4c215..d60ba6fb 100644 --- a/charts/hono/config/router/qdrouterd.json +++ b/charts/hono/config/router/qdrouterd.json @@ -1,6 +1,6 @@ [ ["router", { - "id": "{{ .Release.Name }}.Example.Router", + "id": "{{ include "hono.fullname" . }}.Example.Router", "mode": "standalone", "workerThreads": 3 }], @@ -13,7 +13,7 @@ ["authServicePlugin", { "name": "Hono Auth", - "host": "{{ .Release.Name }}-service-auth", + "host": "{{ include "hono.fullname" . }}-service-auth", "port": 5671, "sslProfile": "auth-server-profile" }], @@ -92,7 +92,7 @@ "host": "{{ .Values.amqpMessagingNetworkExample.broker.servicebus.host }}", "idleTimeoutSeconds": 120 {{- else }} - "host": "{{ .Release.Name }}-artemis", + "host": "{{ include "hono.fullname" . }}-artemis", "verifyHostname": false {{- end }} }], diff --git a/charts/hono/example/add_example_data_device_registry.sh b/charts/hono/example/add_example_data_device_registry.sh index 06252402..c74ef4dd 100755 --- a/charts/hono/example/add_example_data_device_registry.sh +++ b/charts/hono/example/add_example_data_device_registry.sh @@ -11,7 +11,7 @@ # # SPDX-License-Identifier: EPL-2.0 #******************************************************************************* -HTTP_BASE_URL="http://{{ .Release.Name }}-service-device-registry:8080/v1" +HTTP_BASE_URL="http://{{ include "hono.fullname" . }}-service-device-registry:8080/v1" check_status() { EXIT_STATUS=$1 diff --git a/charts/hono/templates/NOTES.txt b/charts/hono/templates/NOTES.txt index fc203bf8..b6c016f2 100644 --- a/charts/hono/templates/NOTES.txt +++ b/charts/hono/templates/NOTES.txt @@ -14,41 +14,41 @@ The output should look similar to this: NAME {{ "READY STATUS RESTARTS AGE" | indent ( len .Release.Name ) }} {{- if .Values.adapters.amqp.enabled }} -{{ .Release.Name }}-adapter-amqp-65cfb4d675-g5wn4 1/1 Running 0 5m50s +{{ include "hono.fullname" . }}-adapter-amqp-65cfb4d675-g5wn4 1/1 Running 0 5m50s {{- end }} {{- if .Values.adapters.coap.enabled }} -{{ .Release.Name }}-adapter-coap-786b784f47-qx9tg 1/1 Running 0 5m51s +{{ include "hono.fullname" . }}-adapter-coap-786b784f47-qx9tg 1/1 Running 0 5m51s {{- end }} {{- if .Values.adapters.http.enabled }} -{{ .Release.Name }}-adapter-http-66bd6bb89c-mng5t 1/1 Running 0 5m51s +{{ include "hono.fullname" . }}-adapter-http-66bd6bb89c-mng5t 1/1 Running 0 5m51s {{- end }} {{- if .Values.adapters.lora.enabled }} -{{ .Release.Name }}-adapter-lora-341fca588c-1hl8n 1/1 Running 0 5m51s +{{ include "hono.fullname" . }}-adapter-lora-341fca588c-1hl8n 1/1 Running 0 5m51s {{- end }} {{- if .Values.adapters.mqtt.enabled }} -{{ .Release.Name }}-adapter-mqtt-765fcd578b-5rl7n 1/1 Running 0 5m51s +{{ include "hono.fullname" . }}-adapter-mqtt-765fcd578b-5rl7n 1/1 Running 0 5m51s {{- end }} {{- if ( has "amqp" .Values.messagingNetworkTypes ) }} -{{ .Release.Name }}-artemis-f8f7dc7f4-864cj 1/1 Running 0 5m51s -{{ .Release.Name }}-dispatch-router-6c77dc78bd-hjn4l 1/1 Running 0 5m51s +{{ include "hono.fullname" . }}-artemis-f8f7dc7f4-864cj 1/1 Running 0 5m51s +{{ include "hono.fullname" . }}-dispatch-router-6c77dc78bd-hjn4l 1/1 Running 0 5m51s {{- end }} {{- if ( has "kafka" .Values.messagingNetworkTypes ) }} -{{ .Release.Name }}-kafka-0 1/1 Running 0 5m51s +{{ include "hono.fullname" . }}-kafka-0 1/1 Running 0 5m51s {{- end }} {{- if all .Values.deviceRegistryExample.enabled ( eq .Values.deviceRegistryExample.type "mongodb" ) }} -{{ .Release.Name }}-monogodb-server-77ffb85c97-78554 1/1 Running 0 5m51s +{{ include "hono.fullname" . }}-monogodb-server-77ffb85c97-78554 1/1 Running 0 5m51s {{- end }} -{{ .Release.Name }}-service-auth-84d9695cfc-5wlfh 1/1 Running 0 5m51s -{{ .Release.Name }}-service-command-router-687fd4fbcf-7527b 1/1 Running 0 5m51s +{{ include "hono.fullname" . }}-service-auth-84d9695cfc-5wlfh 1/1 Running 0 5m51s +{{ include "hono.fullname" . }}-service-command-router-687fd4fbcf-7527b 1/1 Running 0 5m51s {{- if .Values.deviceRegistryExample.enabled }} {{- if eq .Values.deviceRegistryExample.type "embedded" }} -{{ .Release.Name }}-service-device-registry-0 1/1 Running 0 5m51s +{{ include "hono.fullname" . }}-service-device-registry-0 1/1 Running 0 5m51s {{- else }} -{{ .Release.Name }}-service-device-registry-64d645dd9c-q9c5q 1/1 Running 0 5m51s +{{ include "hono.fullname" . }}-service-device-registry-64d645dd9c-q9c5q 1/1 Running 0 5m51s {{- end }} {{- end }} {{- if ( has "kafka" .Values.messagingNetworkTypes ) }} -{{ .Release.Name }}-zookeeper-0 1/1 Running 0 5m51s +{{ include "hono.fullname" . }}-zookeeper-0 1/1 Running 0 5m51s {{- end }} Once all pods have reached the READY state, you can start using Hono. diff --git a/charts/hono/templates/example-data-grid/statefulset.yaml b/charts/hono/templates/example-data-grid/statefulset.yaml index 561b95fa..37757441 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.name" .) $args.name }} + serviceName: {{ printf "%s-%s" (include "hono.fullname" .) $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.name" .) $args.name }} + value: {{ printf "-Djgroups.dns.query=%s-%s" (include "hono.fullname" .) $args.name }} ports: - name: hotrod containerPort: 11222 @@ -74,5 +74,5 @@ spec: volumes: - name: conf configMap: - name: {{ printf "%s-%s-conf" (include "hono.name" .) $args.name }} + name: {{ printf "%s-%s-conf" (include "hono.fullname" .) $args.name }} {{- end }} diff --git a/charts/hono/values.yaml b/charts/hono/values.yaml index 48699b66..39b2adc6 100755 --- a/charts/hono/values.yaml +++ b/charts/hono/values.yaml @@ -1708,7 +1708,7 @@ kafka: type: "pem" pemChainIncluded: true existingSecrets: - - "{{ .Release.Name }}-kafka-example-keys" + - "{{ include \"hono.fullname\" . }}-kafka-example-keys" service: ports: From 02d4845de5ec3084a304aefcc94d8a5dc3422de2 Mon Sep 17 00:00:00 2001 From: Dirk Van Haerenborgh Date: Tue, 15 Nov 2022 13:09:31 +0100 Subject: [PATCH 03/22] let hono.name/hono.fullname accept a template string --- charts/hono/templates/_helpers.tpl | 11 +++++++---- charts/hono/values.yaml | 5 +++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index 8169f873..12e616e2 100644 --- a/charts/hono/templates/_helpers.tpl +++ b/charts/hono/templates/_helpers.tpl @@ -16,7 +16,8 @@ Expand the name of the chart. */}} {{- define "hono.name" -}} - {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} + {{- $nameOverride := .Values.global.hono.nameOverride -}} + {{- empty $nameOverride | ternary .Chart.Name (tpl $nameOverride $) | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* @@ -25,10 +26,12 @@ 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" -}} - {{- if .Values.fullnameOverride -}} - {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} + {{- $fullnameOverride := .Values.global.hono.fullnameOverride -}} + {{- if $fullnameOverride -}} + {{- (tpl $fullnameOverride $) | trunc 63 | trimSuffix "-" -}} {{- else -}} - {{- $name := default .Chart.Name .Values.nameOverride -}} + {{- $nameOverride := .Values.global.hono.nameOverride -}} + {{- $name := empty $nameOverride | ternary .Chart.Name (tpl $nameOverride $) -}} {{- if contains $name .Release.Name -}} {{- .Release.Name | trunc 63 | trimSuffix "-" -}} {{- else -}} diff --git a/charts/hono/values.yaml b/charts/hono/values.yaml index 39b2adc6..e13c60ab 100755 --- a/charts/hono/values.yaml +++ b/charts/hono/values.yaml @@ -14,6 +14,11 @@ # Default values for eclipse-hono. # Declare variables to be passed into your templates. +global: + hono: + nameOverride: "" + fullnameOverride: "" + # honoImagesTag contains the (common) tag name of the Hono component # container images to deploy. # If not set explicitly, the chart's appVersion is used as the tag name. From 59325fb2bf18ef8495ac003c4656e74a08aa659a Mon Sep 17 00:00:00 2001 From: Dirk Van Haerenborgh Date: Mon, 12 Dec 2022 15:21:55 +0100 Subject: [PATCH 04/22] fix kafka subchart nameoverride Signed-off-by: Dirk Van Haerenborgh --- charts/hono/templates/_helpers.tpl | 44 +++++++++---------- .../example-data-grid/statefulset.yaml | 4 +- ...evice-registry-post-install-configmap.yaml | 3 +- ...vice-device-registry-post-install-job.yaml | 4 +- .../hono-service-device-registry-secret.yaml | 2 +- ...o-service-device-registry-statefulset.yaml | 2 +- .../hono-service-device-registry-secret.yaml | 2 +- .../hono-service-device-registry-secret.yaml | 4 +- .../templates/kafka/kafka-example-keys.yaml | 2 +- charts/hono/values.yaml | 8 ++-- .../templates/post-install-job.yaml | 3 +- 11 files changed, 39 insertions(+), 39 deletions(-) diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index 12e616e2..aa053799 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" @@ -613,22 +613,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 a6bac3cd..1fe5c69f 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 a00cda38..005ab729 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 d050b7b3..73d81f2a 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-jdbc/hono-service-device-registry-secret.yaml b/charts/hono/templates/hono-service-device-registry-jdbc/hono-service-device-registry-secret.yaml index ab525c15..3d736b20 100644 --- a/charts/hono/templates/hono-service-device-registry-jdbc/hono-service-device-registry-secret.yaml +++ b/charts/hono/templates/hono-service-device-registry-jdbc/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-mongodb/hono-service-device-registry-secret.yaml b/charts/hono/templates/hono-service-device-registry-mongodb/hono-service-device-registry-secret.yaml index e1797b3a..6132a194 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 @@ -63,7 +63,7 @@ stringData: {{- if not ( empty .Values.deviceRegistryExample.mongoDBBasedDeviceRegistry.mongodb ) }} {{- .Values.deviceRegistryExample.mongoDBBasedDeviceRegistry.mongodb | toYaml | nindent 8 }} {{- else }} - host: {{ printf "%s-%s" ( include "hono.fullname" . ) .Values.mongodb.nameOverride | quote }} + host: {{ printf "%s-%s" ( include "hono.fullname" $args ) .Values.mongodb.nameOverride | quote }} port: {{ .Values.mongodb.service.port }} dbName: {{ first .Values.mongodb.auth.databases | quote }} username: {{ first .Values.mongodb.auth.usernames | quote }} 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 e13c60ab..45dc30db 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. @@ -1713,7 +1711,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 ae7a7897..826fe6d4 100644 --- a/packages/cloud2edge/templates/post-install-job.yaml +++ b/packages/cloud2edge/templates/post-install-job.yaml @@ -67,7 +67,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}} From f748aeed45d917e9245be718c3fd5d095f5ea497 Mon Sep 17 00:00:00 2001 From: Dirk Van Haerenborgh Date: Mon, 12 Dec 2022 15:45:13 +0100 Subject: [PATCH 05/22] fix openshift routes Signed-off-by: Dirk Van Haerenborgh --- charts/hono/templates/_helpers.tpl | 2 +- .../templates/dispatch-router/dispatch-router-route.yaml | 2 +- .../templates/dispatch-router/dispatch-router-secret.yaml | 1 + charts/hono/templates/example-data-grid/configmap.yaml | 3 ++- charts/hono/templates/example-data-grid/statefulset.yaml | 2 +- .../hono-adapter-amqp/hono-adapter-amqp-route.yaml | 2 +- .../hono-adapter-amqp/hono-adapter-amqp-sec-route.yaml | 2 +- .../hono-adapter-http/hono-adapter-http-route.yaml | 2 +- .../hono-adapter-http/hono-adapter-http-sec-route.yaml | 2 +- .../hono-adapter-lora/hono-adapter-lora-route.yaml | 2 +- .../hono-adapter-lora/hono-adapter-lora-sec-route.yaml | 2 +- .../hono-adapter-mqtt/hono-adapter-mqtt-route.yaml | 2 +- .../hono-adapter-mqtt/hono-adapter-mqtt-sec-route.yaml | 2 +- .../hono-service-auth/hono-service-auth-route.yaml | 2 +- .../hono-service-command-router-rolebinding.yaml | 4 ++-- .../hono-service-command-router-route.yaml | 2 +- .../hono-service-command-router-secret.yaml | 6 +++--- .../hono-service-device-registry-amqps-route.yaml | 2 +- .../hono-service-device-registry-http-route.yaml | 2 +- .../hono-service-device-registry-https-route.yaml | 2 +- charts/hono/templates/prometheus/prometheus-config.yaml | 2 +- 21 files changed, 25 insertions(+), 23 deletions(-) diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index aa053799..92c31c89 100644 --- a/charts/hono/templates/_helpers.tpl +++ b/charts/hono/templates/_helpers.tpl @@ -240,7 +240,7 @@ messaging: {{- if .dot.Values.amqpMessagingNetworkExample.enabled }} name: {{ printf "Hono %s" .component | quote }} amqpHostname: "hono-internal" - host: {{ printf "%s-dispatch-router" ( include "hono.fullname" .dot ) | quote }} + host: {{ printf "%s-dispatch-router" ( include "hono.fullname" . ) | quote }} port: 5673 keyPath: {{ .dot.Values.adapters.amqpMessagingNetworkSpec.keyPath | quote }} certPath: {{ .dot.Values.adapters.amqpMessagingNetworkSpec.certPath | quote }} diff --git a/charts/hono/templates/dispatch-router/dispatch-router-route.yaml b/charts/hono/templates/dispatch-router/dispatch-router-route.yaml index 730d7b8b..53656434 100644 --- a/charts/hono/templates/dispatch-router/dispatch-router-route.yaml +++ b/charts/hono/templates/dispatch-router/dispatch-router-route.yaml @@ -24,5 +24,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-dispatch-router-ext" ( include "hono.fullname" . ) }} + name: {{ printf "%s-dispatch-router-ext" ( include "hono.fullname" $args ) }} {{- end }} diff --git a/charts/hono/templates/dispatch-router/dispatch-router-secret.yaml b/charts/hono/templates/dispatch-router/dispatch-router-secret.yaml index 78232e42..f021c8cc 100644 --- a/charts/hono/templates/dispatch-router/dispatch-router-secret.yaml +++ b/charts/hono/templates/dispatch-router/dispatch-router-secret.yaml @@ -20,6 +20,7 @@ metadata: type: Opaque stringData: "qdrouterd.json": | + {{- $_ := set $ "dot" $args.dot }} {{- tpl ( .Files.Get "config/router/qdrouterd.json" ) . | nindent 4 }} "broker-password": {{ .Values.amqpMessagingNetworkExample.broker.saslPassword }} {{- end }} diff --git a/charts/hono/templates/example-data-grid/configmap.yaml b/charts/hono/templates/example-data-grid/configmap.yaml index 45059bc5..e958eec7 100644 --- a/charts/hono/templates/example-data-grid/configmap.yaml +++ b/charts/hono/templates/example-data-grid/configmap.yaml @@ -18,7 +18,8 @@ metadata: {{- include "hono.metadata" $args | nindent 2 }} data: hono-data-grid.xml: | - {{- tpl ( .Files.Get "config/infinispan/hono-data-grid.xml" ) . | nindent 4 }} + {{- $_ := set $ "dot" $args.dot }} + {{- tpl ( .Files.Get "config/infinispan/hono-data-grid.xml" ) $ | nindent 4 }} users.properties: | {{ printf "%s=%s" .Values.dataGridExample.authUsername .Values.dataGridExample.authPassword }} public-groups.properties: | diff --git a/charts/hono/templates/example-data-grid/statefulset.yaml b/charts/hono/templates/example-data-grid/statefulset.yaml index f21ac8e0..1a2ba8a6 100644 --- a/charts/hono/templates/example-data-grid/statefulset.yaml +++ b/charts/hono/templates/example-data-grid/statefulset.yaml @@ -74,5 +74,5 @@ spec: volumes: - name: conf configMap: - name: {{ printf "%s-%s-conf" (include "hono.fullname" .) $args.name }} + name: {{ printf "%s-%s-conf" (include "hono.fullname" $args) $args.name }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-route.yaml b/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-route.yaml index ea7e34de..d50d45e6 100644 --- a/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-route.yaml +++ b/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: amqp to: kind: Service - name: {{ printf "%s-adapter-amqp" ( include "hono.fullname" . ) }} + name: {{ printf "%s-adapter-amqp" ( include "hono.fullname" $args ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-sec-route.yaml b/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-sec-route.yaml index dd3ddbf1..666d9153 100644 --- a/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-sec-route.yaml +++ b/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-sec-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-adapter-amqp" ( include "hono.fullname" . ) }} + name: {{ printf "%s-adapter-amqp" ( include "hono.fullname" $args ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-http/hono-adapter-http-route.yaml b/charts/hono/templates/hono-adapter-http/hono-adapter-http-route.yaml index 313bc54b..9fd9dfd9 100644 --- a/charts/hono/templates/hono-adapter-http/hono-adapter-http-route.yaml +++ b/charts/hono/templates/hono-adapter-http/hono-adapter-http-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: http to: kind: Service - name: {{ printf "%s-adapter-http" ( include "hono.fullname" . ) }} + name: {{ printf "%s-adapter-http" ( include "hono.fullname" $args ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-http/hono-adapter-http-sec-route.yaml b/charts/hono/templates/hono-adapter-http/hono-adapter-http-sec-route.yaml index c4941b39..5f88128f 100644 --- a/charts/hono/templates/hono-adapter-http/hono-adapter-http-sec-route.yaml +++ b/charts/hono/templates/hono-adapter-http/hono-adapter-http-sec-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-adapter-http" ( include "hono.fullname" . ) }} + name: {{ printf "%s-adapter-http" ( include "hono.fullname" $args ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-route.yaml b/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-route.yaml index cd444fc4..5018dc99 100644 --- a/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-route.yaml +++ b/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: http to: kind: Service - name: {{ printf "%s-adapter-lora" ( include "hono.fullname" . ) }} + name: {{ printf "%s-adapter-lora" ( include "hono.fullname" $args ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-sec-route.yaml b/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-sec-route.yaml index cd276266..fa8ae36c 100644 --- a/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-sec-route.yaml +++ b/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-sec-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-adapter-lora" ( include "hono.fullname" . ) }} + name: {{ printf "%s-adapter-lora" ( include "hono.fullname" $args ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-route.yaml b/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-route.yaml index b3eea192..11807605 100644 --- a/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-route.yaml +++ b/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: mqtt to: kind: Service - name: {{ printf "%s-adapter-mqtt" ( include "hono.fullname" . ) }} + name: {{ printf "%s-adapter-mqtt" ( include "hono.fullname" $args ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-sec-route.yaml b/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-sec-route.yaml index b10db49f..5155b08a 100644 --- a/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-sec-route.yaml +++ b/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-sec-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-adapter-mqtt" ( include "hono.fullname" . ) }} + name: {{ printf "%s-adapter-mqtt" ( include "hono.fullname" $args ) }} {{- end }} diff --git a/charts/hono/templates/hono-service-auth/hono-service-auth-route.yaml b/charts/hono/templates/hono-service-auth/hono-service-auth-route.yaml index 1ba037eb..5d8509e7 100644 --- a/charts/hono/templates/hono-service-auth/hono-service-auth-route.yaml +++ b/charts/hono/templates/hono-service-auth/hono-service-auth-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-service-auth" ( include "hono.fullname" . ) }} + name: {{ printf "%s-service-auth" ( include "hono.fullname" $args ) }} {{- end }} diff --git a/charts/hono/templates/hono-service-command-router/hono-service-command-router-rolebinding.yaml b/charts/hono/templates/hono-service-command-router/hono-service-command-router-rolebinding.yaml index ab9c0ae3..bb16d6de 100644 --- a/charts/hono/templates/hono-service-command-router/hono-service-command-router-rolebinding.yaml +++ b/charts/hono/templates/hono-service-command-router/hono-service-command-router-rolebinding.yaml @@ -5,9 +5,9 @@ metadata: {{- include "hono.metadata" $args | nindent 2 }} roleRef: kind: Role - name: {{ printf "%s-%s" ( include "hono.fullname" . ) $args.name | quote }} + name: {{ printf "%s-%s" ( include "hono.fullname" $args ) $args.name | quote }} apiGroup: rbac.authorization.k8s.io subjects: - kind: ServiceAccount - name: {{ printf "%s-%s" ( include "hono.fullname" . ) $args.name | quote }} + name: {{ printf "%s-%s" ( include "hono.fullname" $args ) $args.name | quote }} namespace: {{ .Release.Namespace }} diff --git a/charts/hono/templates/hono-service-command-router/hono-service-command-router-route.yaml b/charts/hono/templates/hono-service-command-router/hono-service-command-router-route.yaml index 931b4f9b..25ea1864 100644 --- a/charts/hono/templates/hono-service-command-router/hono-service-command-router-route.yaml +++ b/charts/hono/templates/hono-service-command-router/hono-service-command-router-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: 5671 to: kind: Service - name: {{ printf "%s-service-command-router" ( include "hono.fullname" . ) }} + name: {{ printf "%s-service-command-router" ( include "hono.fullname" $args ) }} {{end}} diff --git a/charts/hono/templates/hono-service-command-router/hono-service-command-router-secret.yaml b/charts/hono/templates/hono-service-command-router/hono-service-command-router-secret.yaml index 4dab06b2..3205e474 100644 --- a/charts/hono/templates/hono-service-command-router/hono-service-command-router-secret.yaml +++ b/charts/hono/templates/hono-service-command-router/hono-service-command-router-secret.yaml @@ -33,7 +33,7 @@ stringData: {{- if .Values.commandRouterService.hono.auth }} {{- .Values.commandRouterService.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 @@ -56,7 +56,7 @@ stringData: {{- .Values.dataGridSpec | toYaml | nindent 12 }} {{- else if .Values.dataGridExample.enabled }} remote: - {{- $serverName := printf "%s-data-grid" ( include "hono.fullname" . ) }} + {{- $serverName := printf "%s-data-grid" ( include "hono.fullname" $args ) }} serverList: {{ printf "%s:11222" $serverName | quote }} authServerName: {{ $serverName | quote }} authUsername: {{ .Values.dataGridExample.authUsername | quote }} @@ -82,7 +82,7 @@ stringData: {{- if .Values.amqpMessagingNetworkExample.enabled }} name: {{ printf "Hono %s" $args.component | quote }} amqpHostname: hono-internal - host: {{ ( include "hono.fullname" . ) }}-dispatch-router + host: {{ ( include "hono.fullname" $args ) }}-dispatch-router port: 5673 keyPath: {{ .Values.adapters.commandAndControlSpec.keyPath }} certPath: {{ .Values.adapters.commandAndControlSpec.certPath }} diff --git a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-amqps-route.yaml b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-amqps-route.yaml index d59970f9..c101c6cb 100644 --- a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-amqps-route.yaml +++ b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-amqps-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-service-device-registry" ( include "hono.fullname" . ) }} + name: {{ printf "%s-service-device-registry" ( include "hono.fullname" $args ) }} {{- end }} diff --git a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-http-route.yaml b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-http-route.yaml index b896c95a..7b0b0bbe 100644 --- a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-http-route.yaml +++ b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-http-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: http to: kind: Service - name: {{ printf "%s-service-device-registry" ( include "hono.fullname" . ) }} + name: {{ printf "%s-service-device-registry" ( include "hono.fullname" $args ) }} {{- end }} diff --git a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-https-route.yaml b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-https-route.yaml index 47e113cd..250418cf 100644 --- a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-https-route.yaml +++ b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-https-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-service-device-registry" ( include "hono.fullname" . ) }} + name: {{ printf "%s-service-device-registry" ( include "hono.fullname" $args ) }} {{- end }} diff --git a/charts/hono/templates/prometheus/prometheus-config.yaml b/charts/hono/templates/prometheus/prometheus-config.yaml index a2d6288c..24416e18 100644 --- a/charts/hono/templates/prometheus/prometheus-config.yaml +++ b/charts/hono/templates/prometheus/prometheus-config.yaml @@ -47,7 +47,7 @@ data: - {{ .Release.Namespace }} selectors: - role: pod - label: {{ printf "app.kubernetes.io/instance=%s,helm.sh/chart=%s" ( include "hono.fullname" . ) ( include "hono.chart" . ) }} + label: {{ printf "app.kubernetes.io/instance=%s,helm.sh/chart=%s" ( include "hono.fullname" $args ) ( include "hono.chart" $args ) }} relabel_configs: - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] From 3b9771047f14d2ed05f6aec92a778a8acca0a404 Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Wed, 10 May 2023 09:39:26 +0200 Subject: [PATCH 06/22] Add prometheus fullname Signed-off-by: Mathias Maes --- charts/hono/templates/_helpers.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index 92c31c89..48d66e94 100644 --- a/charts/hono/templates/_helpers.tpl +++ b/charts/hono/templates/_helpers.tpl @@ -485,10 +485,10 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- .Values.prometheus.server.fullnameOverride | trunc 63 | trimSuffix "-" -}} {{- else -}} {{- $name := default "prometheus" .Values.prometheus.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- printf "%s-%s" .Release.Name .Values.prometheus.server.name | trunc 63 | trimSuffix "-" -}} +{{- if contains $name ( include "hono.fullname" . ) -}} +{{- printf "%s-%s" ( include "hono.fullname" . ) .Values.prometheus.server.name | trunc 63 | trimSuffix "-" -}} {{- else -}} -{{- printf "%s-%s-%s" .Release.Name $name .Values.prometheus.server.name | trunc 63 | trimSuffix "-" -}} +{{- printf "%s-%s-%s" ( include "hono.fullname" . ) $name .Values.prometheus.server.name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{- end -}} {{- end -}} From 396d590f343f41c8d23017e31583697e67f3a863 Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Wed, 10 May 2023 09:39:45 +0200 Subject: [PATCH 07/22] Update release notes Signed-off-by: Mathias Maes --- charts/hono/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/charts/hono/README.md b/charts/hono/README.md index f4f9ec6d..593a2d6a 100644 --- a/charts/hono/README.md +++ b/charts/hono/README.md @@ -102,6 +102,9 @@ helm uninstall eclipse-hono -n hono The command removes all the Kubernetes components associated with the chart and deletes the release. ## Release Notes +### 2.5.0 + +* Allow customizing the pod/service names irrespective or .Release.Name ### 2.4.4 @@ -143,10 +146,6 @@ The command removes all the Kubernetes components associated with the chart and * Update to MongoDB chart version 13.x (using Mongo DB 6.x). * Limit Kafka and Zookeeper JVM's memory consumption. -### 2.2.1 - -* Allow customizing the pod/service names irrespective or .Release.Name - ### 2.2.0 * Use Hono 2.2.0 container images. From 4cf3db59aa90c76878b0441dd76fca8e4f417c1b Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Mon, 15 May 2023 13:43:36 +0200 Subject: [PATCH 08/22] Remove tpl function Signed-off-by: Mathias Maes --- charts/hono/templates/_helpers.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index 48d66e94..6b2a4c31 100644 --- a/charts/hono/templates/_helpers.tpl +++ b/charts/hono/templates/_helpers.tpl @@ -17,7 +17,7 @@ Expand the name of the chart. */}} {{- define "hono.name" -}} {{- $nameOverride := .dot.Values.nameOverride -}} - {{- empty $nameOverride | ternary .dot.Chart.Name (tpl $nameOverride .dot ) | trunc 63 | trimSuffix "-" -}} + {{- empty $nameOverride | ternary .dot.Chart.Name $nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* @@ -28,10 +28,10 @@ If release name contains chart name it will be used as a full name. {{- define "hono.fullname" -}} {{- $fullnameOverride := .dot.Values.fullnameOverride -}} {{- if $fullnameOverride -}} - {{- (tpl $fullnameOverride .dot) | trunc 63 | trimSuffix "-" -}} + {{- $fullnameOverride | trunc 63 | trimSuffix "-" -}} {{- else -}} {{- $nameOverride := .dot.Values.nameOverride -}} - {{- $name := empty $nameOverride | ternary .dot.Chart.Name (tpl $nameOverride .dot) -}} + {{- $name := empty $nameOverride | ternary .dot.Chart.Name $nameOverride -}} {{- if contains $name .dot.Release.Name -}} {{- .dot.Release.Name | trunc 63 | trimSuffix "-" -}} {{- else -}} From 6a06486fd4dfa3db8fab3773c2c74f8b045c0701 Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Mon, 15 May 2023 13:43:55 +0200 Subject: [PATCH 09/22] Add nameOverride for the prometheus config Signed-off-by: Mathias Maes --- charts/hono/templates/prometheus/prometheus-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/hono/templates/prometheus/prometheus-config.yaml b/charts/hono/templates/prometheus/prometheus-config.yaml index 24416e18..e23a4578 100644 --- a/charts/hono/templates/prometheus/prometheus-config.yaml +++ b/charts/hono/templates/prometheus/prometheus-config.yaml @@ -14,7 +14,7 @@ apiVersion: v1 kind: ConfigMap metadata: - {{- $args := dict "dot" . "component" "metrics" "name" "prometheus-config" }} + {{- $args := dict "dot" (. | deepCopy | merge (dict "Values" (pick .Values.prometheus.server "nameOverride" "fullnameOverride"))) "component" "metrics" "name" "prometheus-config" }} {{- include "hono.metadata" $args | nindent 2 }} data: rules: | From c65638cf1c43e5b7e0540caab538ae1447e76662 Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Tue, 16 May 2023 09:35:54 +0200 Subject: [PATCH 10/22] Fix c2e Signed-off-by: Mathias Maes --- packages/cloud2edge/templates/post-install-job.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/cloud2edge/templates/post-install-job.yaml b/packages/cloud2edge/templates/post-install-job.yaml index 826fe6d4..ae7a7897 100644 --- a/packages/cloud2edge/templates/post-install-job.yaml +++ b/packages/cloud2edge/templates/post-install-job.yaml @@ -67,8 +67,7 @@ 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" (include "hono.fullname" $args) "kafka-example-keys" }} + secretName: {{ printf "%s-%s" .Release.Name "kafka-example-keys" }} {{- end}} From 1a37f5315a75b7e48dc03b3f068e5ac1e9e23704 Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Mon, 31 Jul 2023 10:15:02 +0200 Subject: [PATCH 11/22] Remove incorrect usage of .dot --- charts/hono/templates/_helpers.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index 6b2a4c31..7358054a 100644 --- a/charts/hono/templates/_helpers.tpl +++ b/charts/hono/templates/_helpers.tpl @@ -324,7 +324,7 @@ The scope passed in is expected to be a dict with keys */}} {{- define "hono.deviceRegistryExampleClientConfig" -}} name: {{ printf "Hono %s" .component | quote }} -host: {{ printf "%s-service-device-registry" ( include "hono.fullname" .dot ) | quote }} +host: {{ printf "%s-service-device-registry" ( include "hono.fullname" . ) | quote }} port: 5671 credentialsPath: "/opt/hono/config/adapter.credentials" trustStorePath: {{ .dot.Values.deviceRegistryExample.clientTrustStorePath | default "/opt/hono/tls/ca.crt" | quote }} @@ -346,7 +346,7 @@ command: {{- if .dot.Values.amqpMessagingNetworkExample.enabled }} name: {{ printf "Hono %s" $adapter | quote }} amqpHostname: "hono-internal" - host: {{ printf "%s-dispatch-router" ( include "hono.fullname" .dot ) | quote }} + host: {{ printf "%s-dispatch-router" ( include "hono.fullname" . ) | quote }} port: 5673 keyPath: {{ .dot.Values.adapters.commandAndControlSpec.keyPath | quote }} certPath: {{ .dot.Values.adapters.commandAndControlSpec.certPath | quote }} @@ -387,7 +387,7 @@ commandRouter: {{- .dot.Values.adapters.commandRouterSpec | toYaml | nindent 2 }} {{- else }} name: {{ printf "Hono %s" $adapter | quote }} - host: {{ printf "%s-service-command-router" ( include "hono.fullname" .dot ) | quote }} + host: {{ printf "%s-service-command-router" ( include "hono.fullname" . ) | quote }} port: 5671 credentialsPath: "/opt/hono/config/adapter.credentials" trustStorePath: {{ .dot.Values.commandRouterService.clientTrustStorePath | default "/opt/hono/tls/ca.crt" | quote }} @@ -464,7 +464,7 @@ quarkus: exporter: otlp: {{- if .dot.Values.jaegerBackendExample.enabled }} - endpoint: {{ printf "http://%s-jaeger-collector:4317" ( include "hono.fullname" .dot ) | quote }} + endpoint: {{ printf "http://%s-jaeger-collector:4317" ( include "hono.fullname" . ) | quote }} {{- else }} endpoint: "http://127.0.0.1:4317" {{- end }} From 6ded13fef4d28a6d0c0a7cb900d809c22203b2f6 Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Mon, 31 Jul 2023 10:19:52 +0200 Subject: [PATCH 12/22] Add documentation to helpers --- charts/hono/templates/_helpers.tpl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index 7358054a..40bd37a4 100644 --- a/charts/hono/templates/_helpers.tpl +++ b/charts/hono/templates/_helpers.tpl @@ -14,6 +14,9 @@ {{/* Expand the name of the chart. + +The scope passed in is expected to be a dict with keys +- (mandatory) "dot": the root (".") scope */}} {{- define "hono.name" -}} {{- $nameOverride := .dot.Values.nameOverride -}} @@ -24,6 +27,9 @@ Expand the name of the chart. 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. + +The scope passed in is expected to be a dict with keys +- (mandatory) "dot": the root (".") scope */}} {{- define "hono.fullname" -}} {{- $fullnameOverride := .dot.Values.fullnameOverride -}} @@ -42,6 +48,9 @@ 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. + +The scope passed in is expected to be a dict with keys +- (mandatory) "dot": the root (".") scope */}} {{- define "hono.chart" }} {{- printf "%s-%s" .dot.Chart.Name .dot.Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} @@ -87,6 +96,9 @@ The scope passed in is expected to be a dict with keys {{/* Add standard labels for resources as recommended by Helm best practices. + +The scope passed in is expected to be a dict with keys +- (mandatory) "dot": the root (".") scope */}} {{- define "hono.std.labels" -}} app.kubernetes.io/name: {{ include "hono.name" . | quote }} From d4a976fe39b9dfbb837d41961e7852a14014db7d Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Mon, 21 Aug 2023 08:42:53 +0200 Subject: [PATCH 13/22] Apply reviews Signed-off-by: Mathias Maes --- charts/hono/README.md | 2 +- charts/hono/templates/_helpers.tpl | 10 ++++++---- charts/hono/templates/kafka/kafka-example-keys.yaml | 3 ++- .../hono/templates/prometheus/prometheus-config.yaml | 4 +++- charts/hono/values.yaml | 3 ++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/charts/hono/README.md b/charts/hono/README.md index 593a2d6a..3169d2df 100644 --- a/charts/hono/README.md +++ b/charts/hono/README.md @@ -104,7 +104,7 @@ The command removes all the Kubernetes components associated with the chart and ## Release Notes ### 2.5.0 -* Allow customizing the pod/service names irrespective or .Release.Name +* Allow customizing the pod/service names irrespective of .Release.Name. ### 2.4.4 diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index 40bd37a4..b6792831 100644 --- a/charts/hono/templates/_helpers.tpl +++ b/charts/hono/templates/_helpers.tpl @@ -278,7 +278,9 @@ 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.Values.kafka.nameOverride ( .dot.Values.kafka.service.ports.client | int ) }} + {{- $kafkaNameValues := pick .dot.Values.kafka "nameOverride" "fullnameOverride" }} + {{- $kafkaChartDotScope := dict "dot" (dict "Release" .dot.Release "Chart" (dict "Name" "kafka") "Values" $kafkaNameValues) }} + {{- $bootstrapServers := printf "%[1]s-0.%[1]s-headless:%d" ( include "hono.fullname" $kafkaChartDotScope ) ( .dot.Values.kafka.service.ports.client | int ) }} bootstrap.servers: {{ $bootstrapServers | quote }} {{- if eq .dot.Values.kafka.auth.clientProtocol "sasl_tls" }} security.protocol: "SASL_SSL" @@ -497,10 +499,10 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- .Values.prometheus.server.fullnameOverride | trunc 63 | trimSuffix "-" -}} {{- else -}} {{- $name := default "prometheus" .Values.prometheus.nameOverride -}} -{{- if contains $name ( include "hono.fullname" . ) -}} -{{- printf "%s-%s" ( include "hono.fullname" . ) .Values.prometheus.server.name | trunc 63 | trimSuffix "-" -}} +{{- if contains $name .Release.Name -}} +{{- printf "%s-%s" .Release.Name .Values.prometheus.server.name | trunc 63 | trimSuffix "-" -}} {{- else -}} -{{- printf "%s-%s-%s" ( include "hono.fullname" . ) $name .Values.prometheus.server.name | trunc 63 | trimSuffix "-" -}} +{{- printf "%s-%s-%s" .Release.Name $name .Values.prometheus.server.name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{- end -}} {{- end -}} diff --git a/charts/hono/templates/kafka/kafka-example-keys.yaml b/charts/hono/templates/kafka/kafka-example-keys.yaml index 63f9a2fd..53686352 100644 --- a/charts/hono/templates/kafka/kafka-example-keys.yaml +++ b/charts/hono/templates/kafka/kafka-example-keys.yaml @@ -14,7 +14,8 @@ apiVersion: v1 kind: Secret metadata: - {{- $args := dict "dot" (. | deepCopy | merge (dict "Values" (pick .Values.kafka "nameOverride" "fullnameOverride"))) "component" "kafka" "name" "kafka-example-keys" }} + {{/* metadata.name is set to "{fullNameOfKafkaSubChart}-example-keys" here, meaning e.g. "{ReleaseName}-kafka-example-keys", not "{ReleaseName}-hono-example-keys" */}} + {{- $args := dict "dot" (. | deepCopy | merge (dict "Values" (pick .Values.kafka "nameOverride" "fullnameOverride"))) "component" "kafka" "name" "example-keys" }} {{- include "hono.metadata" $args | nindent 2 }} type: Opaque data: diff --git a/charts/hono/templates/prometheus/prometheus-config.yaml b/charts/hono/templates/prometheus/prometheus-config.yaml index e23a4578..eab10b15 100644 --- a/charts/hono/templates/prometheus/prometheus-config.yaml +++ b/charts/hono/templates/prometheus/prometheus-config.yaml @@ -14,7 +14,9 @@ apiVersion: v1 kind: ConfigMap metadata: - {{- $args := dict "dot" (. | deepCopy | merge (dict "Values" (pick .Values.prometheus.server "nameOverride" "fullnameOverride"))) "component" "metrics" "name" "prometheus-config" }} + {{- /* prometheus chart expects metadata.name to be "{ReleaseName}-{prometheus.server.configMapOverrideName}" */}} + {{- $prometheusDotScope := . | deepCopy | merge (dict "Values" (dict "fullnameOverride" .Release.Name)) }} + {{- $args := dict "dot" $prometheusDotScope "component" "metrics" "name" .Values.prometheus.server.configMapOverrideName }} {{- include "hono.metadata" $args | nindent 2 }} data: rules: | diff --git a/charts/hono/values.yaml b/charts/hono/values.yaml index 45dc30db..455a7515 100755 --- a/charts/hono/values.yaml +++ b/charts/hono/values.yaml @@ -1711,7 +1711,8 @@ kafka: type: "pem" pemChainIncluded: true existingSecrets: - - "{{ include \"hono.fullname\" (dict \"dot\" .) }}-kafka-example-keys" + # Evaluated in kafka chart via tpl; kafka chart full name used here! + - "{{ include \"hono.fullname\" (dict \"dot\" .) }}-example-keys" service: ports: From f451c71877024d4b7284a4aa7cdea9caa3c39269 Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Fri, 25 Aug 2023 12:45:35 +0200 Subject: [PATCH 14/22] apply revisions Signed-off-by: Mathias Maes --- charts/hono/templates/_helpers.tpl | 2 ++ .../hono/templates/dispatch-router/dispatch-router-secret.yaml | 1 - .../hono-service-command-router-deployment.yaml | 2 +- charts/hono/values.yaml | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index b6792831..c29f56ce 100644 --- a/charts/hono/templates/_helpers.tpl +++ b/charts/hono/templates/_helpers.tpl @@ -14,12 +14,14 @@ {{/* Expand the name of the chart. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). The scope passed in is expected to be a dict with keys - (mandatory) "dot": the root (".") scope */}} {{- define "hono.name" -}} {{- $nameOverride := .dot.Values.nameOverride -}} + {{/* Create the Hono chart name. When nameOverride is set use it instead of the chart name. */}} {{- empty $nameOverride | ternary .dot.Chart.Name $nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} diff --git a/charts/hono/templates/dispatch-router/dispatch-router-secret.yaml b/charts/hono/templates/dispatch-router/dispatch-router-secret.yaml index f021c8cc..78232e42 100644 --- a/charts/hono/templates/dispatch-router/dispatch-router-secret.yaml +++ b/charts/hono/templates/dispatch-router/dispatch-router-secret.yaml @@ -20,7 +20,6 @@ metadata: type: Opaque stringData: "qdrouterd.json": | - {{- $_ := set $ "dot" $args.dot }} {{- tpl ( .Files.Get "config/router/qdrouterd.json" ) . | nindent 4 }} "broker-password": {{ .Values.amqpMessagingNetworkExample.broker.saslPassword }} {{- end }} diff --git a/charts/hono/templates/hono-service-command-router/hono-service-command-router-deployment.yaml b/charts/hono/templates/hono-service-command-router/hono-service-command-router-deployment.yaml index 06f71c10..4837245b 100644 --- a/charts/hono/templates/hono-service-command-router/hono-service-command-router-deployment.yaml +++ b/charts/hono/templates/hono-service-command-router/hono-service-command-router-deployment.yaml @@ -72,4 +72,4 @@ spec: {{- include "hono.component.healthChecks" $args | nindent 8 }} volumes: {{- include "hono.pod.volumes" $args | indent 6 }} - serviceAccountName: {{ printf "%s-%s" ( include "hono.fullname" . ) $args.name | quote }} + serviceAccountName: {{ printf "%s-%s" ( include "hono.fullname" $args ) $args.name | quote }} diff --git a/charts/hono/values.yaml b/charts/hono/values.yaml index 455a7515..a871770c 100755 --- a/charts/hono/values.yaml +++ b/charts/hono/values.yaml @@ -1712,7 +1712,7 @@ kafka: pemChainIncluded: true existingSecrets: # Evaluated in kafka chart via tpl; kafka chart full name used here! - - "{{ include \"hono.fullname\" (dict \"dot\" .) }}-example-keys" + - '{{ include "hono.fullname" (dict "dot" .) }}-example-keys' service: ports: From 5c0bed4eccb59926d84edd9e87f86146325b85b2 Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Tue, 29 Aug 2023 10:30:51 +0200 Subject: [PATCH 15/22] Use . scope in hono.fullname instead of .dot --- charts/hono/templates/_helpers.tpl | 34 +++++++++---------- .../dispatch-router-route.yaml | 2 +- .../example-data-grid/statefulset.yaml | 6 ++-- .../hono-adapter-amqp-route.yaml | 2 +- .../hono-adapter-amqp-sec-route.yaml | 2 +- .../hono-adapter-http-route.yaml | 2 +- .../hono-adapter-http-sec-route.yaml | 2 +- .../hono-adapter-lora-route.yaml | 2 +- .../hono-adapter-lora-sec-route.yaml | 2 +- .../hono-adapter-mqtt-route.yaml | 2 +- .../hono-adapter-mqtt-sec-route.yaml | 2 +- .../hono-service-auth-route.yaml | 2 +- ...ono-service-command-router-deployment.yaml | 2 +- ...no-service-command-router-rolebinding.yaml | 4 +-- .../hono-service-command-router-route.yaml | 2 +- .../hono-service-command-router-secret.yaml | 6 ++-- ...o-service-device-registry-amqps-route.yaml | 2 +- ...no-service-device-registry-http-route.yaml | 2 +- ...o-service-device-registry-https-route.yaml | 2 +- ...vice-device-registry-post-install-job.yaml | 4 +-- .../hono-service-device-registry-secret.yaml | 2 +- ...o-service-device-registry-statefulset.yaml | 2 +- .../hono-service-device-registry-secret.yaml | 2 +- .../hono-service-device-registry-secret.yaml | 4 +-- .../templates/kafka/kafka-example-keys.yaml | 4 ++- .../prometheus/prometheus-config.yaml | 2 +- charts/hono/values.yaml | 2 +- 27 files changed, 52 insertions(+), 50 deletions(-) diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index c29f56ce..7122eab2 100644 --- a/charts/hono/templates/_helpers.tpl +++ b/charts/hono/templates/_helpers.tpl @@ -34,16 +34,16 @@ The scope passed in is expected to be a dict with keys - (mandatory) "dot": the root (".") scope */}} {{- define "hono.fullname" -}} - {{- $fullnameOverride := .dot.Values.fullnameOverride -}} + {{- $fullnameOverride := .Values.fullnameOverride -}} {{- if $fullnameOverride -}} {{- $fullnameOverride | trunc 63 | trimSuffix "-" -}} {{- else -}} - {{- $nameOverride := .dot.Values.nameOverride -}} - {{- $name := empty $nameOverride | ternary .dot.Chart.Name $nameOverride -}} - {{- if contains $name .dot.Release.Name -}} - {{- .dot.Release.Name | trunc 63 | trimSuffix "-" -}} + {{- $nameOverride := .Values.nameOverride -}} + {{- $name := empty $nameOverride | ternary .Chart.Name $nameOverride -}} + {{- if contains $name .Release.Name -}} + {{- .Release.Name | trunc 63 | trimSuffix "-" -}} {{- else -}} - {{- printf "%s-%s" .dot.Release.Name $name | trunc 63 | trimSuffix "-" -}} + {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{- end -}} {{- end -}} @@ -119,7 +119,7 @@ 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" . ) .name | quote }} +name: {{ printf "%s-%s" (include "hono.fullname" .dot ) .name | quote }} namespace: {{ .dot.Release.Namespace | quote }} labels: app.kubernetes.io/name: {{ include "hono.name" . | quote }} @@ -254,7 +254,7 @@ messaging: {{- if .dot.Values.amqpMessagingNetworkExample.enabled }} name: {{ printf "Hono %s" .component | quote }} amqpHostname: "hono-internal" - host: {{ printf "%s-dispatch-router" ( include "hono.fullname" . ) | quote }} + host: {{ printf "%s-dispatch-router" ( include "hono.fullname" .dot ) | quote }} port: 5673 keyPath: {{ .dot.Values.adapters.amqpMessagingNetworkSpec.keyPath | quote }} certPath: {{ .dot.Values.adapters.amqpMessagingNetworkSpec.certPath | quote }} @@ -281,7 +281,7 @@ kafka: {{- if .dot.Values.kafkaMessagingClusterExample.enabled }} commonClientConfig: {{- $kafkaNameValues := pick .dot.Values.kafka "nameOverride" "fullnameOverride" }} - {{- $kafkaChartDotScope := dict "dot" (dict "Release" .dot.Release "Chart" (dict "Name" "kafka") "Values" $kafkaNameValues) }} + {{- $kafkaChartDotScope := dict "Release" .dot.Release "Chart" (dict "Name" "kafka") "Values" $kafkaNameValues }} {{- $bootstrapServers := printf "%[1]s-0.%[1]s-headless:%d" ( include "hono.fullname" $kafkaChartDotScope ) ( .dot.Values.kafka.service.ports.client | int ) }} bootstrap.servers: {{ $bootstrapServers | quote }} {{- if eq .dot.Values.kafka.auth.clientProtocol "sasl_tls" }} @@ -340,7 +340,7 @@ The scope passed in is expected to be a dict with keys */}} {{- define "hono.deviceRegistryExampleClientConfig" -}} name: {{ printf "Hono %s" .component | quote }} -host: {{ printf "%s-service-device-registry" ( include "hono.fullname" . ) | quote }} +host: {{ printf "%s-service-device-registry" ( include "hono.fullname" .dot ) | quote }} port: 5671 credentialsPath: "/opt/hono/config/adapter.credentials" trustStorePath: {{ .dot.Values.deviceRegistryExample.clientTrustStorePath | default "/opt/hono/tls/ca.crt" | quote }} @@ -362,7 +362,7 @@ command: {{- if .dot.Values.amqpMessagingNetworkExample.enabled }} name: {{ printf "Hono %s" $adapter | quote }} amqpHostname: "hono-internal" - host: {{ printf "%s-dispatch-router" ( include "hono.fullname" . ) | quote }} + host: {{ printf "%s-dispatch-router" ( include "hono.fullname" .dot ) | quote }} port: 5673 keyPath: {{ .dot.Values.adapters.commandAndControlSpec.keyPath | quote }} certPath: {{ .dot.Values.adapters.commandAndControlSpec.certPath | quote }} @@ -403,7 +403,7 @@ commandRouter: {{- .dot.Values.adapters.commandRouterSpec | toYaml | nindent 2 }} {{- else }} name: {{ printf "Hono %s" $adapter | quote }} - host: {{ printf "%s-service-command-router" ( include "hono.fullname" . ) | quote }} + host: {{ printf "%s-service-command-router" ( include "hono.fullname" .dot ) | quote }} port: 5671 credentialsPath: "/opt/hono/config/adapter.credentials" trustStorePath: {{ .dot.Values.commandRouterService.clientTrustStorePath | default "/opt/hono/tls/ca.crt" | quote }} @@ -480,7 +480,7 @@ quarkus: exporter: otlp: {{- if .dot.Values.jaegerBackendExample.enabled }} - endpoint: {{ printf "http://%s-jaeger-collector:4317" ( include "hono.fullname" . ) | quote }} + endpoint: {{ printf "http://%s-jaeger-collector:4317" ( include "hono.fullname" .dot ) | quote }} {{- else }} endpoint: "http://127.0.0.1:4317" {{- end }} @@ -629,22 +629,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" . ) .name ) $keySecretName ( eq $keySecretName "example" ) | quote }} + secretName: {{ ternary ( printf "%s-%s-example-keys" ( include "hono.fullname" .dot ) .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" . )) $trustStoreConfigMapName ( eq $trustStoreConfigMapName "example" ) | quote }} + name: {{ ternary ( printf "%s-example-trust-store" ( include "hono.fullname" .dot )) $trustStoreConfigMapName ( eq $trustStoreConfigMapName "example" ) | quote }} {{- end }} - name: "default-logging-config" configMap: - name: {{ printf "%s-default-logging-config" ( include "hono.fullname" . ) | quote }} + name: {{ printf "%s-default-logging-config" ( include "hono.fullname" .dot ) | quote }} optional: true {{- $volumeName := printf "%s-conf" .name }} - name: {{ $volumeName | quote }} secret: - secretName: {{ printf "%s-%s" ( include "hono.fullname" . ) $volumeName | quote }} + secretName: {{ printf "%s-%s" ( include "hono.fullname" .dot ) $volumeName | quote }} {{- if and .dot.Values.otelCollectorAgentConfigMap ( not .dot.Values.jaegerBackendExample.enabled ) }} - name: "otel-collector-config" configMap: diff --git a/charts/hono/templates/dispatch-router/dispatch-router-route.yaml b/charts/hono/templates/dispatch-router/dispatch-router-route.yaml index 53656434..730d7b8b 100644 --- a/charts/hono/templates/dispatch-router/dispatch-router-route.yaml +++ b/charts/hono/templates/dispatch-router/dispatch-router-route.yaml @@ -24,5 +24,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-dispatch-router-ext" ( include "hono.fullname" $args ) }} + name: {{ printf "%s-dispatch-router-ext" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/example-data-grid/statefulset.yaml b/charts/hono/templates/example-data-grid/statefulset.yaml index 1a2ba8a6..37757441 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) $args.name }} + serviceName: {{ printf "%s-%s" (include "hono.fullname" .) $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) $args.name }} + value: {{ printf "-Djgroups.dns.query=%s-%s" (include "hono.fullname" .) $args.name }} ports: - name: hotrod containerPort: 11222 @@ -74,5 +74,5 @@ spec: volumes: - name: conf configMap: - name: {{ printf "%s-%s-conf" (include "hono.fullname" $args) $args.name }} + name: {{ printf "%s-%s-conf" (include "hono.fullname" .) $args.name }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-route.yaml b/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-route.yaml index d50d45e6..ea7e34de 100644 --- a/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-route.yaml +++ b/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: amqp to: kind: Service - name: {{ printf "%s-adapter-amqp" ( include "hono.fullname" $args ) }} + name: {{ printf "%s-adapter-amqp" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-sec-route.yaml b/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-sec-route.yaml index 666d9153..dd3ddbf1 100644 --- a/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-sec-route.yaml +++ b/charts/hono/templates/hono-adapter-amqp/hono-adapter-amqp-sec-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-adapter-amqp" ( include "hono.fullname" $args ) }} + name: {{ printf "%s-adapter-amqp" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-http/hono-adapter-http-route.yaml b/charts/hono/templates/hono-adapter-http/hono-adapter-http-route.yaml index 9fd9dfd9..313bc54b 100644 --- a/charts/hono/templates/hono-adapter-http/hono-adapter-http-route.yaml +++ b/charts/hono/templates/hono-adapter-http/hono-adapter-http-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: http to: kind: Service - name: {{ printf "%s-adapter-http" ( include "hono.fullname" $args ) }} + name: {{ printf "%s-adapter-http" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-http/hono-adapter-http-sec-route.yaml b/charts/hono/templates/hono-adapter-http/hono-adapter-http-sec-route.yaml index 5f88128f..c4941b39 100644 --- a/charts/hono/templates/hono-adapter-http/hono-adapter-http-sec-route.yaml +++ b/charts/hono/templates/hono-adapter-http/hono-adapter-http-sec-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-adapter-http" ( include "hono.fullname" $args ) }} + name: {{ printf "%s-adapter-http" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-route.yaml b/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-route.yaml index 5018dc99..cd444fc4 100644 --- a/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-route.yaml +++ b/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: http to: kind: Service - name: {{ printf "%s-adapter-lora" ( include "hono.fullname" $args ) }} + name: {{ printf "%s-adapter-lora" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-sec-route.yaml b/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-sec-route.yaml index fa8ae36c..cd276266 100644 --- a/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-sec-route.yaml +++ b/charts/hono/templates/hono-adapter-lora/hono-adapter-lora-sec-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-adapter-lora" ( include "hono.fullname" $args ) }} + name: {{ printf "%s-adapter-lora" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-route.yaml b/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-route.yaml index 11807605..b3eea192 100644 --- a/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-route.yaml +++ b/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: mqtt to: kind: Service - name: {{ printf "%s-adapter-mqtt" ( include "hono.fullname" $args ) }} + name: {{ printf "%s-adapter-mqtt" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-sec-route.yaml b/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-sec-route.yaml index 5155b08a..b10db49f 100644 --- a/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-sec-route.yaml +++ b/charts/hono/templates/hono-adapter-mqtt/hono-adapter-mqtt-sec-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-adapter-mqtt" ( include "hono.fullname" $args ) }} + name: {{ printf "%s-adapter-mqtt" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-service-auth/hono-service-auth-route.yaml b/charts/hono/templates/hono-service-auth/hono-service-auth-route.yaml index 5d8509e7..1ba037eb 100644 --- a/charts/hono/templates/hono-service-auth/hono-service-auth-route.yaml +++ b/charts/hono/templates/hono-service-auth/hono-service-auth-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-service-auth" ( include "hono.fullname" $args ) }} + name: {{ printf "%s-service-auth" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-service-command-router/hono-service-command-router-deployment.yaml b/charts/hono/templates/hono-service-command-router/hono-service-command-router-deployment.yaml index 4837245b..06f71c10 100644 --- a/charts/hono/templates/hono-service-command-router/hono-service-command-router-deployment.yaml +++ b/charts/hono/templates/hono-service-command-router/hono-service-command-router-deployment.yaml @@ -72,4 +72,4 @@ spec: {{- include "hono.component.healthChecks" $args | nindent 8 }} volumes: {{- include "hono.pod.volumes" $args | indent 6 }} - serviceAccountName: {{ printf "%s-%s" ( include "hono.fullname" $args ) $args.name | quote }} + serviceAccountName: {{ printf "%s-%s" ( include "hono.fullname" . ) $args.name | quote }} diff --git a/charts/hono/templates/hono-service-command-router/hono-service-command-router-rolebinding.yaml b/charts/hono/templates/hono-service-command-router/hono-service-command-router-rolebinding.yaml index bb16d6de..ab9c0ae3 100644 --- a/charts/hono/templates/hono-service-command-router/hono-service-command-router-rolebinding.yaml +++ b/charts/hono/templates/hono-service-command-router/hono-service-command-router-rolebinding.yaml @@ -5,9 +5,9 @@ metadata: {{- include "hono.metadata" $args | nindent 2 }} roleRef: kind: Role - name: {{ printf "%s-%s" ( include "hono.fullname" $args ) $args.name | quote }} + name: {{ printf "%s-%s" ( include "hono.fullname" . ) $args.name | quote }} apiGroup: rbac.authorization.k8s.io subjects: - kind: ServiceAccount - name: {{ printf "%s-%s" ( include "hono.fullname" $args ) $args.name | quote }} + name: {{ printf "%s-%s" ( include "hono.fullname" . ) $args.name | quote }} namespace: {{ .Release.Namespace }} diff --git a/charts/hono/templates/hono-service-command-router/hono-service-command-router-route.yaml b/charts/hono/templates/hono-service-command-router/hono-service-command-router-route.yaml index 25ea1864..931b4f9b 100644 --- a/charts/hono/templates/hono-service-command-router/hono-service-command-router-route.yaml +++ b/charts/hono/templates/hono-service-command-router/hono-service-command-router-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: 5671 to: kind: Service - name: {{ printf "%s-service-command-router" ( include "hono.fullname" $args ) }} + name: {{ printf "%s-service-command-router" ( include "hono.fullname" . ) }} {{end}} diff --git a/charts/hono/templates/hono-service-command-router/hono-service-command-router-secret.yaml b/charts/hono/templates/hono-service-command-router/hono-service-command-router-secret.yaml index 3205e474..4dab06b2 100644 --- a/charts/hono/templates/hono-service-command-router/hono-service-command-router-secret.yaml +++ b/charts/hono/templates/hono-service-command-router/hono-service-command-router-secret.yaml @@ -33,7 +33,7 @@ stringData: {{- if .Values.commandRouterService.hono.auth }} {{- .Values.commandRouterService.hono.auth | toYaml | nindent 8 }} {{- else }} - host: {{ printf "%s-service-auth" ( include "hono.fullname" $args ) | quote }} + host: {{ printf "%s-service-auth" ( include "hono.fullname" . ) | quote }} port: 5671 trustStorePath: "/opt/hono/tls/ca.crt" hostnameVerificationRequired: false @@ -56,7 +56,7 @@ stringData: {{- .Values.dataGridSpec | toYaml | nindent 12 }} {{- else if .Values.dataGridExample.enabled }} remote: - {{- $serverName := printf "%s-data-grid" ( include "hono.fullname" $args ) }} + {{- $serverName := printf "%s-data-grid" ( include "hono.fullname" . ) }} serverList: {{ printf "%s:11222" $serverName | quote }} authServerName: {{ $serverName | quote }} authUsername: {{ .Values.dataGridExample.authUsername | quote }} @@ -82,7 +82,7 @@ stringData: {{- if .Values.amqpMessagingNetworkExample.enabled }} name: {{ printf "Hono %s" $args.component | quote }} amqpHostname: hono-internal - host: {{ ( include "hono.fullname" $args ) }}-dispatch-router + host: {{ ( include "hono.fullname" . ) }}-dispatch-router port: 5673 keyPath: {{ .Values.adapters.commandAndControlSpec.keyPath }} certPath: {{ .Values.adapters.commandAndControlSpec.certPath }} diff --git a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-amqps-route.yaml b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-amqps-route.yaml index c101c6cb..d59970f9 100644 --- a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-amqps-route.yaml +++ b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-amqps-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-service-device-registry" ( include "hono.fullname" $args ) }} + name: {{ printf "%s-service-device-registry" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-http-route.yaml b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-http-route.yaml index 7b0b0bbe..b896c95a 100644 --- a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-http-route.yaml +++ b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-http-route.yaml @@ -21,5 +21,5 @@ spec: targetPort: http to: kind: Service - name: {{ printf "%s-service-device-registry" ( include "hono.fullname" $args ) }} + name: {{ printf "%s-service-device-registry" ( include "hono.fullname" . ) }} {{- end }} diff --git a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-https-route.yaml b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-https-route.yaml index 250418cf..47e113cd 100644 --- a/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-https-route.yaml +++ b/charts/hono/templates/hono-service-device-registry-base/hono-service-device-registry-https-route.yaml @@ -23,5 +23,5 @@ spec: termination: passthrough to: kind: Service - name: {{ printf "%s-service-device-registry" ( include "hono.fullname" $args ) }} + name: {{ printf "%s-service-device-registry" ( include "hono.fullname" . ) }} {{- end }} 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 1fe5c69f..a6bac3cd 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" $args ) "post-install" | quote }} + name: {{ printf "%s-%s" ( include "hono.fullname" . ) "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" $args ) }} + name: {{ printf "%s-post-install-device-registry-conf" ( include "hono.fullname" . ) }} 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 005ab729..a00cda38 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" $args ) | quote }} + host: {{ printf "%s-service-auth" ( include "hono.fullname" . ) | 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 73d81f2a..d050b7b3 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 ) $args.name | quote }} + claimName: {{ printf "%s-%s" ( include "hono.fullname" . ) $args.name | quote }} {{- end }} diff --git a/charts/hono/templates/hono-service-device-registry-jdbc/hono-service-device-registry-secret.yaml b/charts/hono/templates/hono-service-device-registry-jdbc/hono-service-device-registry-secret.yaml index 3d736b20..ab525c15 100644 --- a/charts/hono/templates/hono-service-device-registry-jdbc/hono-service-device-registry-secret.yaml +++ b/charts/hono/templates/hono-service-device-registry-jdbc/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" $args ) | quote }} + host: {{ printf "%s-service-auth" ( include "hono.fullname" . ) | quote }} port: 5671 trustStorePath: "/opt/hono/tls/ca.crt" hostnameVerificationRequired: false 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 6132a194..e1797b3a 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" $args ) | quote }} + host: {{ printf "%s-service-auth" ( include "hono.fullname" . ) | quote }} port: 5671 trustStorePath: "/opt/hono/tls/ca.crt" hostnameVerificationRequired: false @@ -63,7 +63,7 @@ stringData: {{- if not ( empty .Values.deviceRegistryExample.mongoDBBasedDeviceRegistry.mongodb ) }} {{- .Values.deviceRegistryExample.mongoDBBasedDeviceRegistry.mongodb | toYaml | nindent 8 }} {{- else }} - host: {{ printf "%s-%s" ( include "hono.fullname" $args ) .Values.mongodb.nameOverride | quote }} + host: {{ printf "%s-%s" ( include "hono.fullname" . ) .Values.mongodb.nameOverride | quote }} port: {{ .Values.mongodb.service.port }} dbName: {{ first .Values.mongodb.auth.databases | quote }} username: {{ first .Values.mongodb.auth.usernames | quote }} diff --git a/charts/hono/templates/kafka/kafka-example-keys.yaml b/charts/hono/templates/kafka/kafka-example-keys.yaml index 53686352..276df0d9 100644 --- a/charts/hono/templates/kafka/kafka-example-keys.yaml +++ b/charts/hono/templates/kafka/kafka-example-keys.yaml @@ -15,7 +15,9 @@ apiVersion: v1 kind: Secret metadata: {{/* metadata.name is set to "{fullNameOfKafkaSubChart}-example-keys" here, meaning e.g. "{ReleaseName}-kafka-example-keys", not "{ReleaseName}-hono-example-keys" */}} - {{- $args := dict "dot" (. | deepCopy | merge (dict "Values" (pick .Values.kafka "nameOverride" "fullnameOverride"))) "component" "kafka" "name" "example-keys" }} + {{- $kafkaNameValues := pick .Values.kafka "nameOverride" "fullnameOverride" }} + {{- $kafkaChartDotScope := dict "Release" .Release "Chart" (dict "Name" "kafka") "Values" $kafkaNameValues }} + {{- $args := dict "dot" ($kafkaChartDotScope) "component" "kafka" "name" "example-keys" }} {{- include "hono.metadata" $args | nindent 2 }} type: Opaque data: diff --git a/charts/hono/templates/prometheus/prometheus-config.yaml b/charts/hono/templates/prometheus/prometheus-config.yaml index eab10b15..d797ef65 100644 --- a/charts/hono/templates/prometheus/prometheus-config.yaml +++ b/charts/hono/templates/prometheus/prometheus-config.yaml @@ -49,7 +49,7 @@ data: - {{ .Release.Namespace }} selectors: - role: pod - label: {{ printf "app.kubernetes.io/instance=%s,helm.sh/chart=%s" ( include "hono.fullname" $args ) ( include "hono.chart" $args ) }} + label: {{ printf "app.kubernetes.io/instance=%s,helm.sh/chart=%s" ( include "hono.fullname" . ) ( include "hono.chart" $args ) }} relabel_configs: - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] diff --git a/charts/hono/values.yaml b/charts/hono/values.yaml index a871770c..001b623a 100755 --- a/charts/hono/values.yaml +++ b/charts/hono/values.yaml @@ -1712,7 +1712,7 @@ kafka: pemChainIncluded: true existingSecrets: # Evaluated in kafka chart via tpl; kafka chart full name used here! - - '{{ include "hono.fullname" (dict "dot" .) }}-example-keys' + - '{{ include "hono.fullname" . }}-example-keys' service: ports: From 49015062125ce82d3af6f43244be8104fe20d38e Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Wed, 30 Aug 2023 09:05:01 +0200 Subject: [PATCH 16/22] revert documentation --- charts/hono/templates/_helpers.tpl | 3 --- 1 file changed, 3 deletions(-) diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index 7122eab2..a47f6752 100644 --- a/charts/hono/templates/_helpers.tpl +++ b/charts/hono/templates/_helpers.tpl @@ -29,9 +29,6 @@ The scope passed in is expected to be a dict with keys 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. - -The scope passed in is expected to be a dict with keys -- (mandatory) "dot": the root (".") scope */}} {{- define "hono.fullname" -}} {{- $fullnameOverride := .Values.fullnameOverride -}} From f27ea045ab59adb983de9293b0567ad8fc08d62c Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Wed, 30 Aug 2023 09:45:46 +0200 Subject: [PATCH 17/22] remove obscure statement --- charts/hono/templates/example-data-grid/configmap.yaml | 1 - .../hono-service-device-registry-post-install-configmap.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/charts/hono/templates/example-data-grid/configmap.yaml b/charts/hono/templates/example-data-grid/configmap.yaml index e958eec7..e9f78bd0 100644 --- a/charts/hono/templates/example-data-grid/configmap.yaml +++ b/charts/hono/templates/example-data-grid/configmap.yaml @@ -18,7 +18,6 @@ metadata: {{- include "hono.metadata" $args | nindent 2 }} data: hono-data-grid.xml: | - {{- $_ := set $ "dot" $args.dot }} {{- tpl ( .Files.Get "config/infinispan/hono-data-grid.xml" ) $ | nindent 4 }} users.properties: | {{ printf "%s=%s" .Values.dataGridExample.authUsername .Values.dataGridExample.authPassword }} 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 e84d7bf8..950a9498 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,6 @@ metadata: {{- include "hono.metadata" $args | nindent 2 }} data: add_example_data_device_registry.sh: | - {{- $_ := 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 }} From 2eeec404977e49615f9fc639bdf245e667881d81 Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Wed, 30 Aug 2023 09:50:19 +0200 Subject: [PATCH 18/22] use . scope in hono.name and hono.chart --- charts/hono/templates/_helpers.tpl | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index a47f6752..151b6a26 100644 --- a/charts/hono/templates/_helpers.tpl +++ b/charts/hono/templates/_helpers.tpl @@ -15,14 +15,11 @@ {{/* Expand the name of the chart. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). - -The scope passed in is expected to be a dict with keys -- (mandatory) "dot": the root (".") scope */}} {{- define "hono.name" -}} - {{- $nameOverride := .dot.Values.nameOverride -}} + {{- $nameOverride := .Values.nameOverride -}} {{/* Create the Hono chart name. When nameOverride is set use it instead of the chart name. */}} - {{- empty $nameOverride | ternary .dot.Chart.Name $nameOverride | trunc 63 | trimSuffix "-" -}} + {{- empty $nameOverride | ternary .Chart.Name $nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* @@ -47,12 +44,9 @@ 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. - -The scope passed in is expected to be a dict with keys -- (mandatory) "dot": the root (".") scope */}} {{- define "hono.chart" }} - {{- printf "%s-%s" .dot.Chart.Name .dot.Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} + {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* @@ -100,8 +94,8 @@ The scope passed in is expected to be a dict with keys - (mandatory) "dot": the root (".") scope */}} {{- define "hono.std.labels" -}} -app.kubernetes.io/name: {{ include "hono.name" . | quote }} -helm.sh/chart: {{ include "hono.chart" . | quote }} +app.kubernetes.io/name: {{ include "hono.name" .dot | quote }} +helm.sh/chart: {{ include "hono.chart" .dot | 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 }} @@ -119,8 +113,8 @@ The scope passed in is expected to be a dict with keys name: {{ printf "%s-%s" (include "hono.fullname" .dot ) .name | quote }} namespace: {{ .dot.Release.Namespace | quote }} labels: - app.kubernetes.io/name: {{ include "hono.name" . | quote }} - helm.sh/chart: {{ include "hono.chart" . | quote }} + app.kubernetes.io/name: {{ include "hono.name" .dot | quote }} + helm.sh/chart: {{ include "hono.chart" .dot | 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 }} @@ -136,7 +130,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" . | quote }} +app.kubernetes.io/name: {{ include "hono.name" .dot | quote }} app.kubernetes.io/instance: {{ .dot.Release.Name | quote }} app.kubernetes.io/component: {{ .component | quote }} {{- end }} From 5cfb671914a88252093344abff16030320fb08f0 Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Wed, 30 Aug 2023 09:52:38 +0200 Subject: [PATCH 19/22] fix prometheus-config --- charts/hono/templates/prometheus/prometheus-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/hono/templates/prometheus/prometheus-config.yaml b/charts/hono/templates/prometheus/prometheus-config.yaml index d797ef65..60964bbe 100644 --- a/charts/hono/templates/prometheus/prometheus-config.yaml +++ b/charts/hono/templates/prometheus/prometheus-config.yaml @@ -49,7 +49,7 @@ data: - {{ .Release.Namespace }} selectors: - role: pod - label: {{ printf "app.kubernetes.io/instance=%s,helm.sh/chart=%s" ( include "hono.fullname" . ) ( include "hono.chart" $args ) }} + label: {{ printf "app.kubernetes.io/instance=%s,helm.sh/chart=%s" ( include "hono.fullname" . ) ( include "hono.chart" . ) }} relabel_configs: - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] From 1defa012a8fac27177023fa0bf54eaa811106e5a Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Wed, 30 Aug 2023 10:14:40 +0200 Subject: [PATCH 20/22] fix kafka-secret dot scope Signed-off-by: Mathias Maes --- charts/hono/templates/kafka/kafka-example-keys.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/hono/templates/kafka/kafka-example-keys.yaml b/charts/hono/templates/kafka/kafka-example-keys.yaml index 276df0d9..3ac0a0c2 100644 --- a/charts/hono/templates/kafka/kafka-example-keys.yaml +++ b/charts/hono/templates/kafka/kafka-example-keys.yaml @@ -16,7 +16,7 @@ kind: Secret metadata: {{/* metadata.name is set to "{fullNameOfKafkaSubChart}-example-keys" here, meaning e.g. "{ReleaseName}-kafka-example-keys", not "{ReleaseName}-hono-example-keys" */}} {{- $kafkaNameValues := pick .Values.kafka "nameOverride" "fullnameOverride" }} - {{- $kafkaChartDotScope := dict "Release" .Release "Chart" (dict "Name" "kafka") "Values" $kafkaNameValues }} + {{- $kafkaChartDotScope := dict "Release" .Release "Chart" (dict "Name" "kafka" "Version" .Chart.Version "AppVersion" .Chart.AppVersion) "Values" $kafkaNameValues }} {{- $args := dict "dot" ($kafkaChartDotScope) "component" "kafka" "name" "example-keys" }} {{- include "hono.metadata" $args | nindent 2 }} type: Opaque From 207c9de05db416bf2580b0245e8029f228121f63 Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Fri, 1 Sep 2023 08:37:03 +0200 Subject: [PATCH 21/22] use . instead of $ Signed-off-by: Mathias Maes --- charts/hono/templates/example-data-grid/configmap.yaml | 2 +- .../hono-service-device-registry-post-install-configmap.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/hono/templates/example-data-grid/configmap.yaml b/charts/hono/templates/example-data-grid/configmap.yaml index e9f78bd0..45059bc5 100644 --- a/charts/hono/templates/example-data-grid/configmap.yaml +++ b/charts/hono/templates/example-data-grid/configmap.yaml @@ -18,7 +18,7 @@ metadata: {{- include "hono.metadata" $args | nindent 2 }} data: hono-data-grid.xml: | - {{- tpl ( .Files.Get "config/infinispan/hono-data-grid.xml" ) $ | nindent 4 }} + {{- tpl ( .Files.Get "config/infinispan/hono-data-grid.xml" ) . | nindent 4 }} users.properties: | {{ printf "%s=%s" .Values.dataGridExample.authUsername .Values.dataGridExample.authPassword }} public-groups.properties: | 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 950a9498..7c6b25fd 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,7 @@ 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 }} + {{- 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: | From af1395dccd2408af440f9f1591bbb705bb125367 Mon Sep 17 00:00:00 2001 From: Mathias Maes Date: Tue, 5 Sep 2023 12:29:41 +0200 Subject: [PATCH 22/22] clarify hono.name more Signed-off-by: Mathias Maes --- charts/hono/templates/_helpers.tpl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/charts/hono/templates/_helpers.tpl b/charts/hono/templates/_helpers.tpl index 151b6a26..dad02139 100644 --- a/charts/hono/templates/_helpers.tpl +++ b/charts/hono/templates/_helpers.tpl @@ -13,13 +13,14 @@ {{/* vim: set filetype=mustache: */}} {{/* -Expand the name of the chart. +Expand the name of the chart using the Chart name. +If .Values.nameOverride is set use that instead of the Chart Name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} {{- define "hono.name" -}} {{- $nameOverride := .Values.nameOverride -}} - {{/* Create the Hono chart name. When nameOverride is set use it instead of the chart name. */}} - {{- empty $nameOverride | ternary .Chart.Name $nameOverride | trunc 63 | trimSuffix "-" -}} + {{- $name := empty $nameOverride | ternary .Chart.Name $nameOverride -}} + {{- trunc 63 $name | trimSuffix "-" -}} {{- end -}} {{/*