INNER CODE UNIT · Go

cleanupNamespace

vmware-tanzu/sonobuoy · pkg/client/delete.go:122

func cleanupNamespace(namespace string, client kubernetes.Interface, cfg *DeleteConfig) (ConditionFuncWithProgress, error) {
	// Delete the namespace
	log := logrus.WithFields(logrus.Fields{
		"kind":      "namespace",
		"namespace": namespace,
		"dry-run":   cfg.DryRun,
	})

	nsDeletedCondition := func() (string, bool, error) {
		ns, err := client.CoreV1().Namespaces().Get(context.TODO(), namespace, metav1.GetOptions{})
		if kubeerror.IsNotFound(err) {
			return fmt.Sprintf("Namespace %q has been deleted", namespace), true, nil
		}
		if err != nil {
			status := fmt.Sprintf("Error encountered while waiting for namespace deletion %q: %v", ns.Name, err)
			return status, false, err
		}
		if ns != nil {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…