From 658ca858cd6312f147409788b8afbafc8825b097 Mon Sep 17 00:00:00 2001 From: Ludovic Ortega Date: Mon, 25 Mar 2024 21:43:30 +0000 Subject: [PATCH] feat: add radarr --- charts/radarr/.helmignore | 23 ++++ charts/radarr/Chart.yaml | 11 ++ charts/radarr/README.md | 66 +++++++++++ charts/radarr/README.md.gotmpl | 25 ++++ charts/radarr/templates/NOTES.txt | 5 + charts/radarr/templates/_helpers.tpl | 69 +++++++++++ charts/radarr/templates/deployment.yaml | 89 ++++++++++++++ charts/radarr/templates/hpa.yaml | 32 +++++ charts/radarr/templates/ingress.yaml | 61 ++++++++++ .../templates/persistentvolumeclaim.yaml | 15 +++ charts/radarr/templates/service.yaml | 15 +++ charts/radarr/templates/serviceaccount.yaml | 13 ++ .../templates/tests/test-connection.yaml | 15 +++ charts/radarr/values.yaml | 111 ++++++++++++++++++ 14 files changed, 550 insertions(+) create mode 100644 charts/radarr/.helmignore create mode 100644 charts/radarr/Chart.yaml create mode 100644 charts/radarr/README.md create mode 100644 charts/radarr/README.md.gotmpl create mode 100644 charts/radarr/templates/NOTES.txt create mode 100644 charts/radarr/templates/_helpers.tpl create mode 100644 charts/radarr/templates/deployment.yaml create mode 100644 charts/radarr/templates/hpa.yaml create mode 100644 charts/radarr/templates/ingress.yaml create mode 100644 charts/radarr/templates/persistentvolumeclaim.yaml create mode 100644 charts/radarr/templates/service.yaml create mode 100644 charts/radarr/templates/serviceaccount.yaml create mode 100644 charts/radarr/templates/tests/test-connection.yaml create mode 100644 charts/radarr/values.yaml diff --git a/charts/radarr/.helmignore b/charts/radarr/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/radarr/.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/charts/radarr/Chart.yaml b/charts/radarr/Chart.yaml new file mode 100644 index 0000000..01e4d7c --- /dev/null +++ b/charts/radarr/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v2 +name: radarr +description: radarr helm chart for Kubernetes +type: application +version: 0.1.0 +# image: linuxserver/radarr +appVersion: "5.3.6.8612" +sources: + - https://github.com/M0NsTeRRR/helm-charts/tree/main/charts/radarr +home: https://github.com/Radarr/Radarr +icon: https://artifacthub.io/image/e417b561-5fe4-4ee3-9b89-f67df4069169 \ No newline at end of file diff --git a/charts/radarr/README.md b/charts/radarr/README.md new file mode 100644 index 0000000..6e7e8b0 --- /dev/null +++ b/charts/radarr/README.md @@ -0,0 +1,66 @@ +# radarr + +![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 5.3.6.8612](https://img.shields.io/badge/AppVersion-5.3.6.8612-informational?style=flat-square) + +radarr helm chart for Kubernetes + +**Homepage:** + +## Source Code + +* + +## Chart Repo + +Add the following repo to use the chart: + +```console +helm repo add adminafk https://helm-charts.adminafk.fr +``` + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| autoscaling.enabled | bool | `false` | | +| autoscaling.maxReplicas | int | `100` | | +| autoscaling.minReplicas | int | `1` | | +| autoscaling.targetCPUUtilizationPercentage | int | `80` | | +| config | object | `{"persistence":{"annotations":{},"name":"","size":"5Gi"}}` | Creating PVC to store configuration | +| config.persistence.annotations | object | `{}` | Annotations for PVCs | +| config.persistence.name | string | `""` | Config name | +| config.persistence.size | string | `"5Gi"` | Size of persistent disk | +| extraEnv | list | `[]` | Environment variables to add to the prometheus-pve-exporter pods | +| extraEnvFrom | list | `[]` | Environment variables from secrets or configmaps to add to the prometheus-pve-exporter pods | +| fullnameOverride | string | `""` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.registry | string | `"lscr.io"` | | +| image.repository | string | `"linuxserver/radarr"` | | +| image.sha | string | `""` | | +| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. | +| imagePullSecrets | list | `[]` | | +| ingress.annotations | object | `{}` | | +| ingress.enabled | bool | `false` | | +| ingress.hosts[0].host | string | `"chart-example.local"` | | +| ingress.hosts[0].paths[0].path | string | `"/"` | | +| ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | | +| ingress.ingressClassName | string | `""` | | +| ingress.tls | list | `[]` | | +| nameOverride | string | `""` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| podSecurityContext | object | `{}` | | +| replicaCount | int | `1` | | +| resources | object | `{}` | | +| securityContext | object | `{}` | | +| service.port | int | `80` | | +| service.type | string | `"ClusterIP"` | | +| serviceAccount.annotations | object | `{}` | Annotations to add to the service account | +| serviceAccount.automount | bool | `true` | Automatically mount a ServiceAccount's API credentials? | +| serviceAccount.create | bool | `true` | Specifies whether a service account should be created | +| serviceAccount.name | string | `""` | If not set and create is true, a name is generated using the fullname template | +| tolerations | list | `[]` | | +| volumeMounts | list | `[]` | Additional volumeMounts on the output Deployment definition. | +| volumes | list | `[]` | Additional volumes on the output Deployment definition. | \ No newline at end of file diff --git a/charts/radarr/README.md.gotmpl b/charts/radarr/README.md.gotmpl new file mode 100644 index 0000000..5e5401d --- /dev/null +++ b/charts/radarr/README.md.gotmpl @@ -0,0 +1,25 @@ +{{ template "chart.header" . }} + +{{ template "chart.deprecationWarning" . }} + +{{ template "chart.badgesSection" . }} + +{{ template "chart.description" . }} + +{{ template "chart.homepageLine" . }} + +{{ template "chart.maintainersSection" . }} + +{{ template "chart.sourcesSection" . }} + +{{ template "chart.requirementsSection" . }} + +## Chart Repo + +Add the following repo to use the chart: + +```console +helm repo add adminafk https://helm-charts.adminafk.fr +``` + +{{ template "chart.valuesSection" . }} \ No newline at end of file diff --git a/charts/radarr/templates/NOTES.txt b/charts/radarr/templates/NOTES.txt new file mode 100644 index 0000000..aa8a44b --- /dev/null +++ b/charts/radarr/templates/NOTES.txt @@ -0,0 +1,5 @@ +*********************************************************************** + Welcome to {{ .Chart.Name }} + Chart version: {{ .Chart.Version }} + App version: {{ .Chart.AppVersion }} +*********************************************************************** \ No newline at end of file diff --git a/charts/radarr/templates/_helpers.tpl b/charts/radarr/templates/_helpers.tpl new file mode 100644 index 0000000..a3372a9 --- /dev/null +++ b/charts/radarr/templates/_helpers.tpl @@ -0,0 +1,69 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "radarr.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 "radarr.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 "radarr.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "radarr.labels" -}} +helm.sh/chart: {{ include "radarr.chart" . }} +{{ include "radarr.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "radarr.selectorLabels" -}} +app.kubernetes.io/name: {{ include "radarr.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "radarr.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "radarr.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Create the name of the pvc config to use +*/}} +{{- define "radarr.configPersistenceName" -}} +{{- printf "%s-config" (include "radarr.fullname" .) -}} +{{- end }} \ No newline at end of file diff --git a/charts/radarr/templates/deployment.yaml b/charts/radarr/templates/deployment.yaml new file mode 100644 index 0000000..4826a6b --- /dev/null +++ b/charts/radarr/templates/deployment.yaml @@ -0,0 +1,89 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "radarr.fullname" . }} + labels: + {{- include "radarr.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "radarr.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "radarr.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "radarr.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + {{- if .Values.image.sha }} + image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}@sha256:{{ .Values.image.sha }}" + {{- else }} + image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + {{- end }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 7878 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: 7878 + readinessProbe: + httpGet: + path: / + port: 7878 + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.extraEnv }} + env: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.extraEnvFrom }} + envFrom: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumeMounts }} + volumeMounts: + - name: config + mountPath: /config + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + - name: config + persistentVolumeClaim: + claimName: {{ include "radarr.configPersistenceName" . }} + {{- toYaml . | nindent 8 }} + {{- 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 }} diff --git a/charts/radarr/templates/hpa.yaml b/charts/radarr/templates/hpa.yaml new file mode 100644 index 0000000..dc5d99d --- /dev/null +++ b/charts/radarr/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "radarr.fullname" . }} + labels: + {{- include "radarr.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "radarr.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/radarr/templates/ingress.yaml b/charts/radarr/templates/ingress.yaml new file mode 100644 index 0000000..1d28f45 --- /dev/null +++ b/charts/radarr/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "radarr.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.ingressClassName (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.ingressClassName}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "radarr.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.ingressClassName (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.ingressClassName }} + {{- 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 }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/radarr/templates/persistentvolumeclaim.yaml b/charts/radarr/templates/persistentvolumeclaim.yaml new file mode 100644 index 0000000..7602e87 --- /dev/null +++ b/charts/radarr/templates/persistentvolumeclaim.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "radarr.configPersistenceName" . }} + labels: + {{- include "radarr.labels" . | nindent 4 }} +spec: + accessModes: + - ReadWriteOnce + {{- with .Values.config.persistence.storageClass }} + storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} + {{- end }} + resources: + requests: + storage: "{{ .Values.config.persistence.size }}" \ No newline at end of file diff --git a/charts/radarr/templates/service.yaml b/charts/radarr/templates/service.yaml new file mode 100644 index 0000000..47a7f40 --- /dev/null +++ b/charts/radarr/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "radarr.fullname" . }} + labels: + {{- include "radarr.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "radarr.selectorLabels" . | nindent 4 }} diff --git a/charts/radarr/templates/serviceaccount.yaml b/charts/radarr/templates/serviceaccount.yaml new file mode 100644 index 0000000..637ab0f --- /dev/null +++ b/charts/radarr/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "radarr.serviceAccountName" . }} + labels: + {{- include "radarr.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/charts/radarr/templates/tests/test-connection.yaml b/charts/radarr/templates/tests/test-connection.yaml new file mode 100644 index 0000000..3faf6e9 --- /dev/null +++ b/charts/radarr/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "radarr.fullname" . }}-test-connection" + labels: + {{- include "radarr.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "radarr.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/charts/radarr/values.yaml b/charts/radarr/values.yaml new file mode 100644 index 0000000..dc124af --- /dev/null +++ b/charts/radarr/values.yaml @@ -0,0 +1,111 @@ +replicaCount: 1 + +image: + registry: lscr.io + repository: linuxserver/radarr + pullPolicy: IfNotPresent + # -- Overrides the image tag whose default is the chart appVersion. + tag: "" + sha: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +# -- Environment variables to add to the prometheus-pve-exporter pods +extraEnv: [] +# -- Environment variables from secrets or configmaps to add to the prometheus-pve-exporter pods +extraEnvFrom: [] + +serviceAccount: + # -- Specifies whether a service account should be created + create: true + # -- Automatically mount a ServiceAccount's API credentials? + automount: true + # -- Annotations to add to the service account + annotations: {} + # -- The name of the service account to use. + # -- If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +# -- Creating PVC to store configuration +config: + persistence: + # -- Size of persistent disk + size: 5Gi + # -- Annotations for PVCs + annotations: {} + # -- Config name + name: "" + +ingress: + enabled: false + ingressClassName: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# -- Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# -- Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {}