From 8edec170f2b4f1b6899cef90337f0e5fccb49bac Mon Sep 17 00:00:00 2001 From: Karol Lassak Date: Wed, 28 Jan 2026 18:00:11 +0100 Subject: [PATCH] Simplify daemonset volumes Move them to daemonset file, and remove options that cannot work --- templates/_helpers.tpl | 54 ---------------------------------------- templates/daemonset.yaml | 27 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 54 deletions(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 1434a43..ed34bd5 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -221,11 +221,6 @@ tolerations: {{- toYaml . | nindent 2 }} {{- end }} {{- end }} -{{- $podVolumes := include "kagent.podVolumes" . }} -{{- if $podVolumes }} -volumes: -{{- $podVolumes | nindent 2 }} -{{- end }} {{- end }} {{/* @@ -250,52 +245,3 @@ volumeMounts: subPath: keys {{- end }} {{- end }} - -{{/* -Pod volumes for non-StatefulSet workloads -*/}} -{{- define "kagent.podVolumes" -}} -{{- if ne .Values.deploymentType "statefulset" }} -{{- /* Data volume configuration */ -}} -{{- if .Values.persistence.enabled }} -{{- if eq .Values.persistence.type "hostPath" }} -- name: data - hostPath: - path: {{ .Values.persistence.hostPath.path }} - type: {{ .Values.persistence.hostPath.type | default "DirectoryOrCreate" }} -{{- else if eq .Values.persistence.type "pvc" }} -- name: data - persistentVolumeClaim: - claimName: {{ include "kagent.fullname" . }}-data -{{- else }} -- name: data - emptyDir: {} -{{- end }} -{{- else }} -- name: data - emptyDir: {} -{{- end }} -{{- /* Keypair volume configuration */ -}} -{{- if .Values.persistence.keypair.enabled }} -{{- if eq .Values.persistence.keypair.type "secret" }} -- name: keypair-secret - secret: -{{/* Bind first key from Secret as keys volume*/}} - secretName: {{ include "kagent.fullname" . }}-0-secret - defaultMode: 0400 -{{- else if eq .Values.persistence.keypair.type "hostPath" }} -- name: keys - hostPath: - path: {{ .Values.persistence.keypair.hostPath.path }} - type: {{ .Values.persistence.keypair.hostPath.type | default "DirectoryOrCreate" }} -{{- else if eq .Values.persistence.keypair.type "pvc" }} -- name: keys - persistentVolumeClaim: - claimName: {{ include "kagent.fullname" . }}-keys -{{- else }} -- name: keys - emptyDir: {} -{{- end }} -{{- end }} -{{- end }} -{{- end }} diff --git a/templates/daemonset.yaml b/templates/daemonset.yaml index bb4bdb5..10a5462 100644 --- a/templates/daemonset.yaml +++ b/templates/daemonset.yaml @@ -20,5 +20,32 @@ spec: {{- include "kagent.selectorLabels" . | nindent 8 }} spec: {{- include "kagent.podSpec" . | nindent 6 }} + volumes: + {{- if .Values.persistence.enabled }} + {{- if eq .Values.persistence.type "hostPath" }} + - name: data + hostPath: + path: {{ .Values.persistence.hostPath.path }} + type: {{ .Values.persistence.hostPath.type | default "DirectoryOrCreate" }} + {{- else }} + - name: data + emptyDir: {} + {{- end }} + {{- else }} + - name: data + emptyDir: {} + {{- end }} + {{- /* Keypair volume configuration */ -}} + {{- if .Values.persistence.keypair.enabled }} + {{- if eq .Values.persistence.keypair.type "hostPath" }} + - name: keys + hostPath: + path: {{ .Values.persistence.keypair.hostPath.path }} + type: {{ .Values.persistence.keypair.hostPath.type | default "DirectoryOrCreate" }} + {{- else }} + - name: keys + emptyDir: {} + {{- end }} + {{- end }} {{- end }}