// DeleteNamespace deletes the specified namespace. If the namespace does not terminate within 120s, pods running in the
// namespace and, eventually, the namespace itself are force-deleted.
DeleteNamespace deletes the specified namespace. If the namespace does not terminate within 120s, pods running in the
namespace and, eventually, the namespace itself are force-deleted.
// DeleteNamespace deletes the specified namespace . If the namespace does not terminate within 120s pods running in the // namespace and eventually the namespace itself are force - deleted .
func (k Kubectl) DeleteNamespace(namespace string) {
	fmt.Printf("Deleting namespace '%s'...\n", namespace)
	timeoutSec := "180s"
	if err := k.exec.RunProcess("kubectl", "delete", "namespace", namespace, "--timeout", timeoutSec); err != nil {
		fmt.Printf("Namespace '%s' did not terminate after %s.\n", namespace, timeoutSec)
	}
	if k.getNamespace(namespace) {
		fmt.Printf("Namespace '%s' did not terminate after %s.\n", namespace, timeoutSec)
		fmt.Println("Force-deleting everything...")
		if err := k.exec.RunProcess("kubectl", "delete", "all", "--namespace", namespace, "--all", "--force", "--grace-period=0"); err != nil {
			fmt.Printf("Error deleting everything in the namespace %v: %v", namespace, err)
		}
		time.Sleep(5 * time.Second)
		if k.getNamespace(namespace) {
			if err := k.forceNamespaceDeletion(namespace); err != nil {
				fmt.Println("Error force deleting namespace:", err)
			}
		}
	}
}
func ( k Kubectl ) DeleteNamespace ( namespace string ) { fmt . Printf ( " \n " , namespace ) timeoutSec := " " if err := k . exec . RunProcess ( " " , " " , " " , namespace , " " , timeoutSec ) ; err != nil { fmt . Printf ( " \n " , namespace , timeoutSec ) } if k . getNamespace ( namespace ) { fmt . Printf ( " \n " , namespace , timeoutSec ) fmt . Println ( " " ) if err := k . exec . RunProcess ( " " , " " , " " , " " , namespace , " " , " " , " " ) ; err != nil { fmt . Printf ( " " , namespace , err ) } time . Sleep ( 5 * time . Second ) if k . getNamespace ( namespace ) { if err := k . forceNamespaceDeletion ( namespace ) ; err != nil { fmt . Println ( " " , err ) } } } }
DeleteNamespace deletes the specified namespace.
DeleteNamespace deletes the specified namespace .
// Give it some more time to be deleted by K8s