From badcd3b79f0587c4fc8b147558b289a4eae80fbf Mon Sep 17 00:00:00 2001 From: OpenCode Test Date: Wed, 24 Dec 2025 14:15:50 -0800 Subject: [PATCH] fix: add initContainers to clean lost+found from Longhorn PVCs --- argocd/porthole-application.yaml | 2 +- helm/porthole/templates/minio.yaml.tpl | 22 ++++++++++++++++------ helm/porthole/templates/postgres.yaml.tpl | 22 ++++++++++++++++------ 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/argocd/porthole-application.yaml b/argocd/porthole-application.yaml index 4e5d3d7..9fd0a6a 100644 --- a/argocd/porthole-application.yaml +++ b/argocd/porthole-application.yaml @@ -13,7 +13,7 @@ spec: releaseName: porthole valueFiles: - values.yaml - - ../../argocd/values-porthole.yaml + - values-cluster.yaml destination: server: https://kubernetes.default.svc namespace: porthole diff --git a/helm/porthole/templates/minio.yaml.tpl b/helm/porthole/templates/minio.yaml.tpl index d6a2426..de75829 100644 --- a/helm/porthole/templates/minio.yaml.tpl +++ b/helm/porthole/templates/minio.yaml.tpl @@ -45,12 +45,22 @@ spec: affinity: {{ $aff | indent 8 }} {{- end }} -{{- $tols := include "tline.tolerations" (dict "Values" .Values "schedulingClass" .Values.minio.schedulingClass) }} -{{- if $tols }} - tolerations: -{{ $tols | indent 8 }} -{{- end }} - containers: + {{- $tols := include "tline.tolerations" (dict "Values" .Values "schedulingClass" .Values.minio.schedulingClass) }} + {{- if $tols }} + tolerations: + {{ $tols | indent 8 }} + {{- end }} + initContainers: + - name: cleanup-lost-found + image: busybox:1.36 + command: + - sh + - -c + - rm -rf /data/lost+found || true + volumeMounts: + - name: data + mountPath: /data + containers: - name: minio image: {{ printf "%s:%s" .Values.images.minio.repository .Values.images.minio.tag | quote }} imagePullPolicy: {{ .Values.images.minio.pullPolicy }} diff --git a/helm/porthole/templates/postgres.yaml.tpl b/helm/porthole/templates/postgres.yaml.tpl index 23fcc88..c3160f1 100644 --- a/helm/porthole/templates/postgres.yaml.tpl +++ b/helm/porthole/templates/postgres.yaml.tpl @@ -41,12 +41,22 @@ spec: affinity: {{ $aff | indent 8 }} {{- end }} -{{- $tols := include "tline.tolerations" (dict "Values" .Values "schedulingClass" .Values.postgres.schedulingClass) }} -{{- if $tols }} - tolerations: -{{ $tols | indent 8 }} -{{- end }} - containers: + {{- $tols := include "tline.tolerations" (dict "Values" .Values "schedulingClass" .Values.postgres.schedulingClass) }} + {{- if $tols }} + tolerations: + {{ $tols | indent 8 }} + {{- end }} + initContainers: + - name: cleanup-lost-found + image: busybox:1.36 + command: + - sh + - -c + - rm -rf /var/lib/postgresql/data/lost+found || true + volumeMounts: + - name: data + mountPath: /var/lib/postgresql/data + containers: - name: postgres image: {{ printf "%s:%s" .Values.images.postgres.repository .Values.images.postgres.tag | quote }} imagePullPolicy: {{ .Values.images.postgres.pullPolicy }}