From 625c3025057b011a2e5403d3d5c86a587f844301 Mon Sep 17 00:00:00 2001 From: Dmitri Fedotov Date: Thu, 13 Apr 2023 12:19:01 +0300 Subject: [PATCH] change pv recycler scrub cmd to find -delete PVs with large amount of files cannot be recycted with "rm" command and are left in "Failed" state. Hence we are switching to "find -delete" command. --- cluster/gce/gci/configure-helper.sh | 2 +- pkg/volume/plugins.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index 3b172a98138..033f144f0a1 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -3115,7 +3115,7 @@ spec: - /bin/sh args: - -c - - test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/* && test -z $(ls -A /scrub) || exit 1 + - test -e /scrub && find /scrub -mindepth 1 -delete && test -z $(ls -A /scrub) || exit 1 volumeMounts: - name: vol mountPath: /scrub diff --git a/pkg/volume/plugins.go b/pkg/volume/plugins.go index e56d410a505..cc01fc4c362 100644 --- a/pkg/volume/plugins.go +++ b/pkg/volume/plugins.go @@ -1065,7 +1065,7 @@ func NewPersistentVolumeRecyclerPodTemplate() *v1.Pod { Name: "pv-recycler", Image: "registry.k8s.io/debian-base:v2.0.0", Command: []string{"/bin/sh"}, - Args: []string{"-c", "test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/* && test -z \"$(ls -A /scrub)\" || exit 1"}, + Args: []string{"-c", "test -e /scrub && find /scrub -mindepth 1 -delete && test -z \"$(ls -A /scrub)\" || exit 1"}, VolumeMounts: []v1.VolumeMount{ { Name: "vol",