@@ -23,6 +23,7 @@ import (
2323 corev1 "k8s.io/api/core/v1"
2424 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2525 "sigs.k8s.io/e2e-framework/klient"
26+ "sigs.k8s.io/e2e-framework/klient/k8s/resources"
2627 "sigs.k8s.io/e2e-framework/pkg/env"
2728 "sigs.k8s.io/e2e-framework/pkg/envconf"
2829)
@@ -70,10 +71,12 @@ func CreateNamespace(name string, opts ...CreateNamespaceOpts) env.Func {
7071 }
7172}
7273
74+ type DeleteNamespaceOpts func (klient.Client , * corev1.Namespace )
75+
7376// DeleteNamespace provides an Environment.Func that deletes the named
7477// namespace. It first searches for the ns in its context, if not found then
7578// attempt to retrieve it from the API server. Then deletes it.
76- func DeleteNamespace (name string ) env.Func {
79+ func DeleteNamespace (name string , opts ... resources. DeleteOption ) env.Func {
7780 return func (ctx context.Context , cfg * envconf.Config ) (context.Context , error ) {
7881 var namespace * corev1.Namespace
7982
@@ -105,7 +108,7 @@ func DeleteNamespace(name string) env.Func {
105108 }
106109
107110 // remove namespace api object
108- if err := client .Resources ().Delete (ctx , namespace ); err != nil {
111+ if err := client .Resources ().Delete (ctx , namespace , opts ... ); err != nil {
109112 return ctx , fmt .Errorf ("delete namespace func: %w" , err )
110113 }
111114
0 commit comments