diff --git a/charts/sonarr/.helmignore b/charts/sonarr/.helmignore new file mode 100644 index 0000000..0330ca6 --- /dev/null +++ b/charts/sonarr/.helmignore @@ -0,0 +1,27 @@ +# 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/ +.gitlab-ci.yml +.pre-commit-config.yaml +README.md.gotmpl +.prettierignore diff --git a/charts/sonarr/Chart.yaml b/charts/sonarr/Chart.yaml new file mode 100644 index 0000000..34ea447 --- /dev/null +++ b/charts/sonarr/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: sonarr +description: A Sonarr Helm chart for Kubernetes + +type: application + +version: 1.5.0 + +# renovate: image=hotio/sonarr +appVersion: "release-4.0.8.1874" + +icon: https://avatars.githubusercontent.com/u/1082903 +annotations: + artifacthub.io/changes: | + - kind: changed + description: bumped version to release-4.0.8.1874 + artifacthub.io/images: | + - name: sonarr + image: hotio/sonarr + artifacthub.io/links: | + - name: Helm Repo + url: https://gitlab.com/alexander-chernov/helm/sonarr diff --git a/charts/sonarr/README.md b/charts/sonarr/README.md new file mode 100644 index 0000000..878601b --- /dev/null +++ b/charts/sonarr/README.md @@ -0,0 +1,55 @@ +# sonarr + +![Version: 1.5.0](https://img.shields.io/badge/Version-1.5.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: release-4.0.8.1874](https://img.shields.io/badge/AppVersion-release--4.0.8.1874-informational?style=flat-square) + +A Sonarr Helm chart for Kubernetes + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| autoscaling.enabled | bool | `false` | | +| autoscaling.maxReplicas | int | `100` | | +| autoscaling.minReplicas | int | `1` | | +| autoscaling.targetCPUUtilizationPercentage | int | `80` | | +| deployment.strategy | object | `{"type":"Recreate"}` | Deployment strategy | +| env.PGID | string | `"1000"` | | +| env.PUID | string | `"1000"` | | +| env.TZ | string | `"Europe/London"` | | +| env.UMASK | string | `"002"` | | +| fullnameOverride | string | `""` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"hotio/sonarr"` | | +| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. | +| imagePullSecrets | list | `[]` | | +| ingress.annotations | object | `{}` | | +| ingress.className | string | `""` | | +| 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.tls | list | `[]` | | +| nameOverride | string | `""` | | +| nodeSelector | object | `{}` | | +| persistence.accessMode | string | `"ReadWriteOnce"` | | +| persistence.additionalMounts | list | `[]` | if you need any additional volume mounts, you can define them here | +| persistence.additionalVolumes | list | `[]` | if you need any additional volumes, you can define them here | +| persistence.enabled | bool | `true` | | +| persistence.existingClaim | string | `""` | | +| persistence.size | string | `"800Mi"` | | +| persistence.storageClass | string | `""` | | +| podAnnotations | 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.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 | `[]` | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1) diff --git a/charts/sonarr/templates/_helpers.tpl b/charts/sonarr/templates/_helpers.tpl new file mode 100644 index 0000000..fd14a6e --- /dev/null +++ b/charts/sonarr/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "sonarr.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 "sonarr.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 "sonarr.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "sonarr.labels" -}} +helm.sh/chart: {{ include "sonarr.chart" . }} +{{ include "sonarr.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "sonarr.selectorLabels" -}} +app.kubernetes.io/name: {{ include "sonarr.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "sonarr.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "sonarr.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/sonarr/templates/deployment.yaml b/charts/sonarr/templates/deployment.yaml new file mode 100644 index 0000000..86f0f28 --- /dev/null +++ b/charts/sonarr/templates/deployment.yaml @@ -0,0 +1,89 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "sonarr.fullname" . }} + labels: + {{- include "sonarr.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + strategy: + {{- .Values.deployment.strategy | toYaml | nindent 4 }} + selector: + matchLabels: + {{- include "sonarr.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "sonarr.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "sonarr.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + - name: config + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default (include "sonarr.fullname" .) }} + {{- else }} + emptyDir: { } + {{- end }} + {{- if .Values.persistence.additionalVolumes }} + {{- .Values.persistence.additionalVolumes | toYaml | nindent 8}} + {{- end }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - mountPath: /config + name: config + {{- if .Values.persistence.additionalMounts }} + {{- .Values.persistence.additionalMounts | toYaml | nindent 12 }} + {{- end }} + ports: + - name: http + containerPort: 8989 + protocol: TCP + env: + {{- range $k,$v := .Values.env }} + - name: {{ $k }} + value: {{ $v | quote }} + {{- end }} + livenessProbe: + httpGet: + path: /ping + port: http + failureThreshold: 12 + periodSeconds: 10 + startupProbe: + httpGet: + path: /ping + port: http + failureThreshold: 30 + periodSeconds: 10 + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- 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/sonarr/templates/hpa.yaml b/charts/sonarr/templates/hpa.yaml new file mode 100644 index 0000000..9a66ed0 --- /dev/null +++ b/charts/sonarr/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "sonarr.fullname" . }} + labels: + {{- include "sonarr.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "sonarr.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/sonarr/templates/ingress.yaml b/charts/sonarr/templates/ingress.yaml new file mode 100644 index 0000000..a528ce1 --- /dev/null +++ b/charts/sonarr/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "sonarr.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (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.className}} + {{- 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 "sonarr.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + 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 }} + {{- 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/sonarr/templates/pvc.yaml b/charts/sonarr/templates/pvc.yaml new file mode 100644 index 0000000..b0faa51 --- /dev/null +++ b/charts/sonarr/templates/pvc.yaml @@ -0,0 +1,20 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "sonarr.fullname" . }} + labels: + {{- include "sonarr.labels" . | nindent 4 }} + annotations: + {{- if .Values.persistence.storageClass }} + volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} + {{- else }} + volume.alpha.kubernetes.io/storage-class: default + {{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- end }} diff --git a/charts/sonarr/templates/service.yaml b/charts/sonarr/templates/service.yaml new file mode 100644 index 0000000..44d4f6c --- /dev/null +++ b/charts/sonarr/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "sonarr.fullname" . }} + labels: + {{- include "sonarr.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "sonarr.selectorLabels" . | nindent 4 }} diff --git a/charts/sonarr/templates/serviceaccount.yaml b/charts/sonarr/templates/serviceaccount.yaml new file mode 100644 index 0000000..721e32d --- /dev/null +++ b/charts/sonarr/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "sonarr.serviceAccountName" . }} + labels: + {{- include "sonarr.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/sonarr/templates/tests/test-connection.yaml b/charts/sonarr/templates/tests/test-connection.yaml new file mode 100644 index 0000000..1fbcc85 --- /dev/null +++ b/charts/sonarr/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "sonarr.fullname" . }}-test-connection" + labels: + {{- include "sonarr.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "sonarr.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/charts/sonarr/values.yaml b/charts/sonarr/values.yaml new file mode 100644 index 0000000..44cf0da --- /dev/null +++ b/charts/sonarr/values.yaml @@ -0,0 +1,107 @@ +# Default values for sonarr. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: hotio/sonarr + pullPolicy: IfNotPresent + # -- Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +deployment: + # -- Deployment strategy + strategy: + type: Recreate + +serviceAccount: + # -- Specifies whether a service account should be created + create: 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: {} + +podSecurityContext: + {} + # fsGroup: 2000 + +securityContext: + {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + 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 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +env: + PUID: "1000" + PGID: "1000" + TZ: "Europe/London" + UMASK: "002" + +persistence: + storageClass: "" + existingClaim: "" + enabled: true + accessMode: ReadWriteOnce + size: 800Mi + # -- if you need any additional volumes, you can define them here + additionalVolumes: [] + # -- if you need any additional volume mounts, you can define them here + additionalMounts: []