INNER CODE UNIT · Go

isE2ENamespace

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

func isE2ENamespace(ns v1.Namespace) bool {
	// E2E namespaces are identified by looking for the "e2e-framework" and "e2e-run" labels.
	_, hasE2EFrameworkLabel := ns.Labels["e2e-framework"]
	_, hasE2ERunLabel := ns.Labels["e2e-run"]

	return hasE2EFrameworkLabel && hasE2ERunLabel
}

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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…