From 119d2fa171307ed52cd7fb6fd0aca8492dd5d920 Mon Sep 17 00:00:00 2001 From: Tomek Cyran Date: Mon, 6 Oct 2025 16:25:50 +0200 Subject: [PATCH 1/2] Adding support for imagePullSecrets, envFrom, and deployment strategy in Helm chart --- k8s-deploy/lightrag/Chart.yaml | 2 +- k8s-deploy/lightrag/templates/deployment.yaml | 16 +++++++++++ k8s-deploy/lightrag/values.yaml | 28 +++++++++++++++++-- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/k8s-deploy/lightrag/Chart.yaml b/k8s-deploy/lightrag/Chart.yaml index 19d68d9b..8f6af573 100644 --- a/k8s-deploy/lightrag/Chart.yaml +++ b/k8s-deploy/lightrag/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: lightrag description: A Helm chart for LightRAG, an efficient and lightweight RAG system type: application -version: 0.1.0 +version: 0.1.1 appVersion: "1.0.0" maintainers: - name: LightRAG Team diff --git a/k8s-deploy/lightrag/templates/deployment.yaml b/k8s-deploy/lightrag/templates/deployment.yaml index fe63c1ac..e261cf27 100644 --- a/k8s-deploy/lightrag/templates/deployment.yaml +++ b/k8s-deploy/lightrag/templates/deployment.yaml @@ -43,6 +43,19 @@ spec: - name: env-file mountPath: /app/.env subPath: .env + envFrom: + {{- range .Values.envFrom.secrets }} + - secretRef: + name: {{ .name }} + {{- end }} + {{- range .Values.envFrom.configmaps }} + - configMapRef: + name: {{ .name }} + {{- end }} + {{- with .Values.image.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} volumes: - name: env-file secret: @@ -60,3 +73,6 @@ spec: - name: inputs emptyDir: {} {{- end }} + + strategy: + {{- toYaml .Values.updateStrategy | nindent 4 }} \ No newline at end of file diff --git a/k8s-deploy/lightrag/values.yaml b/k8s-deploy/lightrag/values.yaml index fb1bbe31..d8057d1e 100644 --- a/k8s-deploy/lightrag/values.yaml +++ b/k8s-deploy/lightrag/values.yaml @@ -3,6 +3,23 @@ replicaCount: 1 image: repository: ghcr.io/hkuds/lightrag tag: latest + # Optionally specify imagePullSecrets if your image is in a private registry + # example: + # imagePullSecrets: + # - name: my-registry-secret + imagePullSecrets: [] + +# Specify a deployment strategy +# example: +# updateStrategy: +# type: RollingUpdate +# rollingUpdate: +# maxUnavailable: 25% +# maxSurge: 25% +# Default for now should be Recreate as any RollingUpdate will cause issues with +# multiple instances trying to access the same persistent storage if not using RWX volumes. +updateStrategy: + type: Recreate service: type: ClusterIP @@ -23,6 +40,13 @@ persistence: inputs: size: 5Gi +# Allow specifying additional environment variables from ConfigMaps or Secrets created outside of this chart +envFrom: + configmaps: [] + # - name: my-shiny-configmap-1 + secrets: [] + # - name: my-shiny-secret-1 + env: HOST: 0.0.0.0 PORT: 9621 @@ -38,8 +62,8 @@ env: EMBEDDING_BINDING_API_KEY: LIGHTRAG_KV_STORAGE: PGKVStorage LIGHTRAG_VECTOR_STORAGE: PGVectorStorage -# LIGHTRAG_KV_STORAGE: RedisKVStorage -# LIGHTRAG_VECTOR_STORAGE: QdrantVectorDBStorage + # LIGHTRAG_KV_STORAGE: RedisKVStorage + # LIGHTRAG_VECTOR_STORAGE: QdrantVectorDBStorage LIGHTRAG_GRAPH_STORAGE: Neo4JStorage LIGHTRAG_DOC_STATUS_STORAGE: PGDocStatusStorage # Replace with your POSTGRES credentials From 648d7bb175cebfeed4c636922fdee43df37bd483 Mon Sep 17 00:00:00 2001 From: yangdx Date: Fri, 10 Oct 2025 15:31:35 +0800 Subject: [PATCH 2/2] Refactor Helm template to handle optional envFrom values safely MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Add null checks for envFrom fields • Support both secrets and configmaps • Build envFrom list dynamically • Only render envFrom when entries exist • Fix template indentation issues --- k8s-deploy/lightrag/templates/deployment.yaml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/k8s-deploy/lightrag/templates/deployment.yaml b/k8s-deploy/lightrag/templates/deployment.yaml index e261cf27..d8dcfc34 100644 --- a/k8s-deploy/lightrag/templates/deployment.yaml +++ b/k8s-deploy/lightrag/templates/deployment.yaml @@ -43,14 +43,17 @@ spec: - name: env-file mountPath: /app/.env subPath: .env - envFrom: - {{- range .Values.envFrom.secrets }} - - secretRef: - name: {{ .name }} + {{- $envFrom := default (dict) .Values.envFrom }} + {{- $envFromEntries := list }} + {{- range (default (list) (index $envFrom "secrets")) }} + {{- $envFromEntries = append $envFromEntries (dict "secretRef" (dict "name" .name)) }} {{- end }} - {{- range .Values.envFrom.configmaps }} - - configMapRef: - name: {{ .name }} + {{- range (default (list) (index $envFrom "configmaps")) }} + {{- $envFromEntries = append $envFromEntries (dict "configMapRef" (dict "name" .name)) }} + {{- end }} + {{- if gt (len $envFromEntries) 0 }} + envFrom: +{{- toYaml $envFromEntries | nindent 12 }} {{- end }} {{- with .Values.image.imagePullSecrets }} imagePullSecrets: @@ -75,4 +78,4 @@ spec: {{- end }} strategy: - {{- toYaml .Values.updateStrategy | nindent 4 }} \ No newline at end of file + {{- toYaml .Values.updateStrategy | nindent 4 }}