diff --git a/apps-helm/karaoke-eternal/.helmignore b/apps-helm/karaoke-eternal/.helmignore new file mode 100755 index 0000000..0e8a0eb --- /dev/null +++ b/apps-helm/karaoke-eternal/.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/apps-helm/karaoke-eternal/Chart.yaml b/apps-helm/karaoke-eternal/Chart.yaml new file mode 100755 index 0000000..00d73d0 --- /dev/null +++ b/apps-helm/karaoke-eternal/Chart.yaml @@ -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" diff --git a/apps-helm/karaoke-eternal/templates/_helpers.tpl b/apps-helm/karaoke-eternal/templates/_helpers.tpl new file mode 100755 index 0000000..3055d6f --- /dev/null +++ b/apps-helm/karaoke-eternal/templates/_helpers.tpl @@ -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 }} diff --git a/apps-helm/karaoke-eternal/templates/config.yaml b/apps-helm/karaoke-eternal/templates/config.yaml new file mode 100644 index 0000000..3e26ee3 --- /dev/null +++ b/apps-helm/karaoke-eternal/templates/config.yaml @@ -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 }} diff --git a/apps-helm/karaoke-eternal/templates/deployment.yaml b/apps-helm/karaoke-eternal/templates/deployment.yaml new file mode 100644 index 0000000..774be0a --- /dev/null +++ b/apps-helm/karaoke-eternal/templates/deployment.yaml @@ -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 diff --git a/apps-helm/karaoke-eternal/templates/ingress.yaml b/apps-helm/karaoke-eternal/templates/ingress.yaml new file mode 100644 index 0000000..68bb95f --- /dev/null +++ b/apps-helm/karaoke-eternal/templates/ingress.yaml @@ -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 \ No newline at end of file diff --git a/apps-helm/karaoke-eternal/templates/pvc.yaml b/apps-helm/karaoke-eternal/templates/pvc.yaml new file mode 100644 index 0000000..d670a76 --- /dev/null +++ b/apps-helm/karaoke-eternal/templates/pvc.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: smb-oldmusic +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + storageClassName: smb-oldmusic diff --git a/apps-helm/karaoke-eternal/templates/service.yaml b/apps-helm/karaoke-eternal/templates/service.yaml new file mode 100644 index 0000000..0e32903 --- /dev/null +++ b/apps-helm/karaoke-eternal/templates/service.yaml @@ -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 -}} diff --git a/apps-helm/karaoke-eternal/values.yaml b/apps-helm/karaoke-eternal/values.yaml new file mode 100644 index 0000000..8c443a7 --- /dev/null +++ b/apps-helm/karaoke-eternal/values.yaml @@ -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