Skip to content

Commit ebf0014

Browse files
cpanatounguiculus
authored andcommitted
Add explicit deletion of pv and pvcs (#119)
Signed-off-by: Carlos Panato <[email protected]>
1 parent b33b7c0 commit ebf0014

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/tool/kubectl.go

+11
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ func NewKubectl(exec exec.ProcessExecutor) Kubectl {
2323
// DeleteNamespace deletes the specified namespace. If the namespace does not terminate within 90s, pods running in the
2424
// namespace and, eventually, the namespace itself are force-deleted.
2525
func (k Kubectl) DeleteNamespace(namespace string) {
26+
27+
fmt.Println("Deleting pvcs...")
28+
if err := k.exec.RunProcess("kubectl", "delete", "pvc", "--namespace", namespace, "--all"); err != nil {
29+
fmt.Println("Error deleting pvc(s):", err)
30+
}
31+
32+
fmt.Println("Deleting pvs...")
33+
if err := k.exec.RunProcess("kubectl", "delete", "pv", "--namespace", namespace, "--all"); err != nil {
34+
fmt.Println("Error deleting pv(s):", err)
35+
}
36+
2637
fmt.Printf("Deleting namespace '%s'...\n", namespace)
2738
timeoutSec := "120s"
2839
if err := k.exec.RunProcess("kubectl", "delete", "namespace", namespace, "--timeout", timeoutSec); err != nil {

0 commit comments

Comments
 (0)