diff --git a/media/library/email-claim-pvc.yaml b/kavita/email-claim-pvc.yaml similarity index 100% rename from media/library/email-claim-pvc.yaml rename to kavita/email-claim-pvc.yaml diff --git a/media/library/email-deployment.yaml b/kavita/email-deployment.yaml similarity index 100% rename from media/library/email-deployment.yaml rename to kavita/email-deployment.yaml diff --git a/media/library/kavita-config-pvc.yaml b/kavita/kavita-config-pvc.yaml similarity index 100% rename from media/library/kavita-config-pvc.yaml rename to kavita/kavita-config-pvc.yaml diff --git a/media/library/kavita-deployment.yaml b/kavita/kavita-deployment.yaml similarity index 100% rename from media/library/kavita-deployment.yaml rename to kavita/kavita-deployment.yaml diff --git a/media/library/kavita-ebooks-pv.yaml b/kavita/kavita-ebooks-pv.yaml similarity index 100% rename from media/library/kavita-ebooks-pv.yaml rename to kavita/kavita-ebooks-pv.yaml diff --git a/media/library/kavita-ebooks-pvc.yaml b/kavita/kavita-ebooks-pvc.yaml similarity index 100% rename from media/library/kavita-ebooks-pvc.yaml rename to kavita/kavita-ebooks-pvc.yaml diff --git a/media/.helmignore b/media/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/media/.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/media/Chart.yaml b/media/Chart.yaml new file mode 100644 index 0000000..1be7624 --- /dev/null +++ b/media/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: media +description: App-of-apps for self-hosted media applications + +# 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: "1.16.0" diff --git a/media/templates/NOTES.txt b/media/templates/NOTES.txt new file mode 100644 index 0000000..6823b8c --- /dev/null +++ b/media/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "media.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "media.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "media.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "media.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/media/templates/_helpers.tpl b/media/templates/_helpers.tpl new file mode 100644 index 0000000..411574c --- /dev/null +++ b/media/templates/_helpers.tpl @@ -0,0 +1,72 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "media.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 "media.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 "media.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Set namespace +*/}} +{{- define "media.destination" -}} +destination: + namespace: {{- default "media" .Values.spec.destination.namespace }} + server: {{ .Values.spec.destination.server }} +{{- end }} + + +{{/* +Common labels +*/}} +{{- define "media.labels" -}} +helm.sh/chart: {{ include "media.chart" . }} +{{ include "media.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "media.selectorLabels" -}} +app.kubernetes.io/name: {{ include "media.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "media.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "media.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/media/templates/app-kavita.yaml b/media/templates/app-kavita.yaml new file mode 100644 index 0000000..15a82a0 --- /dev/null +++ b/media/templates/app-kavita.yaml @@ -0,0 +1,16 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: kavita + namespace: argocd + labels: + {{- include "media.labels" . | nindent 4 }} + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + {{- include "media.destination" . | nindent 2 }} + project: default + source: + path: media/kavita + repoURL: {{ .Values.spec.source.repoURL }} + targetRevision: {{ .Values.spec.source.targetRevision }} diff --git a/media/values.yaml b/media/values.yaml new file mode 100644 index 0000000..d90a5be --- /dev/null +++ b/media/values.yaml @@ -0,0 +1,7 @@ +spec: + destination: + server: https://kubernetes.default.svc + namespace: media + source: + repoURL: https://git.nc.landry.land/davad/argo.git + targetRevision: HEAD diff --git a/media/plex/.keep b/plex/.keep similarity index 100% rename from media/plex/.keep rename to plex/.keep