diff --git a/.github/workflows/lint-helm-charts.yml b/.github/workflows/lint-helm-charts.yml new file mode 100644 index 000000000..e46a11eec --- /dev/null +++ b/.github/workflows/lint-helm-charts.yml @@ -0,0 +1,33 @@ +name: Lint and Test Charts + +on: + pull_request: + branches: + - develop + paths: + - '.github/workflows/lint-helm-charts.yml' + - 'charts/**' +jobs: + lint-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Helm + uses: azure/setup-helm@v4.2.0 + - name: Ensure documentation is updated + uses: docker://jnorwood/helm-docs:v1.14.2 + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.6.1 + - name: Run chart-testing (list-changed) + id: list-changed + run: | + changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) + if [[ -n "$changed" ]]; then + echo "changed=true" >> "$GITHUB_OUTPUT" + fi + - name: Run chart-testing + if: steps.list-changed.outputs.changed == 'true' + run: ct lint --target-branch ${{ github.event.repository.default_branch }} --validate-maintainers=false diff --git a/.github/workflows/test-docs-deploy.yml b/.github/workflows/test-docs-deploy.yml index bba305454..5526af094 100644 --- a/.github/workflows/test-docs-deploy.yml +++ b/.github/workflows/test-docs-deploy.yml @@ -4,7 +4,7 @@ on: pull_request: branches: - develop - path: + paths: - 'docs/**' - 'gen-docs/**' diff --git a/.prettierignore b/.prettierignore index e7f72ab6e..c2e778c1d 100644 --- a/.prettierignore +++ b/.prettierignore @@ -9,3 +9,6 @@ pnpm-lock.yaml src/assets/ public/ docs/ + +# helm charts +**/charts diff --git a/.prettierrc.js b/.prettierrc.js index 1de1f8bf3..10da08eb1 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -15,5 +15,11 @@ module.exports = { rangeEnd: 0, // default: Infinity }, }, + { + files: 'charts/**', + options: { + rangeEnd: 0, // default: Infinity + }, + }, ], }; diff --git a/charts/jellyseerr/.helmignore b/charts/jellyseerr/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/charts/jellyseerr/.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/jellyseerr/Chart.yaml b/charts/jellyseerr/Chart.yaml new file mode 100644 index 000000000..c06600e56 --- /dev/null +++ b/charts/jellyseerr/Chart.yaml @@ -0,0 +1,13 @@ +apiVersion: v2 +kubeVersion: ">=1.23.0-0" +name: Jellyseerr +description: Jellyseerr helm chart for Kubernetes +type: application +version: 1.1.0 +appVersion: "2.1.0" +maintainers: + - name: Jellyseerr + url: https://github.com/Fallenbagel/jellyseerr +sources: + - https://github.com/Fallenbagel/jellyseerr/tree/main/charts/jellyseerr +home: https://github.com/Fallenbagel/jellyseerr diff --git a/charts/jellyseerr/README.md b/charts/jellyseerr/README.md new file mode 100644 index 000000000..45d77c90f --- /dev/null +++ b/charts/jellyseerr/README.md @@ -0,0 +1,69 @@ +# Jellyseerr + +![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.1.0](https://img.shields.io/badge/AppVersion-2.1.0-informational?style=flat-square) + +Jellyseerr helm chart for Kubernetes + +**Homepage:** + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| Jellyseerr | | | + +## Source Code + +* + +## Requirements + +Kubernetes: `>=1.23.0-0` + +## 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":{"accessModes":["ReadWriteOnce"],"annotations":{},"name":"","size":"5Gi","volumeName":""}}` | Creating PVC to store configuration | +| config.persistence.accessModes | list | `["ReadWriteOnce"]` | Access modes of persistent disk | +| config.persistence.annotations | object | `{}` | Annotations for PVCs | +| config.persistence.name | string | `""` | Config name | +| config.persistence.size | string | `"5Gi"` | Size of persistent disk | +| config.persistence.volumeName | string | `""` | Name of the permanent volume to reference in the claim. Can be used to bind to existing volumes. | +| extraEnv | list | `[]` | Environment variables to add to the jellyseerr pods | +| extraEnvFrom | list | `[]` | Environment variables from secrets or configmaps to add to the jellyseerr pods | +| fullnameOverride | string | `""` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.registry | string | `"docker.io"` | | +| image.repository | string | `"fallenbagel/jellyseerr"` | | +| 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 | +| strategy | object | `{"type":"Recreate"}` | Deployment strategy | +| tolerations | list | `[]` | | diff --git a/charts/jellyseerr/README.md.gotmpl b/charts/jellyseerr/README.md.gotmpl new file mode 100644 index 000000000..c58fe7d5f --- /dev/null +++ b/charts/jellyseerr/README.md.gotmpl @@ -0,0 +1,17 @@ +{{ template "chart.header" . }} + +{{ template "chart.deprecationWarning" . }} + +{{ template "chart.badgesSection" . }} + +{{ template "chart.description" . }} + +{{ template "chart.homepageLine" . }} + +{{ template "chart.maintainersSection" . }} + +{{ template "chart.sourcesSection" . }} + +{{ template "chart.requirementsSection" . }} + +{{ template "chart.valuesSection" . }} diff --git a/charts/jellyseerr/templates/NOTES.txt b/charts/jellyseerr/templates/NOTES.txt new file mode 100644 index 000000000..aa8a44b68 --- /dev/null +++ b/charts/jellyseerr/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/jellyseerr/templates/_helpers.tpl b/charts/jellyseerr/templates/_helpers.tpl new file mode 100644 index 000000000..bb4b4ef6e --- /dev/null +++ b/charts/jellyseerr/templates/_helpers.tpl @@ -0,0 +1,70 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "jellyseerr.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 "jellyseerr.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 "jellyseerr.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "jellyseerr.labels" -}} +helm.sh/chart: {{ include "jellyseerr.chart" . }} +{{ include "jellyseerr.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/part-of: {{ .Chart.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "jellyseerr.selectorLabels" -}} +app.kubernetes.io/name: {{ include "jellyseerr.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "jellyseerr.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "jellyseerr.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Create the name of the pvc config to use +*/}} +{{- define "jellyseerr.configPersistenceName" -}} +{{- default (printf "%s-config" (include "jellyseerr.fullname" .)) .Values.config.persistence.name }} +{{- end }} \ No newline at end of file diff --git a/charts/jellyseerr/templates/deployment.yaml b/charts/jellyseerr/templates/deployment.yaml new file mode 100644 index 000000000..8c9c57a18 --- /dev/null +++ b/charts/jellyseerr/templates/deployment.yaml @@ -0,0 +1,85 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "jellyseerr.fullname" . }} + labels: + {{- include "jellyseerr.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + strategy: + type: {{ .Values.strategy.type }} + selector: + matchLabels: + {{- include "jellyseerr.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "jellyseerr.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "jellyseerr.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: 5055 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.extraEnv }} + env: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.extraEnvFrom }} + envFrom: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + - name: config + mountPath: /app/config + volumes: + - name: config + persistentVolumeClaim: + claimName: {{ include "jellyseerr.configPersistenceName" . }} + {{- 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/jellyseerr/templates/hpa.yaml b/charts/jellyseerr/templates/hpa.yaml new file mode 100644 index 000000000..291f83de3 --- /dev/null +++ b/charts/jellyseerr/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "jellyseerr.fullname" . }} + labels: + {{- include "jellyseerr.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "jellyseerr.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/jellyseerr/templates/ingress.yaml b/charts/jellyseerr/templates/ingress.yaml new file mode 100644 index 000000000..85f1125a0 --- /dev/null +++ b/charts/jellyseerr/templates/ingress.yaml @@ -0,0 +1,41 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "jellyseerr.fullname" . }} + labels: + {{- include "jellyseerr.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.ingressClassName }} + 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 }} + pathType: {{ .pathType }} + backend: + service: + name: {{ include "jellyseerr.fullname" $ }} + port: + number: {{ $.Values.service.port }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/jellyseerr/templates/persistentvolumeclaim.yaml b/charts/jellyseerr/templates/persistentvolumeclaim.yaml new file mode 100644 index 000000000..bf0d64223 --- /dev/null +++ b/charts/jellyseerr/templates/persistentvolumeclaim.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "jellyseerr.configPersistenceName" . }} + labels: + {{- include "jellyseerr.labels" . | nindent 4 }} +spec: + {{- with .Values.config.persistence.accessModes }} + accessModes: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- if .Values.config.persistence.volumeName }} + volumeName: {{ .Values.config.persistence.volumeName }} + {{- end }} + {{- 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/jellyseerr/templates/service.yaml b/charts/jellyseerr/templates/service.yaml new file mode 100644 index 000000000..5c915e3b4 --- /dev/null +++ b/charts/jellyseerr/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "jellyseerr.fullname" . }} + labels: + {{- include "jellyseerr.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "jellyseerr.selectorLabels" . | nindent 4 }} + ipFamilyPolicy: PreferDualStack diff --git a/charts/jellyseerr/templates/serviceaccount.yaml b/charts/jellyseerr/templates/serviceaccount.yaml new file mode 100644 index 000000000..6a2dcfd0a --- /dev/null +++ b/charts/jellyseerr/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "jellyseerr.serviceAccountName" . }} + labels: + {{- include "jellyseerr.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/charts/jellyseerr/templates/tests/test-connection.yaml b/charts/jellyseerr/templates/tests/test-connection.yaml new file mode 100644 index 000000000..6adc5d308 --- /dev/null +++ b/charts/jellyseerr/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "jellyseerr.fullname" . }}-test-connection" + labels: + {{- include "jellyseerr.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "jellyseerr.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/charts/jellyseerr/values.yaml b/charts/jellyseerr/values.yaml new file mode 100644 index 000000000..50c7865f8 --- /dev/null +++ b/charts/jellyseerr/values.yaml @@ -0,0 +1,108 @@ +replicaCount: 1 + +image: + registry: docker.io + repository: fallenbagel/jellyseerr + pullPolicy: IfNotPresent + # -- Overrides the image tag whose default is the chart appVersion. + tag: "" + sha: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +# -- Deployment strategy +strategy: + type: Recreate + +# -- Environment variables to add to the jellyseerr pods +extraEnv: [] +# -- Environment variables from secrets or configmaps to add to the jellyseerr 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: {} + # -- Access modes of persistent disk + accessModes: + - ReadWriteOnce + # -- Config name + name: "" + # -- Name of the permanent volume to reference in the claim. + # Can be used to bind to existing volumes. + volumeName: "" + +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 + +nodeSelector: {} + +tolerations: [] + +affinity: {}