From f04f777ec28a3550fe020e9f9bc3f2ae0046d08a Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 14 Mar 2024 23:58:47 -0600 Subject: [PATCH] add cops --- charts/cops/Chart.yaml | 12 +++ charts/cops/README.md | 22 ++++++ charts/cops/templates/deployment.yaml | 73 +++++++++++++++++++ charts/cops/templates/ingress.yaml | 32 ++++++++ .../templates/persistant-volume-claim.yaml | 19 +++++ charts/cops/templates/pod.yaml | 26 +++++++ charts/cops/templates/service-account.yaml | 11 +++ charts/cops/templates/service.yaml | 22 ++++++ charts/cops/values.yaml | 35 +++++++++ 9 files changed, 252 insertions(+) create mode 100644 charts/cops/Chart.yaml create mode 100644 charts/cops/README.md create mode 100644 charts/cops/templates/deployment.yaml create mode 100644 charts/cops/templates/ingress.yaml create mode 100644 charts/cops/templates/persistant-volume-claim.yaml create mode 100644 charts/cops/templates/pod.yaml create mode 100644 charts/cops/templates/service-account.yaml create mode 100644 charts/cops/templates/service.yaml create mode 100644 charts/cops/values.yaml diff --git a/charts/cops/Chart.yaml b/charts/cops/Chart.yaml new file mode 100644 index 0000000..dfde350 --- /dev/null +++ b/charts/cops/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +name: cops +version: 0.0.1 +description: Chart for Calibre OPDS (and HTML) PHP Server +keywords: + - calibre + - OPDS +sources: + - https://github.com/seblucas/cops +maintainers: + - name: alexlebens +appVersion: 1.1.3 diff --git a/charts/cops/README.md b/charts/cops/README.md new file mode 100644 index 0000000..9f4d5fa --- /dev/null +++ b/charts/cops/README.md @@ -0,0 +1,22 @@ +## Introduction + +[Calibre OPDS (and HTML) PHP Server](https://github.com/seblucas/cops) + +COPS's main advantages are : + + - No need for many dependencies. + - No need for a lot of CPU or RAM. + - Not much code. + - Search is available. + - It was fun to code. + +This chart bootstraps a [COPS](https://github.com/seblucas/cops) deployment on a [Kubernetes](https://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- Kubernetes +- Helm + +## Parameters + +See the [values files](values.yaml). diff --git a/charts/cops/templates/deployment.yaml b/charts/cops/templates/deployment.yaml new file mode 100644 index 0000000..0f87adc --- /dev/null +++ b/charts/cops/templates/deployment.yaml @@ -0,0 +1,73 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }} + namespace: {{ .Release.Namespace | quote }} + labels: + app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: web + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + revisionHistoryLimit: 3 + replicas: {{ .Values.deployment.replicas }} + strategy: + type: {{ .Values.deployment.strategy }} + selector: + matchLabels: + app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + serviceAccountName: {{ .Release.Name }} + containers: + - name: {{ .Release.Name }} + image: "{{ .Values.deployment.image.repository }}:{{ .Values.deployment.image.tag }}" + imagePullPolicy: {{ .Values.deployment.image.imagePullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.http.port }} + protocol: TCP + volumeMounts: + - mountPath: /config + name: cops-config + - mountPath: /books + name: cops-books + resources: + {{- toYaml .Values.deployment.resources | nindent 12 }} + livenessProbe: + httpGet: + path: / + port: {{ .Values.service.http.port }} + initialDelaySeconds: 0 + failureThreshold: 5 + timeoutSeconds: 1 + periodSeconds: 10 + readinessProbe: + httpGet: + path: / + port: {{ .Values.service.http.port }} + initialDelaySeconds: 0 + failureThreshold: 5 + timeoutSeconds: 1 + periodSeconds: 10 + startupProbe: + httpGet: + path: / + port: {{ .Values.service.http.port }} + initialDelaySeconds: 5 + failureThreshold: 30 + periodSeconds: 10 + timeoutSeconds: 1 + volumes: + - name: cops-config + persistentVolumeClaim: + claimName: cops-config + - name: cops-books + persistentVolumeClaim: + claimName: {{ .Values.persistence.books.claimName }} diff --git a/charts/cops/templates/ingress.yaml b/charts/cops/templates/ingress.yaml new file mode 100644 index 0000000..39757f7 --- /dev/null +++ b/charts/cops/templates/ingress.yaml @@ -0,0 +1,32 @@ +{{- if .Values.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }} + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: web + app.kubernetes.io/part-of: {{ .Release.Name }} + annotations: + {{- toYaml .Values.ingress.annotations | nindent 4 }} +spec: + ingressClassName: {{ .Values.ingress.className }} + tls: + - hosts: + - {{ .Values.ingress.host }} + secretName: {{ .Release.Name }}-tls-secret + rules: + - host: {{ .Values.ingress.host }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ .Release.Name }} + port: + name: http +{{- end }} diff --git a/charts/cops/templates/persistant-volume-claim.yaml b/charts/cops/templates/persistant-volume-claim.yaml new file mode 100644 index 0000000..14dd2bd --- /dev/null +++ b/charts/cops/templates/persistant-volume-claim.yaml @@ -0,0 +1,19 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: cops-config + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: storage + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.persistence.config.storageSize }} + storageClassName: {{ .Values.persistence.config.storageClassName }} + volumeMode: {{ .Values.persistence.config.volumeMode }} diff --git a/charts/cops/templates/pod.yaml b/charts/cops/templates/pod.yaml new file mode 100644 index 0000000..b9f52eb --- /dev/null +++ b/charts/cops/templates/pod.yaml @@ -0,0 +1,26 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ .Release.Name }}-test-connection" + labels: + app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: web + app.kubernetes.io/part-of: {{ .Release.Name }} + annotations: + "helm.sh/hook": test-success +spec: + restartPolicy: Never + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ .Release.Name }}:{{ .Values.service.http.port }}'] + resources: + limits: + cpu: 500m + memory: 1Gi + requests: + cpu: 50m + memory: 256Mi diff --git a/charts/cops/templates/service-account.yaml b/charts/cops/templates/service-account.yaml new file mode 100644 index 0000000..a437092 --- /dev/null +++ b/charts/cops/templates/service-account.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Release.Name }} + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: web + app.kubernetes.io/part-of: {{ .Release.Name }} diff --git a/charts/cops/templates/service.yaml b/charts/cops/templates/service.yaml new file mode 100644 index 0000000..aa34498 --- /dev/null +++ b/charts/cops/templates/service.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }} + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + app.kubernetes.io/component: web + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + type: ClusterIP + externalTrafficPolicy: + ports: + - port: {{ .Values.service.http.port }} + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/charts/cops/values.yaml b/charts/cops/values.yaml new file mode 100644 index 0000000..d1c2fbf --- /dev/null +++ b/charts/cops/values.yaml @@ -0,0 +1,35 @@ +deployment: + replicas: 1 + strategy: Recreate + image: + repository: linuxserver/cops + tag: 2.3.1-ls185 + imagePullPolicy: IfNotPresent + env: + PGID: "1000" + PUID: "1000" + TZ: UTC + resources: + limits: + cpu: 500m + memory: 1Gi + requests: + cpu: 50m + memory: 256Mi +serviceAccount: + create: true +service: + http: + port: 80 +ingress: + enabled: false + annotations: + className: + host: +persistence: + config: + storageClassName: default + storageSize: 5Gi + volumeMode: Filesystem + books: + claimName: