INNER CODE UNIT · Go

cleanupE2E

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

func cleanupE2E(client kubernetes.Interface, cfg *DeleteConfig) (ConditionFuncWithProgress, error) {
	// Delete any dangling E2E namespaces
	// There currently isn't a way to associate namespaces with a particular test run so this
	// will delete namespaces associated with any e2e test run by checking the namespace's labels.
	e2eNamespaceCondition := func() (string, bool, error) {
		namespaces, err := client.CoreV1().Namespaces().List(context.TODO(), metav1.ListOptions{})
		if err != nil {
			return "Error encountered when checking namespaces for deletion.", false, errors.Wrap(err, "failed to list namespaces")
		}
		var names []string
		for _, namespace := range namespaces.Items {
			if isE2ENamespace(namespace) {
				names = append(names, namespace.Name)
			}
		}
		if len(names) > 0 {
			return fmt.Sprintf("Found %v namespaces that still need to be deleted: %v", len(names), names), false, nil
		}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…