mirror of
https://github.com/helm/chart-testing.git
synced 2026-02-05 18:45:18 +01:00
Add explicit deletion of pv and pvcs (#119)
Signed-off-by: Carlos Panato <ctadeu@gmail.com>
This commit is contained in:
committed by
Reinhard Nägele
parent
b33b7c0947
commit
ebf0014515
@@ -23,6 +23,17 @@ func NewKubectl(exec exec.ProcessExecutor) Kubectl {
|
||||
// DeleteNamespace deletes the specified namespace. If the namespace does not terminate within 90s, pods running in the
|
||||
// namespace and, eventually, the namespace itself are force-deleted.
|
||||
func (k Kubectl) DeleteNamespace(namespace string) {
|
||||
|
||||
fmt.Println("Deleting pvcs...")
|
||||
if err := k.exec.RunProcess("kubectl", "delete", "pvc", "--namespace", namespace, "--all"); err != nil {
|
||||
fmt.Println("Error deleting pvc(s):", err)
|
||||
}
|
||||
|
||||
fmt.Println("Deleting pvs...")
|
||||
if err := k.exec.RunProcess("kubectl", "delete", "pv", "--namespace", namespace, "--all"); err != nil {
|
||||
fmt.Println("Error deleting pv(s):", err)
|
||||
}
|
||||
|
||||
fmt.Printf("Deleting namespace '%s'...\n", namespace)
|
||||
timeoutSec := "120s"
|
||||
if err := k.exec.RunProcess("kubectl", "delete", "namespace", namespace, "--timeout", timeoutSec); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user