Let's go karaoke

Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
This commit is contained in:
Martyn 2024-06-17 10:41:27 +00:00
parent 74d5e9d4b1
commit 138eb05393
9 changed files with 242 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,21 @@
apiVersion: v2
name: karaoke-eternal
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
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: "0.1.0"

View File

@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "karaoke-eternal.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 "karaoke-eternal.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 "karaoke-eternal.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "karaoke-eternal.labels" -}}
helm.sh/chart: {{ include "karaoke-eternal.chart" . }}
{{ include "karaoke-eternal.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "karaoke-eternal.selectorLabels" -}}
app.kubernetes.io/name: {{ include "karaoke-eternal.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "karaoke-eternal.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "karaoke-eternal.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "karaoke-eternal.fullname" . }}-config
labels:
{{- include "karaoke-eternal.labels" . | nindent 4 }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.pvc.config.storageRequest | quote }}
storageClassName: {{ .Values.pvc.config.storageClass | quote }}

View File

@ -0,0 +1,50 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "karaoke-eternal.fullname" . }}
labels:
app: karaoke-eternal
{{- include "karaoke-eternal.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.eternal.replicas }}
selector:
matchLabels:
app: karaoke-eternal
{{- include "karaoke-eternal.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
app: karaoke-eternal
{{- include "karaoke-eternal.selectorLabels" . | nindent 8 }}
spec:
containers:
- env:
- name: KUBERNETES_CLUSTER_DOMAIN
value: {{ .Values.kubernetesClusterDomain }}
image: {{ .Values.eternal.karaokeEternal.image.repository }}:{{ .Values.eternal.karaokeEternal.image.tag
| default .Chart.AppVersion }}
imagePullPolicy: Always
name: karaoke-eternal
ports:
- containerPort: 8080
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /mnt/karaoke
name: songs
subPath: K
- mountPath: /config
name: karaoke-config
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
terminationGracePeriodSeconds: 30
volumes:
name: songs
persistentVolumeClaim:
claimName: smb-oldmusic
- name: karaoke-config
persistentVolumeClaim:
claimName: {{ include "karaoke-eternal.fullname" . }}-config

View File

@ -0,0 +1,33 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: letsencrypt
external-dns.alpha.kubernetes.io/target: home.martyn.berlin
kubernetes.io/ingress.class: nginx
# type of authentication
nginx.ingress.kubernetes.io/auth-type: basic
# name of the secret that contains the user/password definitions
nginx.ingress.kubernetes.io/auth-secret: basic-auth
# message to display with an appropriate context why the authentication is required
nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - user martyn'
labels:
app: karaoke-eternal
{{- include "karaoke-eternal.labels" . | nindent 4 }}
name: {{ include "karaoke-eternal.fullname" . }}
spec:
rules:
- host: karaoke.martyn.berlin
http:
paths:
- backend:
service:
name: {{ include "karaoke-eternal.fullname" . }}
port:
number: 80
path: /
pathType: Prefix
tls:
- hosts:
- karaoke.martyn.berlin
secretName: karaoke-tls

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: smb-oldmusic
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: smb-oldmusic

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "karaoke-eternal.fullname" . }}
labels:
app: karaoke-eternal
{{- include "karaoke-eternal.labels" . | nindent 4 }}
spec:
type: {{ .Values.eternal.type }}
selector:
app: karaoke-eternal
{{- include "karaoke-eternal.selectorLabels" . | nindent 4 }}
ports:
{{- .Values.eternal.ports | toYaml | nindent 2 -}}

View File

@ -0,0 +1,15 @@
eternal:
karaokeEternal:
image:
repository: radrootllc/karaoke-eternal
tag: latest
ports:
- port: 80
targetPort: 8080
replicas: 1
type: LoadBalancer
kubernetesClusterDomain: cluster.local
pvc:
config:
storageClass: longhorn-fast
storageRequest: 1Gi