From 8c83a97b8e327e7fca6f37a0bac5f21dbab94b77 Mon Sep 17 00:00:00 2001 From: Taddeus <8607097+taddeusb90@users.noreply.github.com> Date: Wed, 9 Jul 2025 09:58:30 +0300 Subject: [PATCH] Adds support for pod labels, tolerations, affinity, and node selectors (#7) Introduces a template helper for injecting custom pod labels from values. Enables configuring tolerations, affinity, and node selectors in the deployment spec via values to improve scheduling flexibility and control. Enhances pod labeling and scheduling customization without hardcoding, supporting more dynamic deployments. --- k8s-deploy/lightrag/templates/_helpers.tpl | 11 +++++++++++ k8s-deploy/lightrag/templates/deployment.yaml | 13 +++++++++++++ k8s-deploy/lightrag/values.yaml | 10 ++++++++++ 3 files changed, 34 insertions(+) diff --git a/k8s-deploy/lightrag/templates/_helpers.tpl b/k8s-deploy/lightrag/templates/_helpers.tpl index 2b2c23ae..63b8ef7c 100644 --- a/k8s-deploy/lightrag/templates/_helpers.tpl +++ b/k8s-deploy/lightrag/templates/_helpers.tpl @@ -40,3 +40,14 @@ app.kubernetes.io/instance: {{ .Release.Name }} {{ $key }}={{ $val }} {{- end -}} {{- end -}} + +{{/* +Pod-specific labels +*/}} +{{- define "lightrag.apoloPodLabels" -}} +{{- if .Values.podLabels -}} +{{- range $key, $value := .Values.podLabels }} +{{ $key }}: {{ $value }} +{{- end }} +{{- end -}} +{{- end -}} diff --git a/k8s-deploy/lightrag/templates/deployment.yaml b/k8s-deploy/lightrag/templates/deployment.yaml index d804b79c..961c441e 100644 --- a/k8s-deploy/lightrag/templates/deployment.yaml +++ b/k8s-deploy/lightrag/templates/deployment.yaml @@ -15,7 +15,20 @@ spec: checksum/config: {{ include "lightrag.envContent" . | sha256sum }} labels: {{- include "lightrag.selectorLabels" . | nindent 8 }} + {{- include "lightrag.apoloPodLabels" . | nindent 8 }} spec: + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" diff --git a/k8s-deploy/lightrag/values.yaml b/k8s-deploy/lightrag/values.yaml index b982e4b8..b1c74a11 100644 --- a/k8s-deploy/lightrag/values.yaml +++ b/k8s-deploy/lightrag/values.yaml @@ -72,3 +72,13 @@ env: # Replace with your Qdrant credentials QDRANT_URL: http://qdrant-cluster-qdrant-qdrant:6333 # REDIS_URI: redis://default:${REDIS_PASSWORD}@redis-cluster-redis-redis:6379 + + +tolerations: + - key: platform.neuromation.io/job + operator: Exists + effect: NoSchedule + +affinity: {} + +nodeSelector: {} \ No newline at end of file