Skip to content

Commit 80c39d1

Browse files
committed
helm: Add support for mounting config from secret
This change allows for config files to be sourced from a secret rather than a config map as these configs may have sensitive data. In addition to being able to source the config from a secret, the `extraContainerVolumeMounts` option was added which allows for mounting additional volumes defined in `extraContainerVolumes`, such mounting a passkey file secret. This also solves the same issue in a slightly different way from pr #962 Signed-off-by: Mike Mason <[email protected]>
1 parent 2763801 commit 80c39d1

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

helm/hookshot/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# hookshot
22

3-
![Version: 0.1.13](https://img.shields.io/badge/Version-0.1.13-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.2.0](https://img.shields.io/badge/AppVersion-3.2.0-informational?style=flat-square)
3+
![Version: 0.1.15](https://img.shields.io/badge/Version-0.1.15-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.0-replaced-by-ci](https://img.shields.io/badge/AppVersion-0.0.0--replaced--by--ci-informational?style=flat-square)
44
Deploy a Matrix Hookshot instance to Kubernetes
55

66
Status: Beta
@@ -39,7 +39,7 @@ To configure Hookshot-specific parameters, the value `.Values.hookshot.config` a
3939

4040
## Existing configuration
4141

42-
If you have an existing configuration file for Hookshot, you can create a configmap like so:
42+
If you have an existing configuration file for hookshot, you can create a configmap like so:
4343

4444
``` bash
4545
kubectl create --namespace "your hookshot namespace" configmap hookshot-custom-config --from-file=config.yml --from-file=registration.yml --from-file=passkey.pem
@@ -74,8 +74,9 @@ You'll need to configure your Ingress connectivity according to your environment
7474
| affinity | object | `{}` | Affinity settings for deployment |
7575
| autoscaling.enabled | bool | `false` | |
7676
| fullnameOverride | string | `""` | Full name override for helm chart |
77-
| hookshot.config | object | `{"bridge":{"bindAddress":"0.0.0.0","domain":"example.com","port":9002,"url":"https://example.com"},"generic":{"allowJsTransformationFunctions":true,"enableHttpGet":false,"enabled":true,"urlPrefix":"https://example.com/","userIdPrefix":"_webhooks_","waitForComplete":false},"listeners":[{"bindAddress":"0.0.0.0","port":9000,"resources":["webhooks","widgets"]},{"bindAddress":"0.0.0.0","port":9001,"resources":["metrics"]}],"logging":{"colorize":false,"json":false,"level":"info","timestampFormat":"HH:mm:ss:SSS"},"metrics":{"enabled":true},"passFile":"/data/passkey.pem","widgets":{"addToAdminRooms":false,"branding":{"widgetTitle":"Hookshot Configuration"},"publicUrl":"https://webhook-hookshot.example.com/widgetapi/v1/static","roomSetupWidget":{"addOnInvite":false},"setRoomName":false}}` | Raw Hookshot configuration. Gets templated into a YAML file and then loaded unless an existingConfigMap is specified. |
77+
| hookshot.config | object | `{"bridge":{"bindAddress":"127.0.0.1","domain":"example.com","mediaUrl":"https://example.com","port":9993,"url":"http://localhost:8008"},"listeners":[{"bindAddress":"0.0.0.0","port":9000,"resources":["webhooks"]},{"bindAddress":"127.0.0.1","port":9001,"resources":["metrics","provisioning"]},{"bindAddress":"0.0.0.0","port":9002,"resources":["widgets"]}],"logging":{"colorize":true,"json":false,"level":"info","timestampFormat":"HH:mm:ss:SSS"},"passFile":"passkey.pem"}` | Raw Hookshot configuration. Gets templated into a YAML file and then loaded unless an existingConfigMap is specified. |
7878
| hookshot.existingConfigMap | string | `nil` | Name of existing ConfigMap with valid Hookshot configuration |
79+
| hookshot.existingConfigSecretName | string | `nil` | Name of existing config Secret with valid Hookshot configuration |
7980
| hookshot.passkey | string | `""` | |
8081
| hookshot.registration.as_token | string | `""` | |
8182
| hookshot.registration.hs_token | string | `""` | |
@@ -119,4 +120,4 @@ You'll need to configure your Ingress connectivity according to your environment
119120
| tolerations | list | `[]` | Tolerations for deployment |
120121

121122
----------------------------------------------
122-
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
123+
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)

helm/hookshot/templates/_pod.tpl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ containers:
4343
{{- toYaml .Values.containerSecurityContext | nindent 6 }}
4444
{{- end }}
4545
volumeMounts:
46-
{{- if or (and (not .Values.hookshot.existingConfigMap) (.Values.hookshot.config)) (.Values.hookshot.existingConfigMap) }}
4746
- name: config
4847
mountPath: "/data"
48+
{{- if .Values.extraContainerVolumeMounts }}
49+
{{ tpl (toYaml .Values.extraContainerVolumeMounts) . | indent 6 }}
4950
{{- end }}
5051
ports:
5152
- name: webhook
@@ -108,9 +109,15 @@ tolerations:
108109
{{ toYaml . | indent 2 }}
109110
{{- end }}
110111
volumes:
112+
{{- if .Values.hookshot.existingConfigSecretName }}
113+
- name: config
114+
secret:
115+
secretName: {{ .Values.hookshot.existingConfigSecretName }}
116+
{{- else }}
111117
- name: config
112118
configMap:
113119
name: {{ template "hookshot.configMapName" . }}
120+
{{- end }}
114121
{{- $root := . }}
115122
{{- range .Values.extraConfigmapMounts }}
116123
- name: {{ tpl .name $root }}

helm/hookshot/templates/configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
{{- if not .Values.hookshot.existingConfigMap }}
2+
{{- if not (or .Values.hookshot.existingConfigMap .Values.hookshot.existingConfigSecretName) }}
33
apiVersion: v1
44
kind: ConfigMap
55
metadata:

helm/hookshot/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ tolerations: []
101101
# -- Affinity settings for deployment
102102
affinity: {}
103103
hookshot:
104+
# -- Name of existing config Secret with valid Hookshot configuration
105+
existingConfigSecretName:
104106
# -- Name of existing ConfigMap with valid Hookshot configuration
105107
existingConfigMap:
106108
# -- Raw Hookshot configuration. Gets templated into a YAML file and then loaded unless an existingConfigMap is specified.

0 commit comments

Comments
 (0)