Add support for Paperless AI API token and environment variables
All checks were successful
Build Helm Chart / helm-package (push) Successful in 3s

This commit introduces several significant changes to the Paperless AI
Helm chart:

- Updated the version from 0.5.0 to 0.6.0 in `Chart.yaml` to reflect
  the new additions.
- Added a new template `paperlessApiSecret.yaml` to define a Kubernetes
  Secret for the Paperless API token. This allows secure storage of the
  API token, which is now a required value for communication with the
  Paperless application.
- Introduced a new function in `_helpers.tpl` called `generateEnv`
  that dynamically generates a `.env` file from various configuration
  values in `values.yaml`. This includes settings for the Paperless API
  URL, AI provider, tagging options, scanning intervals, and more.
- Updated `values.yaml` to include necessary configurations for the
  Paperless API, OpenAI, and other related settings, making it easier
  for users to configure the chart per their requirements.
- Adjusted resource limits and initial probe delays for improved
  performance and quicker health checks.

These enhancements provide better configurability and facilitate
secure management of sensitive credentials, thereby improving user
experience and application reliability.
This commit is contained in:
2025-07-06 19:39:58 +02:00
parent 601bde7463
commit f9df49ddd1
4 changed files with 72 additions and 7 deletions

View File

@ -1,7 +1,7 @@
apiVersion: v2
name: paperless-ai
description: Ein Helm Chart für Paperless AI, basierend auf der Docker Compose Konfiguration.
version: 0.5.0
version: 0.6.0
appVersion: 3.0.7
keywords:
- paperless-ai

View File

@ -64,4 +64,21 @@ Erstellt den Namen des zu verwendenden Service Accounts.
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- 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,11 @@
{{- if .Values.paperless.apiToken }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "paperless-ai.fullname" . }}
labels:
{{- include "paperless-ai.labels" . | nindent 4 }}
type: Opaque
data:
PAPERLESS_API_TOKEN: {{ .Values.paperless.apiToken | b64enc | quote }}
{{- end }}

View File

@ -1,3 +1,40 @@
# paperless-ai config
paperless:
apiUrl: "http://paperless-ngx:8000"
apiToken:
ai:
provider: "openai"
addProcessedTag: yes
processedTagName: ai-processed
prompt:
useTags: yes
tags: Rechnung,Kontoauszug,Vertrag,Arbeitgeber
openAi:
apiKey:
model: "gpt-4o-mini"
ollama:
apiUrl: ""
model: ""
scanInterval: "*/30 * * * *"
systemPrompt: |-
Return the result EXCLUSIVELY as a JSON object. The Tags and Title MUST be in the language that is used in the document.:
{
"title": "xxxxx",
"correspondent": "xxxxxxxx",
"tags": ["Tag1", "Tag2", "Tag3", "Tag4"],
"document_date": "YYYY-MM-DD",
"language": "en/de/es/..."
}
processPredefinedDocuments: "no"
tags: "indexed,indexed2"
replicaCount: 1
image:
@ -28,13 +65,13 @@ persistence:
size: 1Gi
livenessProbe:
initialDelaySeconds: 60
initialDelaySeconds: 30
httpGet:
path: /
# path: /health
port: http
readinessProbe:
initialDelaySeconds: 60
initialDelaySeconds: 30
httpGet:
path: /
# path: /health
@ -63,11 +100,11 @@ autoscaling:
# Ressourcenanforderungen und -limits für den Container.
resources:
limits:
cpu: 100m
memory: 128Mi
cpu: 300m
memory: 640Mi
requests:
cpu: 100m
memory: 128Mi
memory: 256Mi
# Node-Selector für die Pod-Platzierung.
nodeSelector: {}