Skip to content

Commit 6179624

Browse files
committed
Adding existingSecret.registation and existingSecret.passkey; Always store registration and passkey data in a Kubernetes secret; use projected volume to ensure all data in one directory
Signed-off-by: jessebot <[email protected]>
1 parent 2763801 commit 6179624

File tree

7 files changed

+91
-21
lines changed

7 files changed

+91
-21
lines changed

helm/hookshot/README.md

Lines changed: 9 additions & 6 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,9 +74,12 @@ 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. |
78-
| hookshot.existingConfigMap | string | `nil` | Name of existing ConfigMap with valid Hookshot configuration |
79-
| hookshot.passkey | string | `""` | |
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. |
78+
| hookshot.config.passFile | string | `"passkey.pem"` | A passkey used to encrypt tokens stored inside the bridge. Run openssl genpkey -out passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096 to generate |
79+
| hookshot.existingConfigMap | string | `""` | Name of existing ConfigMap with valid Hookshot configuration |
80+
| hookshot.existingSecret.passkey | string | `""` | Name of existing Secret with valid Hookshot passkey.pem If set, ignores hookshot.passkey |
81+
| hookshot.existingSecret.registration | string | `""` | Name of existing Secret with valid Hookshot registration.yaml. If set, ignores hookshot.registration |
82+
| hookshot.passkey | string | `""` | A passkey used to encrypt tokens stored inside the bridge. Run openssl genpkey -out passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096 to generate |
8083
| hookshot.registration.as_token | string | `""` | |
8184
| hookshot.registration.hs_token | string | `""` | |
8285
| hookshot.registration.id | string | `"matrix-hookshot"` | |
@@ -119,4 +122,4 @@ You'll need to configure your Ingress connectivity according to your environment
119122
| tolerations | list | `[]` | Tolerations for deployment |
120123

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

helm/hookshot/templates/_helpers.tpl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,28 @@ Helper for configmap name
3535
{{- end }}
3636
{{- end }}
3737

38+
{{/*
39+
Helper for secret name for registration
40+
*/}}
41+
{{- define "hookshot.registrationSecretName" -}}
42+
{{- if .Values.hookshot.existingSecret.registration }}
43+
{{- printf "%s" .Values.hookshot.existingSecret.registration -}}
44+
{{- else }}
45+
{{- printf "%s-registration-secret" (include "hookshot.fullname" .) | trunc 63 | trimSuffix "-" }}
46+
{{- end }}
47+
{{- end }}
48+
49+
{{/*
50+
Helper for secret name for passkey.pem
51+
*/}}
52+
{{- define "hookshot.passkeySecretName" -}}
53+
{{- if .Values.hookshot.existingSecret.passkey }}
54+
{{- printf "%s" .Values.hookshot.existingSecret.passkey -}}
55+
{{- else }}
56+
{{- printf "%s-passkey-secret" (include "hookshot.fullname" .) | trunc 63 | trimSuffix "-" }}
57+
{{- end }}
58+
{{- end }}
59+
3860
{{/*
3961
Create chart name and version as used by the chart label.
4062
*/}}

