Skip to content

Commit eb76a01

Browse files
Add helm chart and a chart OCI pipeline
1 parent 76f167d commit eb76a01

File tree

9 files changed

+374
-0
lines changed

9 files changed

+374
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
name: Helm Chart OCI Release
3+
on:
4+
push:
5+
tags:
6+
- "chart-v*"
7+
jobs:
8+
helm_chart_oci_release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
- name: Read Yaml
16+
id: yaml
17+
run: |
18+
ver=$(yq e '.version' charts/zumble/Chart.yaml)
19+
echo "::notice title=Chart Version::Chart Version is $ver"
20+
echo "VERSION=$ver" >> $GITHUB_OUTPUT
21+
- name: Chart | Push
22+
uses: appany/helm-oci-chart-releaser@v0.4.1
23+
with:
24+
name: zumble
25+
repository: ${{ github.repository_owner }}/helm-charts
26+
tag: ${{ steps.yaml.outputs.VERSION }}
27+
path: charts/zumble
28+
registry: ghcr.io
29+
registry_username: ${{ secrets.REGISTRY_USERNAME }}
30+
registry_password: ${{ secrets.REGISTRY_PASSWORD }}
31+
update_dependencies: 'true' # Defaults to false

charts/zumble/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/zumble/Chart.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v2
2+
name: zumble
3+
type: application
4+
version: v1.0.0
5+
appVersion: "1.16.0"

charts/zumble/templates/_helpers.tpl

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "zumble.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "zumble.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "zumble.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "zumble.labels" -}}
37+
helm.sh/chart: {{ include "zumble.chart" . }}
38+
{{ include "zumble.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "zumble.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "zumble.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{{- $basicAuthCredentials := printf "%s:%s" .Values.api.username .Values.api.password -}}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: {{ include "zumble.fullname" . }}
6+
labels:
7+
{{- include "zumble.labels" . | nindent 4 }}
8+
spec:
9+
replicas: {{ .Values.replicaCount }}
10+
selector:
11+
matchLabels:
12+
{{- include "zumble.selectorLabels" . | nindent 6 }}
13+
template:
14+
metadata:
15+
{{- with .Values.podAnnotations }}
16+
annotations:
17+
{{- toYaml . | nindent 8 }}
18+
{{- end }}
19+
labels:
20+
{{- include "zumble.labels" . | nindent 8 }}
21+
{{- with .Values.podLabels }}
22+
{{- toYaml . | nindent 8 }}
23+
{{- end }}
24+
spec:
25+
{{- with .Values.imagePullSecrets }}
26+
imagePullSecrets:
27+
{{- toYaml . | nindent 8 }}
28+
{{- end }}
29+
securityContext:
30+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
31+
containers:
32+
- name: {{ .Chart.Name }}
33+
securityContext:
34+
{{- toYaml .Values.securityContext | nindent 12 }}
35+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
36+
imagePullPolicy: {{ .Values.image.pullPolicy }}
37+
envFrom:
38+
- secretRef:
39+
name: {{ include "zumble.fullname" . }}
40+
args:
41+
- --http-password
42+
- "$(HTTP_API_PASSWORD)"
43+
- --http-user
44+
- "{{ .Values.api.username }}"
45+
- --http-listen
46+
- "0.0.0.0:{{ .Values.service.http.port }}"
47+
- --listen
48+
- "0.0.0.0:{{ .Values.service.mumble.port }}"
49+
ports:
50+
- name: http
51+
containerPort: {{ .Values.service.http.port }}
52+
protocol: TCP
53+
- name: mumble-udp
54+
containerPort: {{ .Values.service.mumble.port }}
55+
protocol: UDP
56+
- name: mumble-tcp
57+
containerPort: {{ .Values.service.mumble.port }}
58+
protocol: TCP
59+
livenessProbe:
60+
httpGet:
61+
path: /metrics
62+
port: http
63+
httpHeaders:
64+
- name: Authorization
65+
value: "Basic {{ $basicAuthCredentials | b64enc }}"
66+
readinessProbe:
67+
httpGet:
68+
path: /metrics
69+
port: http
70+
httpHeaders:
71+
- name: Authorization
72+
value: "Basic {{ $basicAuthCredentials | b64enc }}"
73+
resources:
74+
{{- toYaml .Values.resources | nindent 12 }}
75+
{{- with .Values.nodeSelector }}
76+
nodeSelector:
77+
{{- toYaml . | nindent 8 }}
78+
{{- end }}
79+
{{- with .Values.affinity }}
80+
affinity:
81+
{{- toYaml . | nindent 8 }}
82+
{{- end }}
83+
{{- with .Values.tolerations }}
84+
tolerations:
85+
{{- toYaml . | nindent 8 }}
86+
{{- end }}

charts/zumble/templates/ingress.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "zumble.fullname" . -}}
3+
{{- $svcPort := .Values.service.http.port -}}
4+
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5+
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
6+
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
7+
{{- end }}
8+
{{- end }}
9+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
10+
apiVersion: networking.k8s.io/v1
11+
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
12+
apiVersion: networking.k8s.io/v1beta1
13+
{{- else -}}
14+
apiVersion: extensions/v1beta1
15+
{{- end }}
16+
kind: Ingress
17+
metadata:
18+
name: {{ $fullName }}
19+
labels:
20+
{{- include "zumble.labels" . | nindent 4 }}
21+
{{- with .Values.ingress.annotations }}
22+
annotations:
23+
{{- toYaml . | nindent 4 }}
24+
{{- end }}
25+
spec:
26+
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27+
ingressClassName: {{ .Values.ingress.className }}
28+
{{- end }}
29+
{{- if .Values.ingress.tls }}
30+
tls:
31+
{{- range .Values.ingress.tls }}
32+
- hosts:
33+
{{- range .hosts }}
34+
- {{ . | quote }}
35+
{{- end }}
36+
secretName: {{ .secretName }}
37+
{{- end }}
38+
{{- end }}
39+
rules:
40+
{{- range .Values.ingress.hosts }}
41+
- host: {{ .host | quote }}
42+
http:
43+
paths:
44+
{{- range .paths }}
45+
- path: {{ .path }}
46+
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
47+
pathType: {{ .pathType }}
48+
{{- end }}
49+
backend:
50+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
51+
service:
52+
name: {{ $fullName }}
53+
port:
54+
number: {{ $svcPort }}
55+
{{- else }}
56+
serviceName: {{ $fullName }}
57+
servicePort: {{ $svcPort }}
58+
{{- end }}
59+
{{- end }}
60+
{{- end }}
61+
{{- end }}

