From a7998d1c336797fcb743f2b26ac4d9317ed37a56 Mon Sep 17 00:00:00 2001 From: Alex Manning Date: Thu, 22 Dec 2022 00:09:42 +0000 Subject: [PATCH] Add matrix-appservice-irc. --- .woodpecker/matrix-appservice-irc.yaml | 13 ++++ charts/matrix-appservice-irc/.helmignore | 23 +++++++ charts/matrix-appservice-irc/Chart.yaml | 15 +++++ .../templates/_helpers.tpl | 62 +++++++++++++++++++ .../templates/deployment.yaml | 59 ++++++++++++++++++ .../templates/secret.yaml | 14 +++++ .../templates/service.yaml | 15 +++++ charts/matrix-appservice-irc/values.yaml | 56 +++++++++++++++++ 8 files changed, 257 insertions(+) create mode 100644 .woodpecker/matrix-appservice-irc.yaml create mode 100644 charts/matrix-appservice-irc/.helmignore create mode 100644 charts/matrix-appservice-irc/Chart.yaml create mode 100644 charts/matrix-appservice-irc/templates/_helpers.tpl create mode 100644 charts/matrix-appservice-irc/templates/deployment.yaml create mode 100644 charts/matrix-appservice-irc/templates/secret.yaml create mode 100644 charts/matrix-appservice-irc/templates/service.yaml create mode 100644 charts/matrix-appservice-irc/values.yaml diff --git a/.woodpecker/matrix-appservice-irc.yaml b/.woodpecker/matrix-appservice-irc.yaml new file mode 100644 index 0000000..b010ad2 --- /dev/null +++ b/.woodpecker/matrix-appservice-irc.yaml @@ -0,0 +1,13 @@ +--- +when: + path: "charts/matrix-appservice-irc/*" +branches: + - main +pipeline: + package: + image: "docker.io/alpine/helm:latest" + secrets: [helm_user, helm_password, helm_repo] + commands: + - helm plugin install https://github.com/chartmuseum/helm-push + - helm repo add therepo $HELM_REPO --username $HELM_USER --password $HELM_PASSWORD + - helm cm-push charts/matrix-appservice-irc therepo diff --git a/charts/matrix-appservice-irc/.helmignore b/charts/matrix-appservice-irc/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/matrix-appservice-irc/.helmignore @@ -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/ diff --git a/charts/matrix-appservice-irc/Chart.yaml b/charts/matrix-appservice-irc/Chart.yaml new file mode 100644 index 0000000..e51f9b6 --- /dev/null +++ b/charts/matrix-appservice-irc/Chart.yaml @@ -0,0 +1,15 @@ +apiVersion: v2 +name: matrix-appservice-irc +description: irc <-> matrix bridge. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "release-0.36.0" diff --git a/charts/matrix-appservice-irc/templates/_helpers.tpl b/charts/matrix-appservice-irc/templates/_helpers.tpl new file mode 100644 index 0000000..2acb42d --- /dev/null +++ b/charts/matrix-appservice-irc/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "matrix-appservice-irc.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 "matrix-appservice-irc.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 "matrix-appservice-irc.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "matrix-appservice-irc.labels" -}} +helm.sh/chart: {{ include "matrix-appservice-irc.chart" . }} +{{ include "matrix-appservice-irc.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "matrix-appservice-irc.selectorLabels" -}} +app.kubernetes.io/name: {{ include "matrix-appservice-irc.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "matrix-appservice-irc.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "matrix-appservice-irc.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/matrix-appservice-irc/templates/deployment.yaml b/charts/matrix-appservice-irc/templates/deployment.yaml new file mode 100644 index 0000000..4ad1786 --- /dev/null +++ b/charts/matrix-appservice-irc/templates/deployment.yaml @@ -0,0 +1,59 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "matrix-appservice-irc.fullname" . }} + labels: + {{- include "matrix-appservice-irc.labels" . | nindent 4 }} +spec: + replicas: 1 + selector: + matchLabels: + {{- include "matrix-appservice-irc.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "matrix-appservice-irc.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: appservice + containerPort: 9999 + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: mainconfig + readOnly: true + mountPath: "/data" + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: mainconfig + secret: + secretName: {{ include "matrix-appservice-irc.fullname" . }} diff --git a/charts/matrix-appservice-irc/templates/secret.yaml b/charts/matrix-appservice-irc/templates/secret.yaml new file mode 100644 index 0000000..cd52d02 --- /dev/null +++ b/charts/matrix-appservice-irc/templates/secret.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "matrix-appservice-irc.fullname" . }} + labels: + {{- include "matrix-appservice-irc.labels" . | nindent 4 }} +type: Opaque +stringData: + config.yaml: | + {{- fromYaml .Values.config | toYaml | nindent 4 }} + appservice-registration-irc.yaml: | + {{- fromYaml .Values.registration | toYaml | nindent 4 }} + passkey.pem: | + {{- .Values.passkey | nindent 4 }} diff --git a/charts/matrix-appservice-irc/templates/service.yaml b/charts/matrix-appservice-irc/templates/service.yaml new file mode 100644 index 0000000..d9fc10e --- /dev/null +++ b/charts/matrix-appservice-irc/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "matrix-appservice-irc.fullname" . }}-appservice-nocollide + labels: + {{- include "matrix-appservice-irc.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: appservice + protocol: TCP + name: appservice + selector: + {{- include "matrix-appservice-irc.selectorLabels" . | nindent 4 }} diff --git a/charts/matrix-appservice-irc/values.yaml b/charts/matrix-appservice-irc/values.yaml new file mode 100644 index 0000000..cc022e3 --- /dev/null +++ b/charts/matrix-appservice-irc/values.yaml @@ -0,0 +1,56 @@ +# Default values for matrix-appservice-irc. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +image: + repository: docker.io/matrixdotorg/matrix-appservice-irc + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +podAnnotations: {} + +podSecurityContext: {} + +securityContext: + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + +service: + type: ClusterIP + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +# Configuration must be in the config key here: +# however it is recomended to keep it in a different file and +# use --set-file config=config.yaml when invoking helm. +# This allows diffing with the example configuration to update it. +config: {} +# Copy of the registration file for the bridge. +registration: {} +# Key for encrypting passwords in the database. +passkey: {}