Skip to content

Commit

Permalink
allow configuring the mongodb connection using environment variables …
Browse files Browse the repository at this point in the history
…in a configmap

Signed-off-by: Bob Claerhout <claerhout.bob@gmail.com>
  • Loading branch information
BobClaerhout authored and calohmn committed Aug 17, 2021
1 parent 6f54a7c commit 2fcb53a
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/hono/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 1.9.13
version: 1.9.14
# Version of Hono being deployed by the chart
appVersion: 1.9.1
keywords:
Expand Down
15 changes: 15 additions & 0 deletions charts/hono/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,21 @@ The scope passed in is expected to be a dict with keys
{{- end }}
{{- end }}

{{/*
Adds environment variables from a given configmap
to a component's container.
The scope passed in is expected to be a dict with keys
- (mandatory) "dot": the root scope (".")
- (mandatory) "componentConfig": the component's configuration properties from the values.yaml file
*/}}
{{- define "hono.component.envConfigMap" }}
{{- if .componentConfig.envConfigMap }}
envFrom:
- configMapRef:
name: {{ .componentConfig.envConfigMap }}
{{- end }}
{{- end }}

{{/*
Add Quarkus related configuration properties to YAML file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
fieldPath: metadata.namespace
{{- include "hono.component.springEnv" $args | indent 8 }}
{{- include "hono.jaeger.clientConf" $args | indent 8 }}
{{- include "hono.component.envConfigMap" $args | indent 8 }}
volumeMounts:
{{- include "hono.container.secretVolumeMounts" $args | indent 8 }}
{{- with .Values.adapters.amqp.resources }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
fieldPath: metadata.namespace
{{- include "hono.component.springEnv" $args | indent 8 }}
{{- include "hono.jaeger.clientConf" $args | indent 8 }}
{{- include "hono.component.envConfigMap" $args | indent 8 }}
volumeMounts:
{{- include "hono.container.secretVolumeMounts" $args | indent 8 }}
{{- with .Values.adapters.coap.resources }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
fieldPath: metadata.namespace
{{- include "hono.component.springEnv" $args | indent 8 }}
{{- include "hono.jaeger.clientConf" $args | indent 8 }}
{{- include "hono.component.envConfigMap" $args | indent 8 }}
volumeMounts:
{{- include "hono.container.secretVolumeMounts" $args | indent 8 }}
{{- with .Values.adapters.http.resources }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
fieldPath: metadata.namespace
{{- include "hono.component.springEnv" $args | indent 8 }}
{{- include "hono.jaeger.clientConf" $args | indent 8 }}
{{- include "hono.component.envConfigMap" $args | indent 8 }}
volumeMounts:
{{- include "hono.container.secretVolumeMounts" $args | indent 8 }}
{{- with .Values.adapters.kura.resources }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
fieldPath: metadata.namespace
{{- include "hono.component.springEnv" $args | indent 8 }}
{{- include "hono.jaeger.clientConf" $args | indent 8 }}
{{- include "hono.component.envConfigMap" $args | indent 8 }}
volumeMounts:
{{- include "hono.container.secretVolumeMounts" $args | indent 8 }}
{{- with .Values.adapters.lora.resources }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
fieldPath: metadata.namespace
{{- include "hono.component.springEnv" $args | indent 8 }}
{{- include "hono.jaeger.clientConf" $args | indent 8 }}
{{- include "hono.component.envConfigMap" $args | indent 8 }}
volumeMounts:
{{- include "hono.container.secretVolumeMounts" $args | indent 8 }}
{{- with .Values.adapters.mqtt.resources }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
{{- include "hono.component.springEnv" $args | indent 8 }}
{{- include "hono.component.envConfigMap" $args | indent 8 }}
volumeMounts:
{{- include "hono.container.secretVolumeMounts" $args | indent 8 }}
{{- with .Values.authServer.resources }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
fieldPath: metadata.namespace
{{- include "hono.component.springEnv" $args | indent 8 }}
{{- include "hono.jaeger.clientConf" $args | indent 8 }}
{{- include "hono.component.envConfigMap" $args | indent 8 }}
volumeMounts:
{{- include "hono.container.secretVolumeMounts" $args | indent 8 }}
{{- if not ( or .Values.dataGridSpec .Values.dataGridExample.enabled ) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
fieldPath: metadata.namespace
{{- include "hono.component.springEnv" ( merge $args ( dict "additionalProfile" ( ( or .Values.dataGridSpec ( or .Values.deviceConnectionService.hono.deviceConnection.remote .Values.dataGridExample.enabled ) ) | ternary "" "embedded-cache" ) ) ) | indent 8 }}
{{- include "hono.jaeger.clientConf" $args | indent 8 }}
{{- include "hono.component.envConfigMap" $args | indent 8 }}
volumeMounts:
{{- include "hono.container.secretVolumeMounts" $args | indent 8 }}
{{- with .Values.deviceConnectionService.resources }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ spec:
fieldPath: metadata.namespace
{{- include "hono.component.springEnv" $args | indent 8 }}
{{- include "hono.jaeger.clientConf" $args | indent 8 }}
{{- include "hono.component.envConfigMap" $args | indent 8 }}
securityContext:
privileged: false
volumeMounts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ spec:
fieldPath: metadata.namespace
{{- include "hono.component.springEnv" $args | indent 8 }}
{{- include "hono.jaeger.clientConf" $args | indent 8 }}
{{- include "hono.component.envConfigMap" $args | indent 8 }}
securityContext:
privileged: false
volumeMounts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ spec:
fieldPath: metadata.namespace
{{- include "hono.component.springEnv" $args | indent 8 }}
{{- include "hono.jaeger.clientConf" $args | indent 8 }}
{{- include "hono.component.envConfigMap" $args | indent 8 }}
securityContext:
privileged: false
volumeMounts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ spec:
fieldPath: metadata.namespace
{{- include "hono.component.springEnv" $args | indent 8 }}
{{- include "hono.jaeger.clientConf" $args | indent 8 }}
{{- include "hono.component.envConfigMap" $args | indent 8 }}
securityContext:
privileged: false
volumeMounts:
Expand Down
1 change: 1 addition & 0 deletions charts/hono/templates/jaeger/jaeger-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ spec:
volumeMounts:
{{- include "hono.container.secretVolumeMounts" $args | indent 8 }}
{{- with .Values.jaegerBackendExample.resources }}
{{- include "hono.component.envConfigMap" $args | indent 8 }}
resources:
{{- . | toYaml | nindent 10 }}
{{- end }}
Expand Down
43 changes: 43 additions & 0 deletions charts/hono/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ jaegerBackendExample:
# secretName: "other-stuff"
# mountPath: "/etc/other"

# The configMap to get additional environment variables from for this deploy.
envConfigMap:

# jaegerAgentImage contains the name (including tag)
# of the container image to use for the Jaeger Agent sidecar deployed
# with Hono's components.
Expand Down Expand Up @@ -546,6 +549,9 @@ adapters:
# secretName: "other-stuff"
# mountPath: "/etc/other"

# The configMap to get additional environment variabes from for this adapter.
envConfigMap:

# hono contains the adapter's configuration properties as defined in
# https://www.eclipse.org/hono/docs/admin-guide/amqp-adapter-config/
hono:
Expand Down Expand Up @@ -640,6 +646,9 @@ adapters:
# secretName: "other-stuff"
# mountPath: "/etc/other"

# The configMap to get additional environment variabes from for this adapter.
envConfigMap:

# hono contains the adapter's configuration properties
hono:
app:
Expand Down Expand Up @@ -725,6 +734,9 @@ adapters:
# secretName: "other-stuff"
# mountPath: "/etc/other"

# The configMap to get additional environment variabes from for this adapter.
envConfigMap:

# hono contains the adapter's configuration properties as defined in
# https://www.eclipse.org/hono/docs/admin-guide/http-adapter-config/
hono:
Expand Down Expand Up @@ -819,6 +831,9 @@ adapters:
# secretName: "other-stuff"
# mountPath: "/etc/other"

# The configMap to get additional environment variabes from for this adapter.
envConfigMap:

# hono contains the adapter's configuration properties as defined in
# https://www.eclipse.org/hono/docs/admin-guide/kura-adapter-config/
hono:
Expand Down Expand Up @@ -913,6 +928,9 @@ adapters:
# secretName: "other-stuff"
# mountPath: "/etc/other"

# The configMap to get additional environment variabes from for this adapter.
envConfigMap:

# hono contains the adapter's configuration properties
hono:
app:
Expand Down Expand Up @@ -1006,6 +1024,9 @@ adapters:
# secretName: "other-stuff"
# mountPath: "/etc/other"

# The configMap to get additional environment variabes from for this adapter.
envConfigMap:

# hono contains the adapter's configuration properties as defined in
# https://www.eclipse.org/hono/docs/admin-guide/mqtt-adapter-config/
hono:
Expand Down Expand Up @@ -1094,6 +1115,9 @@ authServer:
# secretName: "other-stuff"
# mountPath: "/etc/other"

# The configMap to get additional environment variabes from for this auth server.
envConfigMap:

# hono contains the Auth Server's configuration properties as defined in
# https://www.eclipse.org/hono/docs/admin-guide/auth-server-config/
hono:
Expand Down Expand Up @@ -1264,6 +1288,9 @@ deviceRegistryExample:
# for a description of the properties' semantics.
resources:

# The configMap to get additional environment variabes from for this device registry.
envConfigMap:

# embeddedJdbcDeviceRegistry contains configuration properties specific to the
# embedded JDBC device registry.
embeddedJdbcDeviceRegistry:
Expand Down Expand Up @@ -1305,6 +1332,9 @@ deviceRegistryExample:
cpu: "1"
memory: "500Mi"

# The configMap to get additional environment variabes from for this device registry.
envConfigMap:

# mongoDBBasedDeviceRegistry contains configuration properties specific to the
# MongoDB based device registry.
mongoDBBasedDeviceRegistry:
Expand Down Expand Up @@ -1348,6 +1378,9 @@ deviceRegistryExample:
# The password to use for authenticating to the MongoDB instance.
# password:

# The configMap to get additional environment variabes from for this device registry.
envConfigMap:

# jdbcBasedDeviceRegistry contains configuration properties specific to the
# jdbc based device registry.
jdbcBasedDeviceRegistry:
Expand Down Expand Up @@ -1378,6 +1411,10 @@ deviceRegistryExample:
resources:
# registry.jdbc contains the configuration properties for device registry
# to connect to the database.

# The configMap to get additional environment variabes from for this device registry.
envConfigMap:

registry:
jdbc:
# the jdbc properties for read-only operations
Expand Down Expand Up @@ -1538,6 +1575,9 @@ deviceConnectionService:
# secretName: "key-material"
# mountPath: "/etc/tls"

# The configMap to get additional environment variabes from for this device connection service.
envConfigMap:

# hono contains the service's configuration properties as defined in
# https://www.eclipse.org/hono/docs/admin-guide/device-connection-config/
hono:
Expand Down Expand Up @@ -1658,6 +1698,9 @@ commandRouterService:
# secretName: "key-material"
# mountPath: "/etc/tls"

# The configMap to get additional environment variabes from for this command router service.
envConfigMap:

# hono contains the service's configuration properties as defined in
# https://www.eclipse.org/hono/docs/admin-guide/command-router-config/
hono:
Expand Down

0 comments on commit 2fcb53a

Please sign in to comment.