Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pipeline for helm chart release #282

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
env:
DOCKER_IMAGE: ghcr.io/nordeck/matrix-poll-widget
steps:
Expand Down Expand Up @@ -59,3 +61,17 @@ jobs:
tags: ${{ steps.meta-new-tags.outputs.tags }}
labels: ${{ steps.meta-new-tags.outputs.labels }}
platforms: linux/amd64,linux/arm64,linux/s390x

- name: custom packaging
run: |
VERSION=${{github.ref_name}}
rm -rf .cr-release-packages
mkdir -p .cr-release-packages
helm package charts/matrix-poll-widget --app-version=${VERSION:1} --version=${VERSION:1} --destination=.cr-release-packages

- name: Run chart-releaser
uses: askcloudarchitech/chart-releaser-action@skip-packaging-option
with:
skip_packaging: true
env:
CR_TOKEN: "${{ secrets.TOKEN }}"
17 changes: 14 additions & 3 deletions charts/matrix-poll-widget/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
apiVersion: v2
name: matrix-poll-widget
# SPDX-FileCopyrightText: 2023 Nordeck IT + Consulting GmbH"
# SPDX-License-Identifier: Apache-2.0
---
annotations:
category: "Security"
licenses: "Apache-2.0"
apiVersion: "v2"
dependencies:
- name: "common"
version: "^2.x.x"
repository: "https://charts.bitnami.com/bitnami"
description: A poll widget for Matrix
home: https://github.com/nordeck/matrix-poll
name: matrix-poll-widget
type: application
version: 0.1.0
appVersion: "0.0.0"
home: https://github.com/nordeck/matrix-poll

4 changes: 0 additions & 4 deletions charts/matrix-poll-widget/templates/NOTES.txt

This file was deleted.

63 changes: 0 additions & 63 deletions charts/matrix-poll-widget/templates/_helpers.tpl

This file was deleted.

