Skip to content

Commit

Permalink
fix: fix listing ValidatingWebhookConfiguration using old labels
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek committed Jul 10, 2024
1 parent c66a580 commit a91bffd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions controller/controlplane/controller_reconciler_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:<name> is not set on ValidatingWebhookConfiguration.
client.MatchingLabels(k8sutils.GetLegacyManagedByLabel(cp)),
Expand Down
3 changes: 3 additions & 0 deletions test/helpers/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit a91bffd

Please sign in to comment.