From 43624d6407ea04c1dca12588d68eb1b3c9bd5114 Mon Sep 17 00:00:00 2001 From: Fernando Almeida Date: Tue, 25 Jan 2022 16:02:56 +0000 Subject: [PATCH] feat(helm-chart): revised emqx env ConfigMap to allow specifying settings also using the namespaced dot notation feat(helm-chart): updated README to include description of previous change and fix value in WSS example --- deploy/charts/emqx/README.md | 16 ++++++++-------- deploy/charts/emqx/templates/configmap.env.yaml | 10 ++++++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/deploy/charts/emqx/README.md b/deploy/charts/emqx/README.md index e066a9328..3b5d66a7f 100644 --- a/deploy/charts/emqx/README.md +++ b/deploy/charts/emqx/README.md @@ -29,9 +29,9 @@ $ helm del my-emqx ``` # Configuration -The following sections describe the configurable parameters of the EMQx chart and their default values. +The following sections describe the configurable parameters of the chart and their default values. ## K8s-specific -The following table lists the configurable K8s parameters of the EMQx chart and their default values. +The following table lists the configurable K8s parameters of the [EMQx](https://www.emqx.io/) chart and their default values. Parameter | Description | Default Value --- | --- | --- `replicaCount` | It is recommended to have odd number of nodes in a cluster, otherwise the emqx cluster cannot be automatically healed in case of net-split. | `3` @@ -88,19 +88,19 @@ Parameter | Description | Default Value `ingress.wss.annotations` | Ingress annotations for EMQX WSS | `{}` ## EMQx-specific -The following table lists the configurable EMQx parameters of the EMQx chart and their default values. +The following table lists the configurable [EMQx](https://www.emqx.io/)-specific parameters of the chart and their default values. Parameter | Description | Default Value --- | --- | --- -`emqxConfig` | Emqx configuration item, see the [documentation](https://hub.docker.com/r/emqx/emqx) | `nil` +`emqxConfig` | Map of [configuration](https://www.emqx.io/docs/en/latest/configuration/configuration.html) items expressed as [environment variables](https://www.emqx.io/docs/en/v4.3/configuration/environment-variable.html) (prefix can be omitted) or using the configuration files [namespaced dotted notation](https://www.emqx.io/docs/en/latest/configuration/configuration.html) | `nil` `emqxLicenseSecretName` | Name of the secret that holds the license information | `nil` -`emqxAclConfig` | EMQx ACL configuration | `{allow, {user, "dashboard"}, subscribe, ["$SYS/#"]}. {allow, {ipaddr, "127.0.0.1"}, pubsub, ["$SYS/#", "#"]}. {deny, all, subscribe, ["$SYS/#", {eq, "#"}]}. {allow, all}.` -`emqxLoadedModules` | Modules to load on start | `{emqx_mod_acl_internal, true}. {emqx_mod_presence, true}. {emqx_mod_delayed, false}. {emqx_mod_rewrite, false}. {emqx_mod_subscription, false}. {emqx_mod_topic_metrics, false}.` -`emqxLoadedPlugins` | Plugins to load on start | `{emqx_management, true}. {emqx_recon, true}. {emqx_retainer, true}. {emqx_dashboard, true}. {emqx_telemetry, true}. {emqx_rule_engine, true}. {emqx_bridge_mqtt, false}.` +`emqxAclConfig` | [ACL](https://docs.emqx.io/broker/latest/en/advanced/acl-file.html) configuration | `{allow, {user, "dashboard"}, subscribe, ["$SYS/#"]}. {allow, {ipaddr, "127.0.0.1"}, pubsub, ["$SYS/#", "#"]}. {deny, all, subscribe, ["$SYS/#", {eq, "#"}]}. {allow, all}.` +`emqxLoadedModules` | Modules to load on startup | `{emqx_mod_acl_internal, true}. {emqx_mod_presence, true}. {emqx_mod_delayed, false}. {emqx_mod_rewrite, false}. {emqx_mod_subscription, false}. {emqx_mod_topic_metrics, false}.` +`emqxLoadedPlugins` | Plugins to load on startup | `{emqx_management, true}. {emqx_recon, true}. {emqx_retainer, true}. {emqx_dashboard, true}. {emqx_telemetry, true}. {emqx_rule_engine, true}. {emqx_bridge_mqtt, false}.` # Examples This section provides some examples for the configuration of common scenarios. ## Enable Websockets SSL via [nginx-ingress community controller](https://kubernetes.github.io/ingress-nginx/) -The following settings describe a working scenario for acessing EMQx Websockets with SSL termination at the [nginx-ingress community controller](https://kubernetes.github.io/ingress-nginx/). +The following settings describe a working scenario for acessing [EMQx](https://www.emqx.io/) Websockets with SSL termination at the [nginx-ingress community controller](https://kubernetes.github.io/ingress-nginx/). ```yaml ingress: wss: diff --git a/deploy/charts/emqx/templates/configmap.env.yaml b/deploy/charts/emqx/templates/configmap.env.yaml index ffd1b66dc..61674e853 100644 --- a/deploy/charts/emqx/templates/configmap.env.yaml +++ b/deploy/charts/emqx/templates/configmap.env.yaml @@ -1,3 +1,4 @@ +{{- if .Values.emqxConfig }} apiVersion: v1 kind: ConfigMap metadata: @@ -9,6 +10,11 @@ metadata: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} data: - {{- range $index, $value := .Values.emqxConfig}} - {{$index}}: "{{ $value }}" + {{- range $index, $value := .Values.emqxConfig }} + {{- if ne $value nil }} + {{- $key := (regexReplaceAllLiteral "\\." (regexReplaceAllLiteral "EMQX[_\\.]" (upper (trimAll " " $index)) "") "__") }} + {{ print "EMQX_" $key }}: {{ $value | quote }} + {{- end }} {{- end}} + +{{- end }} \ No newline at end of file