From 3a852c326a523375c93deac32ae591b2a90ceb89 Mon Sep 17 00:00:00 2001 From: 0x6b-dev Date: Sat, 1 Jul 2023 02:06:16 +1000 Subject: [PATCH] kavita first attempt --- charts/stable/kavita/Chart.yaml | 36 ++++++++ charts/stable/kavita/templates/_helpers.tpl | 73 +++++++++++++++++ charts/stable/kavita/templates/config.yaml | 7 ++ .../stable/kavita/templates/deployment.yaml | 82 +++++++++++++++++++ charts/stable/kavita/templates/ingress.yaml | 41 ++++++++++ charts/stable/kavita/templates/pvc.yaml | 28 +++++++ charts/stable/kavita/templates/service.yaml | 12 +++ charts/stable/kavita/values.yaml | 57 +++++++++++++ 8 files changed, 336 insertions(+) create mode 100644 charts/stable/kavita/Chart.yaml create mode 100644 charts/stable/kavita/templates/_helpers.tpl create mode 100644 charts/stable/kavita/templates/config.yaml create mode 100644 charts/stable/kavita/templates/deployment.yaml create mode 100644 charts/stable/kavita/templates/ingress.yaml create mode 100644 charts/stable/kavita/templates/pvc.yaml create mode 100644 charts/stable/kavita/templates/service.yaml create mode 100644 charts/stable/kavita/values.yaml diff --git a/charts/stable/kavita/Chart.yaml b/charts/stable/kavita/Chart.yaml new file mode 100644 index 0000000..83ca0eb --- /dev/null +++ b/charts/stable/kavita/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v2 +name: kavita +# This is the chart version. +version: 0.1.0 +# A SemVer range of compatible Kubernetes versions (optional) +# kubeVersion: ">=1.16.0-0" +# What is this Application? +description: "Kavita is a rocket fueled self-hosted digital library which supports a vast array of file formats." +type: application +# Meta Keywords +keywords: + - PDF + - Manga + - Comic + - eReader +# The URL of this projects home page +home: https://www.kavitareader.com/ +# A list of URLs to source code for this project +sources: + - https://github.com/Kareadita/Kavita + - https://github.com/Kareadita/Kavita/pkgs/container/kavita +# Who's looking after this Chart? +maintainers: + - name: Kyle Coo-ops + email: kyle@coo-ops.space + url: https://git.coo-ops.space/cooper + - name: Alice + email: alice@stacktonic.com.au + url: https://github.com/HunterNyan +# A URL to an SVG or PNG image to be used as an icon (optional). +icon: https://raw.githubusercontent.com/Kareadita/Kavita/develop/favicon.ico + +# This is the version number of the application being deployed. This version number should be +appVersion: "v0.7.3" +# Whether this chart is deprecated (optional, boolean) +deprecated: false \ No newline at end of file diff --git a/charts/stable/kavita/templates/_helpers.tpl b/charts/stable/kavita/templates/_helpers.tpl new file mode 100644 index 0000000..0bc6343 --- /dev/null +++ b/charts/stable/kavita/templates/_helpers.tpl @@ -0,0 +1,73 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Expand the name of the chart. +*/}} +{{- define "kavita.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 "kavita.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 "kavita.chart" -}} + {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "kavita.labels" -}} +helm.sh/chart: {{ include "kavita.chart" . }} +{{ include "kavita.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "kavita.selectorLabels" -}} +app.kubernetes.io/name: {{ include "kavita.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Storage Class +*/}} +{{- define "kavita.persistence.storageClass" -}} +{{- $storageClass := .Values.persistence.storageClass }} +{{- if $storageClass }} +storageClassName: {{ $storageClass | quote }} +{{- end }} +{{- end -}} + + +{{- define "kavita.container-additional-mounts" -}} + {{- /* Honor the deprecated extraVolumeMounts variable when defined */ -}} + {{- if gt (len .Values.extraContainerVolumeMounts) 0 -}} + {{- toYaml .Values.extraContainerVolumeMounts -}} + {{- else if gt (len .Values.extraVolumeMounts) 0 -}} + {{- toYaml .Values.extraVolumeMounts -}} + {{- end -}} +{{- end -}} diff --git a/charts/stable/kavita/templates/config.yaml b/charts/stable/kavita/templates/config.yaml new file mode 100644 index 0000000..17666c5 --- /dev/null +++ b/charts/stable/kavita/templates/config.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-config + namespace: {{ .Values.namespace }} +data: +{{- toYaml .Values.kavita.env | nindent 2 }} \ No newline at end of file diff --git a/charts/stable/kavita/templates/deployment.yaml b/charts/stable/kavita/templates/deployment.yaml new file mode 100644 index 0000000..ae456fb --- /dev/null +++ b/charts/stable/kavita/templates/deployment.yaml @@ -0,0 +1,82 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "kavita.fullname" . }} + namespace: {{ .Values.namespace }} + labels: + {{- include "kavita.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "kavita.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "kavita.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.www.image }}:{{ .Values.www.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.www.pullPolicy }} + envFrom: + - configMapRef: + name: {{ .Release.Name }}-config + ports: + - name: http + containerPort: 7745 + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: config + mountPath: /kavita/config + {{- if .Values.persistence.subPath }} + subPath: {{ .Values.persistence.subPath }} + {{- end }} + volumes: + {{- if gt (len .Values.extraVolumes) 0 }} + {{- toYaml .Values.extraVolumes | nindent 8 }} + {{- end }} + {{- if and .Values.persistence.enabled .Values.persistence.existingClaim }} + - name: config + persistentVolumeClaim: + {{- with .Values.persistence.existingClaim }} + claimName: {{ tpl . $ }} + {{- end }} + {{- else if not .Values.persistence.enabled }} + - name: config + emptyDir: {} + {{- else if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} + - name: config + persistentVolumeClaim: + claimName: {{ include "kavita.fullname" . }}-pvc + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.dnsConfig }} + dnsConfig: + {{- toYaml . | nindent 8 }} + {{- end }} \ No newline at end of file diff --git a/charts/stable/kavita/templates/ingress.yaml b/charts/stable/kavita/templates/ingress.yaml new file mode 100644 index 0000000..2497fc4 --- /dev/null +++ b/charts/stable/kavita/templates/ingress.yaml @@ -0,0 +1,41 @@ +{{- if .Values.ingress.enabled -}} +{{- $serviceName := .Release.Name -}} + +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className }} +{{- end }} +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + pathType: {{ .pathType }} + backend: + service: + name: {{ $serviceName }} + port: + number: 5000 + {{- end }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/stable/kavita/templates/pvc.yaml b/charts/stable/kavita/templates/pvc.yaml new file mode 100644 index 0000000..d0ef3ce --- /dev/null +++ b/charts/stable/kavita/templates/pvc.yaml @@ -0,0 +1,28 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + namespace: {{ .Values.namespace }} + name: {{ include "kavita.fullname" . }}-pvc + {{- with .Values.persistence.annotations }} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ $value }} + {{- end }} + {{- end }} + {{- with .Values.persistence.labels }} + labels: + {{- range $key, $value := . }} + {{ $key }}: {{ $value }} + {{- end }} + {{- end }} +spec: + accessModes: + {{- range .Values.persistence.accessModes }} + - {{ . | quote }} + {{- end }} + {{- include "kavita.persistence.storageClass" . | indent 2 }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- end }} \ No newline at end of file diff --git a/charts/stable/kavita/templates/service.yaml b/charts/stable/kavita/templates/service.yaml new file mode 100644 index 0000000..99f1d2a --- /dev/null +++ b/charts/stable/kavita/templates/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }} + namespace: {{ .Values.namespace }} + labels: + {{- include "kavita.labels" . | nindent 4 }} +spec: + ports: + - port: 5000 + selector: + {{- include "kavita.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/charts/stable/kavita/values.yaml b/charts/stable/kavita/values.yaml new file mode 100644 index 0000000..b8b44b7 --- /dev/null +++ b/charts/stable/kavita/values.yaml @@ -0,0 +1,57 @@ +# Default values for kavita. +# This is a YAML-formatted file. + +# Namespace to use. +namespace: kavita + +# Replica's to Deploy. +replicaCount: 1 + +# Image to use. +www: + image: kizaing/kavita + pullPolicy: Always + tag: "v0.7.3" + +# Overrides. +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +kavita: + env: + TZ: UTC + +ingress: + enabled: true + className: "nginx" + tls: + - secretName: kavita-domain-tls + hosts: + - kavita.example.com + hosts: + - host: kavita.example.com + paths: + - path: / + pathType: Prefix + +persistence: + enabled: true + existingClaim: + size: 1Gi + accessModes: + - ReadWriteOnce + labels: {} + annotations: {} + storageClass: + subPath: + +extraVolumes: +# - name: nfs +# nfs: +# server: "10.0.0.1" +# path: "/nextcloud_data" +# readOnly: false +extraVolumeMounts: +# - name: nfs +# mountPath: "/legacy_data" \ No newline at end of file -- 2.45.2