File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ func SkipUntilResolution(t *testing.T, knownIssueNumber int) {
189189 t .Skipf ("Skip until we understand why it is failing, see https://github.com/elastic/cloud-on-k8s/issues/%d" , knownIssueNumber )
190190}
191191
192- // This simulates "kubectl delete elastic" in the e2e namespace.
192+ // deleteTestResources simulates "kubectl delete elastic" in the e2e namespace.
193193func deleteTestResources (ctx context.Context ) error {
194194 cfg , err := config .GetConfig ()
195195 if err != nil {
@@ -214,8 +214,12 @@ func deleteTestResources(ctx context.Context) error {
214214 }
215215 }
216216
217+ // Dynamic client must be built from the configuration, not by reusing the existing REST client using clntset.RESTClient()
218+ dynamicClient , err := dynamic .NewForConfig (cfg )
219+ if err != nil {
220+ return fmt .Errorf ("while creating dynamic client to delete resources: %w" , err )
221+ }
217222 for _ , namespace := range Ctx ().Operator .ManagedNamespaces {
218- dynamicClient := dynamic .New (clntset .RESTClient ())
219223 for gv , resources := range groupVersionToResourceListMap {
220224 gvSlice := strings .Split (gv , "/" )
221225 if len (gvSlice ) != 2 {
You can’t perform that action at this time.
0 commit comments