|
| 1 | +{{- if .Values.bridges.rss.enabled }} |
| 2 | +apiVersion: apps/v1 |
| 3 | +kind: Deployment |
| 4 | +metadata: |
| 5 | + name: {{ include "matrix.fullname" . }}-bridge-rss |
| 6 | + labels: |
| 7 | +{{ include "matrix.labels" . | indent 4 }} |
| 8 | +spec: |
| 9 | + revisionHistoryLimit: {{ .Values.bridges.rss.revisionHistoryLimit }} |
| 10 | + replicas: 1 |
| 11 | + strategy: |
| 12 | + type: Recreate |
| 13 | + selector: |
| 14 | + matchLabels: |
| 15 | + app.kubernetes.io/name: {{ include "matrix.name" . }}-bridge-rss |
| 16 | + app.kubernetes.io/instance: {{ .Release.Name }} |
| 17 | + matrix-chart/allow-synapse-access: allow |
| 18 | + template: |
| 19 | + metadata: |
| 20 | + annotations: |
| 21 | + # re-roll deployment on config change |
| 22 | + checksum/rss-registration: {{ include (print $.Template.BasePath "/bridge-rss/secret-registration.yaml") . | sha256sum }} |
| 23 | + labels: |
| 24 | + app.kubernetes.io/name: {{ include "matrix.name" . }}-bridge-rss |
| 25 | + app.kubernetes.io/instance: {{ .Release.Name }} |
| 26 | + matrix-chart/allow-synapse-access: allow |
| 27 | + spec: |
| 28 | + {{- if .Values.bridges.affinity }} |
| 29 | + affinity: |
| 30 | + podAffinity: |
| 31 | + requiredDuringSchedulingIgnoredDuringExecution: |
| 32 | + - labelSelector: |
| 33 | + matchExpressions: |
| 34 | + - key: app.kubernetes.io/name |
| 35 | + operator: In |
| 36 | + values: |
| 37 | + - {{ include "matrix.name" . }}-synapse |
| 38 | + - key: app.kubernetes.io/instance |
| 39 | + operator: In |
| 40 | + values: |
| 41 | + - {{ .Release.Name }} |
| 42 | + topologyKey: kubernetes.io/hostname |
| 43 | + {{- end }} |
| 44 | + {{- with .Values.imagePullSecrets }} |
| 45 | + imagePullSecrets: |
| 46 | + {{- toYaml . | nindent 8 }} |
| 47 | + {{- end }} |
| 48 | + {{- with .Values.bridges.rss.podSecurityContext }} |
| 49 | + securityContext: |
| 50 | + {{- toYaml . | nindent 8 }} |
| 51 | + {{- end }} |
| 52 | + initContainers: |
| 53 | + - name: load-config |
| 54 | + {{- if .Values.bridges.rss.registration.existingSecret }} |
| 55 | + image: "mikefarah/yq:latest" |
| 56 | + {{- else }} |
| 57 | + image: "alpine:latest" |
| 58 | + {{- end }} |
| 59 | + imagePullPolicy: {{ .Values.bridges.rss.image.pullPolicy }} |
| 60 | + command: |
| 61 | + - /bin/sh |
| 62 | + - -ec |
| 63 | + - | |
| 64 | + cp /data/registration.yaml /tmp/registration.yaml && \ |
| 65 | + {{- if .Values.bridges.rss.registration.existingSecret }} |
| 66 | + echo "Starting yq of registration.yaml" && \ |
| 67 | + yq eval -i '.as_token = env(AS_TOKEN)' /tmp/registration.yaml && \ |
| 68 | + {{- if .Values.bridges.rss.registration.existingSecretKeys.hs_token }} |
| 69 | + yq eval -i '.hs_token = env(HS_TOKEN)' /tmp/registration.yaml && \ |
| 70 | + {{- end }} |
| 71 | + {{- end }} |
| 72 | + cp /tmp/registration.yaml /bridges/rss.yaml |
| 73 | + {{- if .Values.bridges.rss.registration.existingSecret }} |
| 74 | + env: |
| 75 | + - name: AS_TOKEN |
| 76 | + valueFrom: |
| 77 | + secretKeyRef: |
| 78 | + name: {{ .Values.bridges.rss.registration.existingSecret }} |
| 79 | + key: {{ .Values.bridges.rss.registration.existingSecretKeys.as_token }} |
| 80 | + {{- if .Values.bridges.rss.registration.existingSecretKeys.hs_token }} |
| 81 | + - name: HS_TOKEN |
| 82 | + valueFrom: |
| 83 | + secretKeyRef: |
| 84 | + name: {{ .Values.bridges.rss.registration.existingSecret }} |
| 85 | + key: {{ .Values.bridges.rss.registration.existingSecretKeys.hs_token }} |
| 86 | + {{- end }} |
| 87 | + {{- end }} |
| 88 | + volumeMounts: |
| 89 | + - name: data |
| 90 | + mountPath: /data |
| 91 | + - name: bridges |
| 92 | + mountPath: /bridges |
| 93 | + {{- with .Values.bridges.rss.securityContext }} |
| 94 | + securityContext: |
| 95 | + {{- toYaml . | nindent 12 }} |
| 96 | + {{- end }} |
| 97 | + containers: |
| 98 | + - name: "bridge-rss" |
| 99 | + image: "{{ .Values.bridges.rss.image.repository }}:{{ .Values.bridges.rss.image.tag }}" |
| 100 | + imagePullPolicy: {{ .Values.bridges.rss.image.pullPolicy }} |
| 101 | + env: |
| 102 | + - name: APP_PORT |
| 103 | + value: {{ .Values.bridges.rss.config.app_port | quote }} |
| 104 | + |
| 105 | + - name: APP_rss_SECRET |
| 106 | + value: {{ .Values.bridges.rss.config.app_rss_secret | default "matrix.rss.webhook_secret" }} |
| 107 | + |
| 108 | + - name: MATRIX_HOMESERVER_URL |
| 109 | + value: {{ .Values.bridges.rss.config.homeserver_url | default (include "matrix.baseUrl" .) }} |
| 110 | + |
| 111 | + - name: MATRIX_ROOMS |
| 112 | + value: {{ .Values.bridges.rss.config.bot.rooms }} |
| 113 | + |
| 114 | + {{- if .Values.bridges.rss.registration.existingSecret }} |
| 115 | + - name: MATRIX_TOKEN |
| 116 | + valueFrom: |
| 117 | + secretKeyRef: |
| 118 | + name: {{ .Values.bridges.rss.registration.existingSecret }} |
| 119 | + key: {{ .Values.bridges.rss.registration.existingSecretKeys.as_token }} |
| 120 | + {{- else }} |
| 121 | + - name: MATRIX_TOKEN |
| 122 | + value: {{ .Values.bridges.rss.registration.as_token }} |
| 123 | + {{- end }} |
| 124 | + |
| 125 | + - name: MATRIX_USER |
| 126 | + value: "@{{ .Values.bridges.rss.config.bot.user }}:{{ .Values.matrix.serverName }}" |
| 127 | + |
| 128 | + {{- with .Values.bridges.rss.config.bot.display_name }} |
| 129 | + - name: MATRIX_DISPLAY_NAME |
| 130 | + value: {{ . }} |
| 131 | + {{- end }} |
| 132 | + |
| 133 | + {{- with .Values.bridges.rss.config.bot.avatar_url }} |
| 134 | + - name: MATRIX_AVATAR_URL |
| 135 | + value: {{ . }} |
| 136 | + {{- end }} |
| 137 | + |
| 138 | + {{- with .Values.bridges.rss.config.bot.mention_room }} |
| 139 | + - name: MENTION_ROOM |
| 140 | + value: {{ . | quote }} |
| 141 | + {{- end }} |
| 142 | + |
| 143 | + {{- if .Values.bridges.rss.config.grafana_url }} |
| 144 | + - name: GRAFANA_URL |
| 145 | + value: {{ .Values.bridges.rss.config.grafana_url }} |
| 146 | + |
| 147 | + - name: GRAFANA_DATASOURCE |
| 148 | + value: {{ .Values.bridges.rss.config.grafana_datasource }} |
| 149 | + {{- end }} |
| 150 | + |
| 151 | + {{- if .Values.bridges.rss.config.rss_url }} |
| 152 | + - name: rss_URL |
| 153 | + value: {{ .Values.bridges.rss.config.rss_url }} |
| 154 | + {{- end }} |
| 155 | + ports: |
| 156 | + - name: appservice |
| 157 | + containerPort: {{ .Values.bridges.rss.config.app_port }} |
| 158 | + protocol: TCP |
| 159 | + {{- with .Values.bridges.rss.extraVolumeMounts }} |
| 160 | + {{- toYaml . | nindent 12 }} |
| 161 | + {{- end }} |
| 162 | + {{- with .Values.bridges.rss.securityContext }} |
| 163 | + securityContext: |
| 164 | + {{- toYaml . | nindent 12 }} |
| 165 | + {{- end }} |
| 166 | + {{- with .Values.bridges.rss.resources }} |
| 167 | + resources: |
| 168 | + {{- toYaml . | nindent 12 }} |
| 169 | + {{- end }} |
| 170 | + volumes: |
| 171 | + - name: data |
| 172 | + projected: |
| 173 | + sources: |
| 174 | + - secret: |
| 175 | + name: {{ include "matrix.rss.registrationSecret" . }} |
| 176 | + - name: bridges |
| 177 | + persistentVolumeClaim: |
| 178 | + {{- if not .Values.bridges.volume.existingClaim }} |
| 179 | + claimName: "{{ include "matrix.fullname" . }}-bridges" |
| 180 | + {{- else -}} |
| 181 | + claimName: {{ .Values.bridges.volume.existingClaim }} |
| 182 | + {{- end }} |
| 183 | + {{- with .Values.bridges.rss.extraVolumes }} |
| 184 | + {{- toYaml . | nindent 8 }} |
| 185 | + {{- end }} |
| 186 | +{{- end }} |
0 commit comments