charts/zumble/templates/secret.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: {{ include "zumble.fullname" . }}
5+
labels:
6+
{{- include "zumble.labels" . | nindent 4 }}
7+
data:
8+
HTTP_API_PASSWORD: {{ .Values.api.password | b64enc }}

charts/zumble/templates/service.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "zumble.fullname" . }}-http
5+
labels:
6+
{{- include "zumble.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.http.type }}
9+
ports:
10+
- port: {{ .Values.service.http.port }}
11+
targetPort: http
12+
protocol: TCP
13+
name: http
14+
selector:
15+
{{- include "zumble.selectorLabels" . | nindent 4 }}
16+
---
17+
apiVersion: v1
18+
kind: Service
19+
metadata:
20+
name: {{ include "zumble.fullname" . }}-mumble
21+
labels:
22+
{{- include "zumble.labels" . | nindent 4 }}
23+
spec:
24+
externalTrafficPolicy: Local
25+
type: {{ .Values.service.mumble.type }}
26+
ports:
27+
- port: {{ .Values.service.mumble.port }}
28+
{{- with .Values.service.mumble.nodePort }}
29+
nodePort: {{ . }}
30+
{{- end }}
31+
targetPort: mumble-udp
32+
protocol: UDP
33+
name: mumble-udp
34+
- port: {{ .Values.service.mumble.port }}
35+
{{- with .Values.service.mumble.nodePort }}
36+
nodePort: {{ . }}
37+
{{- end }}
38+
targetPort: mumble-tcp
39+
protocol: TCP
40+
name: mumble-tcp
41+
selector:
42+
{{- include "zumble.selectorLabels" . | nindent 4 }}
43+
---

charts/zumble/values.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
replicaCount: 1
2+
3+
image:
4+
repository: ghcr.io/illeniumstudios/zumble
5+
pullPolicy: IfNotPresent
6+
tag: v0.1.2
7+
8+
imagePullSecrets: []
9+
nameOverride: ""
10+
fullnameOverride: ""
11+
12+
podAnnotations: {}
13+
podLabels: {}
14+
15+
podSecurityContext: {}
16+
# fsGroup: 2000
17+
18+
securityContext: {}
19+
# capabilities:
20+
# drop:
21+
# - ALL
22+
# readOnlyRootFilesystem: true
23+
# runAsNonRoot: true
24+
# runAsUser: 1000
25+
26+
service:
27+
http:
28+
type: ClusterIP
29+
port: 8080
30+
mumble:
31+
type: NodePort
32+
port: 64738
33+
34+
ingress:
35+
enabled: false
36+
className: ""
37+
annotations: {}
38+
# kubernetes.io/ingress.class: nginx
39+
# kubernetes.io/tls-acme: "true"
40+
hosts:
41+
- host: chart-example.local
42+
paths:
43+
- path: /
44+
pathType: ImplementationSpecific
45+
tls: []
46+
# - secretName: chart-example-tls
47+
# hosts:
48+
# - chart-example.local
49+
50+
resources: {}
51+
# limits:
52+
# cpu: 100m
53+
# memory: 128Mi
54+
# requests:
55+
# cpu: 100m
56+
# memory: 128Mi
57+
58+
nodeSelector: {}
59+
60+
tolerations: []
61+
62+
affinity: {}
63+
64+
api:
65+
username: admin
66+
password: changeme

0 commit comments

Comments
 (0)