refactor: move Helm chart to standard directory structure
All checks were successful
Build Helm Chart / helm-package (push) Successful in 4s

This commit restructures the paperless-ai Helm chart by moving all files
 from the nested directory (charts/paperless-ai/paperless-ai/) to the
 standard Helm chart directory structure (charts/paperless-ai/). The change
 eliminates the redundant directory nesting that was causing issues with
 Helm chart packaging and installation. No functional changes were made to
 any files - this is purely a directory structure reorganization to follow
 Helm best practices and improve chart maintainability.
This commit is contained in:
2025-06-27 08:43:57 +02:00
parent 8b3e5d2cc7
commit f3fbaf942e
18 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "paperless-ai.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "paperless-ai.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "paperless-ai.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "paperless-ai.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}

View File

@ -0,0 +1,79 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "paperless-ai.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 "paperless-ai.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 "paperless-ai.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "paperless-ai.labels" -}}
helm.sh/chart: {{ include "paperless-ai.chart" . }}
{{ include "paperless-ai.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "paperless-ai.selectorLabels" -}}
app.kubernetes.io/name: {{ include "paperless-ai.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "paperless-ai.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "paperless-ai.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{/*
Generiert den Inhalt der .env-Datei aus den Werten in .Values.secretEnv
*/}}
{{- define "generateEnv" -}}
{{- if .Values.paperless.apiUrl }}PAPERLESS_API_URL={{ .Values.paperless.apiUrl }}{{ "\n" }}{{- end }}
{{- if .Values.ai.provider }}AI_PROVIDER={{ .Values.ai.provider }}{{ "\n" }}{{- end }}
{{- if .Values.ai.addProcessedTag }}ADD_AI_PROCESSED_TAG={{ .Values.ai.addProcessedTag }}{{ "\n" }}{{- end }}
{{- if .Values.ai.processedTagName }}AI_PROCESSED_TAG_NAME={{ .Values.ai.processedTagName }}{{ "\n" }}{{- end }}
{{- if .Values.prompt.useTags }}USE_PROMPT_TAGS={{ .Values.prompt.useTags }}{{ "\n" }}{{- end }}
{{- if .Values.prompt.tags }}PROMPT_TAGS={{ .Values.prompt.tags }}{{ "\n" }}{{- end }}
{{- if .Values.scanInterval }}SCAN_INTERVAL={{ .Values.scanInterval }}{{ "\n" }}{{- end }}
{{- if .Values.systemPrompt }}SYSTEM_PROMPT=`{{ .Values.systemPrompt }}`{{ "\n" }}{{- end }}
{{- if .Values.processPredefinedDocuments }}PROCESS_PREDEFINED_DOCUMENTS={{ .Values.processPredefinedDocuments }}{{ "\n" }}{{- end }}
TAGS={{ .Values.tags }}{{ "\n" }}
{{- if .Values.openAi.model }}OPENAI_MODEL={{ .Values.openAi.model }}{{ "\n" }}{{- end }}
{{- end }}

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "paperless-ai.fullname" . }}-config-file
labels:
{{- include "paperless-ai.labels" . | nindent 4 }}
data:
config.js: |
{{- (.Files.Get "files/config.js") | nindent 4 }}

View File

@ -0,0 +1,22 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "paperless-ai.fullname" . }}-config
labels:
{{- include "paperless-ai.labels" . | nindent 4 }}
data:
{{- if .Values.paperless.apiUrl }}
PAPERLESS_API_URL: "{{ .Values.paperless.apiUrl }}"
{{- end }}
{{- if .Values.aiProvider }}
AI_PROVIDER: "{{ .Values.aiProvider }}"
{{- end }}
{{- if .Values.ollama.apiUrl }}
OLLAMA_API_URL: "{{ .Values.ollama.apiUrl }}"
{{- end }}
{{- if .Values.ollama.model }}
OLLAMA_MODEL: "{{ .Values.ollama.model }}"
{{- end }}
{{- if .Values.scanInterval }}
SCAN_INTERVAL: "{{ .Values.scanInterval }}"
{{- end }}