16 changes: 13 additions & 3 deletions charts/matrix-poll-widget/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
{{/*
SPDX-FileCopyrightText: 2023 Nordeck IT & Consulting GmbH"
SPDX-License-Identifier: Apache-2.0
*/}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "app.fullname" . }}-cm
name: "{{ include "common.names.fullname" . }}"
labels:
{{ include "app.labels" . | indent 4 }}
{{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
REACT_APP_HOME_SERVER_URL: "https://synapse.{{- .Values.settings.hostname -}}"
REACT_APP_HOME_SERVER_URL: "https://synapse.{{- .Values.global.domain -}}"
REACT_APP_POLL_DESCRIPTION_REQUIRED: "true"
REACT_APP_POLL_SHOW_LIVE_RESULT_BY_NAME: "true"
80 changes: 58 additions & 22 deletions charts/matrix-poll-widget/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,74 @@
apiVersion: apps/v1
kind: Deployment
{{/*
SPDX-FileCopyrightText: 2023 Nordeck IT & Consulting GmbH"
SPDX-License-Identifier: Apache-2.0
*/}}

apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: "Deployment"
metadata:
name: {{ include "app.fullname" . }}
labels:
{{ include "app.labels" . | indent 4 }}
name: {{ include "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: "matrix-poll-widget"
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "app.selectorLabels" . | nindent 6 }}
{{- include "common.labels.matchLabels" . | nindent 6 }}
strategy: {{ include "common.tplvalues.render" (dict "value" .Values.updateStrategy "context" $) | nindent 4 }}
template:
metadata:
annotations:
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
checksum/configmap: {{ include (print .Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- if .Values.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels:
{{- include "app.selectorLabels" . | nindent 8 }}
{{- include "common.labels.standard" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
{{- if or .Values.imagePullSecrets .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- range .Values.global.imagePullSecrets }}
- name: "{{ . }}"
{{- end }}
{{- range .Values.imagePullSecrets }}
- name: "{{ . }}"
{{- end }}
{{- end }}
{{- if .Values.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.topologySpreadConstraints "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.podSecurityContext.enabled }}
securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
{{- if .Values.serviceAccount.create }}
serviceAccountName: {{ include "common.names.fullname" . }}
{{- end }}
{{- if .Values.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- end }}
serviceAccountName: {{ include "app.serviceAccountName" . }}
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 }}"
- name: "matrix-poll-widget"
{{- if .Values.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
image: "{{ coalesce .Values.image.registry .Values.global.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
Expand All @@ -56,7 +92,7 @@ spec:
{{- end }}
envFrom:
- configMapRef:
name: {{ include "app.fullname" . }}-cm
name: {{ include "common.names.fullname" . }}
volumeMounts:
- name: cache-volume
mountPath: /var/cache/nginx
Expand Down
4 changes: 4 additions & 0 deletions charts/matrix-poll-widget/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{{/*
SPDX-FileCopyrightText: 2023 Nordeck IT & Consulting GmbH"
SPDX-License-Identifier: Apache-2.0
*/}}
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
Expand Down
55 changes: 24 additions & 31 deletions charts/matrix-poll-widget/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,37 @@
{{/*
SPDX-FileCopyrightText: 2023 Nordeck IT & Consulting GmbH"
SPDX-License-Identifier: Apache-2.0
*/}}
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "app.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
---
apiVersion: "{{ include "common.capabilities.ingress.apiVersion" . }}"
kind: "Ingress"
metadata:
name: "{{ $fullName }}"
name: "{{ include "common.names.fullname" . }}"
labels:
{{- include "app.labels" . | nindent 4 }}
{{- include "common.labels.standard" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- if .Values.ingress.ingressClassName }}
ingressClassName: {{ .Values.ingress.ingressClassName }}
{{- end }}
{{- if .Values.ingress.tls.enabled }}
tls:
- hosts:
- {{ coalesce .Values.ingress.host (printf "%s.%s" .Values.global.hosts.matrixpollwidget .Values.global.domain) | quote }}
secretName: "{{ .Values.ingress.tls.secretName | default (printf "%s-tls" (include "common.labels.standard" . )) }}"
{{- end }}
rules:
- host: "{{- $fullName -}}.{{- .Values.settings.hostname -}}"
- host: {{ coalesce .Values.ingress.host (printf "%s.%s" .Values.global.hosts.matrixpollwidget .Values.global.domain) | quote }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
tls:
- hosts:
- "{{- $fullName -}}.{{- .Values.settings.hostname -}}"
secretName: "{{- $fullName -}}.{{- .Release.Namespace -}}-tls"
- path: {{ .Values.ingress.path }}
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
pathType: {{ .Values.ingress.pathType }}
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" $) "servicePort" 8080 "context" $) | nindent 14 }}
...
{{- end }}
47 changes: 37 additions & 10 deletions charts/matrix-poll-widget/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,42 @@
apiVersion: v1
kind: Service
{{/*
SPDX-FileCopyrightText: Nordeck IT + Consulting GmbH"
SPDX-License-Identifier: Apache-2.0
*/}}
{{- if .Values.service.enabled }}
---
apiVersion: "v1"
kind: "Service"
metadata:
name: {{ include "app.fullname" . }}
name: "{{ include "common.names.fullname" . }}"
namespace: {{ include "common.names.namespace" . | quote }}
labels:
{{ include "app.labels" . | indent 4 }}
{{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.service.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.service.type }}
type: "{{ .Values.service.type }}"
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{- range $key, $value := .Values.service.ports }}
- name: "{{ $key }}"
port: {{ $value.port }}
targetPort: {{ $value.port }}
protocol: "{{ $value.protocol | default "TCP" }}"
{{- if and $value.nodePort (not (eq $.Values.service.type "ClusterIP")) }}
nodePort: {{ $value.nodePort }}
{{- end }}
{{- end }}
selector:
{{- include "app.selectorLabels" . | nindent 4 }}
{{- include "common.labels.matchLabels" . | nindent 4 }}
...
{{- end }}

15 changes: 0 additions & 15 deletions charts/matrix-poll-widget/templates/tests/test-connection.yaml

This file was deleted.

Loading
Loading