diff --git a/controller/controlplane/controller_reconciler_utils.go b/controller/controlplane/controller_reconciler_utils.go index 699b28b3f..e0282014e 100644 --- a/controller/controlplane/controller_reconciler_utils.go +++ b/controller/controlplane/controller_reconciler_utils.go @@ -648,10 +648,11 @@ func (r *Reconciler) ensureOwnedClusterRoleBindingsDeleted( func (r *Reconciler) ensureOwnedValidatingWebhookConfigurationDeleted(ctx context.Context, cp *operatorv1beta1.ControlPlane, ) (deletions bool, err error) { - // TODO: Remove listing with old labels https://github.com/Kong/gateway-operator/issues/401. - validatingWebhookConfigurationsLegacy, err := k8sutils.ListValidatingWebhookConfigurations( + // TODO: Remove listing with old labels and owner ref https://github.com/Kong/gateway-operator/issues/401. + validatingWebhookConfigurationsLegacy, err := k8sutils.ListValidatingWebhookConfigurationsForOwner( ctx, r.Client, + cp.GetUID(), // NOTE: this uses only the 1 label to find the legacy webhook configurations not the label set // because app: is not set on ValidatingWebhookConfiguration. client.MatchingLabels(k8sutils.GetLegacyManagedByLabel(cp)), diff --git a/test/helpers/setup.go b/test/helpers/setup.go index 50bb870ff..78ce0d0c5 100644 --- a/test/helpers/setup.go +++ b/test/helpers/setup.go @@ -33,6 +33,9 @@ func SetupTestEnv(t *testing.T, ctx context.Context, env environments.Environmen t.Log("performing test setup") cleaner := clusters.NewCleaner(env.Cluster()) t.Cleanup(func() { + t.Helper() + + t.Log("performing test cleanup") ctx, cancel := context.WithTimeout(context.Background(), time.Minute*5) defer cancel() assert.NoError(t, cleaner.Cleanup(ctx))