helm/hookshot/templates/_pod.tpl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ 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"
49-
{{- end }}
5048
ports:
5149
- name: webhook
5250
containerPort: 9000
@@ -58,7 +56,7 @@ containers:
5856
containerPort: 9002
5957
protocol: TCP
6058
env:
61-
59+
6260
envFrom:
6361
{{- if .Values.envFromSecret }}
6462
- secretRef:
@@ -109,8 +107,14 @@ tolerations:
109107
{{- end }}
110108
volumes:
111109
- name: config
112-
configMap:
113-
name: {{ template "hookshot.configMapName" . }}
110+
projected:
111+
sources:
112+
configMap:
113+
name: {{ template "hookshot.configMapName" . }}
114+
secret:
115+
secretName: {{ template "hookshot.registrationSecretName" . }}
116+
secret:
117+
secretName: {{ template "hookshot.passkeySecretName" . }}
114118
{{- $root := . }}
115119
{{- range .Values.extraConfigmapMounts }}
116120
- name: {{ tpl .name $root }}
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
21
{{- if not .Values.hookshot.existingConfigMap }}
2+
---
33
apiVersion: v1
44
kind: ConfigMap
55
metadata:
@@ -12,10 +12,6 @@ metadata:
1212
{{ toYaml . | indent 4 }}
1313
{{- end }}
1414
data:
15-
config.yml: |
16-
{{ toYaml .Values.hookshot.config | indent 4 }}
17-
registration.yml: |
18-
{{ toYaml .Values.hookshot.registration | indent 4 }}
19-
passkey.pem: |
20-
{{ .Values.hookshot.passkey | indent 4 }}
15+
config.yml: |-
16+
{{- toYaml .Values.hookshot.config | nindent 4 }}
2117
{{- end }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{- if not .Values.hookshot.existingSecret.passkey }}
2+
---
3+
apiVersion: v1
4+
kind: Secret
5+
metadata:
6+
name: {{ template "hookshot.passkeySecretName" . }}
7+
namespace: {{ template "hookshot.namespace" . }}
8+
labels:
9+
{{- include "hookshot.labels" . | nindent 4 }}
10+
{{- with .Values.annotations }}
11+
annotations:
12+
{{ toYaml . | indent 4 }}
13+
{{- end }}
14+
data:
15+
passkey.pem: |-
16+
{{ toYaml .Values.hookshot.passkey | nindent 4 }}
17+
{{- end }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{- if not .Values.hookshot.existingSecret.registration }}
2+
---
3+
apiVersion: v1
4+
kind: Secret
5+
metadata:
6+
name: {{ template "hookshot.registrationSecretName" . }}
7+
namespace: {{ template "hookshot.namespace" . }}
8+
labels:
9+
{{- include "hookshot.labels" . | nindent 4 }}
10+
{{- with .Values.annotations }}
11+
annotations:
12+
{{ toYaml . | indent 4 }}
13+
{{- end }}
14+
data:
15+
registration.yaml: |-
16+
{{- toYaml .Values.hookshot.registration | nindent 4 }}
17+
{{- end }}

helm/hookshot/values.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,17 @@ tolerations: []
101101
# -- Affinity settings for deployment
102102
affinity: {}
103103
hookshot:
104+
existingSecret:
105+
# -- Name of existing Secret with valid Hookshot registration.yaml.
106+
# If set, ignores hookshot.registration
107+
registration: ""
108+
# -- Name of existing Secret with valid Hookshot passkey.pem
109+
# If set, ignores hookshot.passkey
110+
passkey: ""
111+
104112
# -- Name of existing ConfigMap with valid Hookshot configuration
105-
existingConfigMap:
113+
existingConfigMap: ""
114+
106115
# -- Raw Hookshot configuration. Gets templated into a YAML file and then loaded unless an existingConfigMap is specified.
107116
config:
108117
# This is an example configuration file
@@ -113,9 +122,9 @@ hookshot:
113122
mediaUrl: https://example.com
114123
port: 9993
115124
bindAddress: 127.0.0.1
116-
passFile: passkey.pem
117-
# A passkey used to encrypt tokens stored inside the bridge.
125+
# -- A passkey used to encrypt tokens stored inside the bridge.
118126
# Run openssl genpkey -out passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096 to generate
127+
passFile: passkey.pem
119128
logging:
120129
# Logging settings. You can have a severity debug,info,warn,error
121130
level: info
@@ -298,4 +307,6 @@ hookshot:
298307
sender_localpart: hookshot
299308
url: "http://example.com"
300309
rate_limited: false
310+
# -- A passkey used to encrypt tokens stored inside the bridge.
311+
# Run openssl genpkey -out passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096 to generate
301312
passkey: ""

0 commit comments

Comments
 (0)