func PurgeDeploymentsInNamespace(kubeClient kubernetes.Interface, namespace string) error {
	if isSystemNamespace(namespace) {
		return nil
	}
	if deployments, err := ListDeploymentsInNamespace(kubeClient, namespace); err == nil {
		for _, name := range deployments {
			err := kubeClient.AppsV1beta1().Deployments(namespace).Delete(context.TODO(), name, metav1.DeleteOptions{
				PropagationPolicy: &defaultPropagationPolicy,
			})
			if err != nil {
				return err
			}
		}
	}
	return nil
}
PurgeDeploymentsInNamespace removes all deployments in the given namespace.
package havener
import (
	"context"
	"fmt"
	"github.com/gonvenience/wrap"
	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/watch"
	"k8s.io/client-go/kubernetes"
)
var defaultPropagationPolicy = metav1.DeletePropagationForeground