synatainer: Add chart for version 0.4.0

This commit is contained in:
Alexander Olofsson 2022-07-05 10:27:26 +02:00
parent 4ee52109eb
commit 5bcc4e77bd
No known key found for this signature in database
GPG key ID: D439C9470CB04C73
7 changed files with 248 additions and 0 deletions

View file

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View file

@ -0,0 +1,13 @@
---
apiVersion: v2
name: synatainer
description: Synapse Maintenance Container
home: https://gitlab.com/mb-saces/synatainer
type: application
version: 1.0.0
appVersion: "0.4.0"
maintainers:
- name: Alexander Olofsson
email: ace@haxalot.com

View file

@ -0,0 +1,51 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "synatainer.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "synatainer.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "synatainer.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "synatainer.labels" -}}
helm.sh/chart: {{ include "synatainer.chart" . }}
{{ include "synatainer.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "synatainer.selectorLabels" -}}
app.kubernetes.io/name: {{ include "synatainer.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

View file

@ -0,0 +1,22 @@
{{- if (not (and .Values.postgresql.host .Values.postgresql.password)) -}}
{{ fail "You need to specify postgres connection details" }}
{{- end -}}
{{- if (not (and .Values.synapse.token)) -}}
{{ fail "You need to specify synapse connection details" }}
{{- end -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "synatainer.fullname" . }}
labels:
{{- include "synatainer.labels" . | nindent 4 }}
data:
DB_HOST: {{ .Values.postgresql.host | quote }}
DB_NAME: {{ .Values.postgresql.database | default "synapse" | quote }}
DB_USER: {{ .Values.postgresql.username | default "synapse" | quote }}
SYNAPSE_HOST: {{ .Values.synapse.url | default "http://matrix-synapse:8008" | quote }}
{{- range $key, $val := .Values.extraEnv }}
{{ $key }}: {{ $val | toString | quote }}
{{- end -}}

View file

@ -0,0 +1,55 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "synatainer.fullname" . }}
labels:
{{- include "synatainer.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "synatainer.selectorLabels" . | nindent 6 }}
strategy:
type: Recreate
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }}
checksum/secrets: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "synatainer.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
envFrom:
- configMapRef:
name: {{ include "synatainer.fullname" . }}
- secretRef:
name: {{ include "synatainer.fullname" . }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View file

@ -0,0 +1,14 @@
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "synatainer.fullname" . }}
labels:
{{- include "synatainer.labels" . | nindent 4 }}
data:
PGPASSWORD: {{ .Values.postgresql.password | toString | b64enc }}
BEARER_TOKEN: {{ .Values.synapse.token | toString | b64enc }}
{{- range $key, $val := .Values.extraSecrets }}
{{ $key }}: {{ $val | toString | b64enc }}
{{- end -}}

View file

@ -0,0 +1,70 @@
---
## Container image configuration
image:
repository: registry.gitlab.com/mb-saces/synatainer
pullPolicy: IfNotPresent
## Overrides the image tag, for running a different version than the charts.
# tag: latest
## Connection details for the Synapse database
postgresql:
host:
database:
username:
password:
## Connection details for the Synapse instance
synapse:
## The URL to the Synapse instance, can either be a cluster-internal or external URL
## E.g. http://matrix-synapse.matrix.svc:8008 or https://matrix.example.com
url:
token:
## Extra environment variables for configuring synatainer
## See https://gitlab.com/mb-saces/synatainer/-/blob/develop/README.adoc
extraEnv: {}
# MAILTO: notifications@example.com
# MAILFROM: synatainer@example.com
# SMTPHOST: smtp.example.com
# MEDIA_MAX_AGE: 90
# HISTORY_MAX_AGE: 180
# STATE_AUTOCOMPRESSOR_CHUNKS_TO_COMPRESS: 100
# STATE_AUTOCOMPRESSOR_CHUNK_SIZE: 500
# ROOM_KEEP_LIST: all
# HISTORY_ROOM_LIST: all
# HISTORY_KEEP_LIST:
## If you need to set additional secret environment variables
extraSecrets: {}
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}