From 08bd4e30f635f6d9ec1c024fbd7581f7d622c297 Mon Sep 17 00:00:00 2001 From: childsb Date: Tue, 2 Feb 2016 11:02:09 -0600 Subject: [PATCH 1/2] Fix for the recycler template. Use rm to scrub volume, include . prefixed items but explude "." and ".." --- pkg/volume/plugins.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/volume/plugins.go b/pkg/volume/plugins.go index 94fb8d5d72c..99dfa056ed2 100644 --- a/pkg/volume/plugins.go +++ b/pkg/volume/plugins.go @@ -416,7 +416,7 @@ func NewPersistentVolumeRecyclerPodTemplate() *api.Pod { Name: "pv-recycler", Image: "gcr.io/google_containers/busybox", Command: []string{"/bin/sh"}, - Args: []string{"-c", "test -e /scrub && echo $(date) > /scrub/trash.txt && find /scrub -mindepth 1 -maxdepth 1 -delete && test -z \"$(ls -A /scrub)\" || exit 1"}, + Args: []string{"-c", "test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/* ; echo $(date) > /scrub/trash.txt && exit 0 "}, VolumeMounts: []api.VolumeMount{ { Name: "vol", From df68b6c38fcf53af0e033622a36a1d9c56e05d24 Mon Sep 17 00:00:00 2001 From: childsb Date: Wed, 10 Feb 2016 14:48:39 -0600 Subject: [PATCH 2/2] Updated recycler template with exit code on failure. --- pkg/volume/plugins.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/volume/plugins.go b/pkg/volume/plugins.go index 8880c154cdd..2e4ef7a3566 100644 --- a/pkg/volume/plugins.go +++ b/pkg/volume/plugins.go @@ -452,7 +452,7 @@ func NewPersistentVolumeRecyclerPodTemplate() *api.Pod { Name: "pv-recycler", Image: "gcr.io/google_containers/busybox", Command: []string{"/bin/sh"}, - Args: []string{"-c", "test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/* ; echo $(date) > /scrub/trash.txt && exit 0 "}, + Args: []string{"-c", "test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/* && test -z \"$(ls -A /scrub)\" || exit 1"}, VolumeMounts: []api.VolumeMount{ { Name: "vol",