diff --git a/charts/.github/workflows/build-and-publish.yml b/charts/.github/workflows/build-and-publish.yml new file mode 100644 index 0000000..eed9857 --- /dev/null +++ b/charts/.github/workflows/build-and-publish.yml @@ -0,0 +1,89 @@ +name: Release Charts + +on: + push: + branches: + - master + +jobs: + release: + # depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions + # see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Install Helm + uses: azure/setup-helm@v3 + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.5.0 + with: + charts_dir: charts + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + +name: Build and Publish Helm Chart + +on: + push: + tags: + - "v*.*.*" + +jobs: + build-and-publish: + # depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions + # see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token + permissions: + contents: write + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Set up Helm + uses: azure/setup-helm@v3 + + - name: Package Helm Chart + run: | + helm package . -d charts + helm repo index charts --url https://github.com/tommy-skaug/bgpalerter-chart/raw/main/charts + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_OPTIONS: --unhandled-rejections=strict + + - name: Publish Helm Chart + uses: actions/upload-artifact@v2 + with: + name: bgpalerter-chart + path: charts + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_OPTIONS: --unhandled-rejections=strict + + - name: Deploy Helm Chart to GitHub Releases + uses: softprops/action-gh-release@v1 + with: + files: charts/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_OPTIONS: --unhandled-rejections=strict \ No newline at end of file diff --git a/LICENSE b/charts/LICENSE similarity index 100% rename from LICENSE rename to charts/LICENSE diff --git a/README.org b/charts/README.org similarity index 100% rename from README.org rename to charts/README.org diff --git a/docs/ingress.org b/charts/docs/ingress.org similarity index 100% rename from docs/ingress.org rename to charts/docs/ingress.org diff --git a/charts/synatainer/.helmignore b/charts/synatainer/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/charts/synatainer/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# 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/synatainer/Chart.yaml b/charts/synatainer/Chart.yaml deleted file mode 100644 index b19b940..0000000 --- a/charts/synatainer/Chart.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -apiVersion: v2 -name: synatainer -description: Synapse Maintenance Container -home: https://gitlab.com/mb-saces/synatainer -type: application - -version: 1.1.3 -appVersion: 0.4.3 - -maintainers: - - name: Alexander Olofsson - email: ace@haxalot.com diff --git a/charts/synatainer/LICENSE b/charts/synatainer/LICENSE deleted file mode 100644 index 00ec099..0000000 --- a/charts/synatainer/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2021 Alexander Olofsson - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/charts/synatainer/templates/_helpers.tpl b/charts/synatainer/templates/_helpers.tpl deleted file mode 100644 index bd4585c..0000000 --- a/charts/synatainer/templates/_helpers.tpl +++ /dev/null @@ -1,59 +0,0 @@ -{{/* -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 }} - -{{- define "synatainer.mxtoken" -}} -{{- printf "*|*|*|%s" (required "You need to specify a synapse token" .Values.synapse.token) }} -{{- end }} - -{{- define "synatainer.pgpassword" -}} -{{- printf "%s:%s:%s:%s:%s" (required "You need to specify a postgres host" .Values.postgresql.host) (.Values.postgresql.port | default 5432 | toString) (.Values.postgresql.database | default "synapse") (.Values.postgresql.username | default "synapse") (required "You need to specify a postgres password" .Values.postgresql.password) }} -{{- end }} diff --git a/charts/synatainer/templates/config.yaml b/charts/synatainer/templates/config.yaml deleted file mode 100644 index 2402484..0000000 --- a/charts/synatainer/templates/config.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "synatainer.fullname" . }} - labels: - {{- include "synatainer.labels" . | nindent 4 }} -data: - SYNAPSE_HOST: {{ .Values.synapse.url | default "http://matrix-synapse:8008" | quote }} - - DB_HOST: {{ .Values.postgresql.host | quote }} - DB_PORT: {{ .Values.postgresql.port | default 5432 | quote }} - DB_NAME: {{ .Values.postgresql.database | default "synapse" | quote }} - DB_USER: {{ .Values.postgresql.username | default "synapse" | quote }} - -{{- range $key, $val := .Values.extraEnv }} - {{ $key }}: {{ $val | toString | quote }} -{{- end -}} diff --git a/charts/synatainer/templates/deployment.yaml b/charts/synatainer/templates/deployment.yaml deleted file mode 100644 index 59274f2..0000000 --- a/charts/synatainer/templates/deployment.yaml +++ /dev/null @@ -1,81 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "synatainer.fullname" . }} - labels: - {{- include "synatainer.labels" . | nindent 4 }} -spec: - replicas: 1 - selector: - matchLabels: - {{- include "synatainer.selectorLabels" . | nindent 6 }} - strategy: - type: Recreate - template: - metadata: - annotations: - checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }} - checksum/secrets: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} - {{- with .Values.podAnnotations }} - {{- 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: - - command: - - sh - - -c - - | - cp /tmp/mxtoken /conf/ - cp /tmp/pgpassword /conf/ - exec /entrypoint.sh - name: {{ .Chart.Name }} - envFrom: - - configMapRef: - name: {{ include "synatainer.fullname" . }} - {{- if .Values.extraSecrets }} - - secretRef: - name: {{ include "synatainer.fullname" . }} - {{- end }} - 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 }} - volumeMounts: - - name: emptydir - mountPath: /conf - - name: tokens - mountPath: /tmp/pgpassword - subPath: pgpassword - - name: tokens - mountPath: /tmp/mxtoken - subPath: mxtoken - {{- 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: tokens - secret: - secretName: {{ include "synatainer.fullname" . }}-tokens - defaultMode: 0600 - - name: emptydir - emptyDir: {} diff --git a/charts/synatainer/templates/secret.yaml b/charts/synatainer/templates/secret.yaml deleted file mode 100644 index 2421e5a..0000000 --- a/charts/synatainer/templates/secret.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -apiVersion: v1 -kind: Secret -metadata: - name: {{ include "synatainer.fullname" . }}-tokens - labels: - {{- include "synatainer.labels" . | nindent 4 }} -data: - pgpassword: {{ include "synatainer.pgpassword" . | b64enc }} - mxtoken: {{ include "synatainer.mxtoken" . | b64enc }} -{{- with .Values.extraSecrets }} ---- -apiVersion: v1 -kind: Secret -metadata: - name: {{ include "synatainer.fullname" $ }} - labels: - {{- include "synatainer.labels" $ | nindent 4 }} -data: -{{- range $key, $val := . }} - {{ $key }}: {{ $val | toString | b64enc }} -{{- end -}} -{{- end }} diff --git a/charts/synatainer/values.yaml b/charts/synatainer/values.yaml deleted file mode 100644 index 1e9a854..0000000 --- a/charts/synatainer/values.yaml +++ /dev/null @@ -1,71 +0,0 @@ ---- -## 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: - -## Connection details for the Synapse database -postgresql: - host: - # port: 5432 - # database: synapse - # username: synapse - 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.other-matrix-namespace.svc:8008 or https://matrix.example.com - # url: http://matrix-synapse:8008 - 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: {}