View File

@ -0,0 +1,15 @@
{{- if .Values.persistence.data.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "paperless-ai.fullname" . }}-pvc-data
labels:
{{- include "paperless-ai.labels" . | nindent 4 }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.persistence.data.size }}
storageClassName: {{ .Values.persistence.data.storageClass }}
{{- end }}

View File

@ -0,0 +1,99 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "paperless-ai.fullname" . }}
labels:
{{- include "paperless-ai.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "paperless-ai.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "paperless-ai.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
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.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.envs }}
envs:
{{- toYaml . | nindent 12 }}
{{- end }}
envFrom:
# - configMapRef:
# name: {{ include "paperless-ai.fullname" . }}-config
{{- if .Values.openAi.apiKey }}
- secretRef:
name: {{ include "paperless-ai.fullname" . }}-open-ai-api
{{- end }}
{{- if .Values.paperless.apiToken }}
- secretRef:
name: {{ include "paperless-ai.fullname" . }}-paperless-api
{{- end }}
{{- if or .Values.persistence.config.enabled .Values.persistence.data.enabled }}
volumeMounts:
- name: {{ include "paperless-ai.fullname" . }}-volume-config
mountPath: {{ .Values.persistence.config.mountPath }}
subPath: {{ .Values.persistence.config.subPath }}
- name: {{ include "paperless-ai.fullname" . }}-volume-envfile
mountPath: {{ .Values.persistence.envfile.mountPath }}
subPath: {{ .Values.persistence.envfile.subPath }}
{{- if .Values.persistence.data.enabled }}
- name: {{ include "paperless-ai.fullname" . }}-volume-data
mountPath: {{ .Values.persistence.data.mountPath }}
{{- end }}
{{- end }}
{{- if or .Values.persistence.config.enabled .Values.persistence.data.enabled }}
volumes:
- name: {{ include "paperless-ai.fullname" . }}-volume-config
configMap:
name: {{ include "paperless-ai.fullname" . }}-config-file
- name: {{ include "paperless-ai.fullname" . }}-volume-envfile
secret:
secretName: {{ include "paperless-ai.fullname" . }}-env-file
{{- if .Values.persistence.data.enabled }}
- name: {{ include "paperless-ai.fullname" . }}-volume-data
persistentVolumeClaim:
claimName: {{ include "paperless-ai.fullname" . }}-pvc-data
{{- end }}
{{- 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 }}

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: {{ include "paperless-ai.fullname" . }}-env-file
labels:
{{- include "paperless-ai.labels" . | nindent 4 }}
data:
.env: {{ include "generateEnv" . | b64enc }}

View File

@ -0,0 +1,43 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "paperless-ai.fullname" . }}
labels:
{{- include "paperless-ai.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with .Values.ingress.className }}
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 }}
{{- with .pathType }}
pathType: {{ . }}
{{- end }}
backend:
service:
name: {{ include "paperless-ai.fullname" $ }}
port:
number: {{ $.Values.service.port }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,11 @@
{{- if .Values.openAi.apiKey }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "paperless-ai.fullname" . }}-open-ai-api
labels:
{{- include "paperless-ai.labels" . | nindent 4 }}
type: Opaque
data:
OPENAI_API_KEY: {{ .Values.openAi.apiKey | b64enc | quote }}
{{- end }}

View File

@ -0,0 +1,11 @@
{{- if .Values.paperless.apiToken }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "paperless-ai.fullname" . }}-paperless-api
labels:
{{- include "paperless-ai.labels" . | nindent 4 }}
type: Opaque
data:
PAPERLESS_API_TOKEN: {{ .Values.paperless.apiToken | b64enc | quote }}
{{- end }}

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "paperless-ai.fullname" . }}
labels:
{{- include "paperless-ai.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "paperless-ai.selectorLabels" . | nindent 4 }}

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "paperless-ai.fullname" . }}-test-connection"
labels:
{{- include "paperless-ai.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "paperless-ai.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never