Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix authconfig annotations reconciliation #359

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions controllers/authpolicy_authconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
return err
}

err = r.ReconcileResource(ctx, &authorinoapi.AuthConfig{}, authConfig, alwaysUpdateAuthConfig)
err = r.ReconcileResource(ctx, &authorinoapi.AuthConfig{}, authConfig, authConfigBasicMutator)
if err != nil && !apierrors.IsAlreadyExists(err) {
logger.Error(err, "ReconcileResource failed to create/update AuthConfig resource")
return err
Expand Down Expand Up @@ -496,7 +496,7 @@
}
}

func alwaysUpdateAuthConfig(existingObj, desiredObj client.Object) (bool, error) {
func authConfigBasicMutator(existingObj, desiredObj client.Object) (bool, error) {
existing, ok := existingObj.(*authorinoapi.AuthConfig)
if !ok {
return false, fmt.Errorf("%T is not an *authorinoapi.AuthConfig", existingObj)
Expand All @@ -506,11 +506,11 @@
return false, fmt.Errorf("%T is not an *authorinoapi.AuthConfig", desiredObj)
}

if reflect.DeepEqual(existing.Spec, desired.Spec) && reflect.DeepEqual(existing.Annotations, desired.Annotations) {
if reflect.DeepEqual(existing.Spec, desired.Spec) {
return false, nil
}

existing.Spec = desired.Spec
existing.Annotations = desired.Annotations

Check warning on line 514 in controllers/authpolicy_authconfig.go

View check run for this annotation

Codecov / codecov/patch

controllers/authpolicy_authconfig.go#L514

Added line #L514 was not covered by tests
return true, nil
}
Loading