diff --git a/internal/provider/kubernetes/status.go b/internal/provider/kubernetes/status.go index c13b645ac07c..ad9980395bd8 100644 --- a/internal/provider/kubernetes/status.go +++ b/internal/provider/kubernetes/status.go @@ -583,22 +583,23 @@ func (r *gatewayAPIReconciler) updateStatusForGatewayClass( NamespacedName: types.NamespacedName{Name: gc.Name}, Resource: &gwapiv1.GatewayClass{}, Mutator: MutatorFunc(func(obj client.Object) bool { - gcs, ok := obj.(*gwapiv1.GatewayClass) + gc, ok := obj.(*gwapiv1.GatewayClass) if !ok { panic(fmt.Sprintf("unsupported object type %T", obj)) } - // if isStatusEqual(gcs.Status.Conditions, gc.Status.Conditions) { - // return true - // } + gcp := status.SetGatewayClassAccepted(gc.DeepCopy(), accepted, reason, msg) + if isStatusEqual(gcp.Status, gc.Status) { + return true + } - gcs.Status.Conditions = status.SetGatewayClassAccepted(gc, accepted, reason, msg).Status.Conditions + gc.Status = gcp.Status return false }), }) } else { // this branch makes testing easier by not going through the status.Updater. - duplicate := status.SetGatewayClassAccepted(gc, accepted, reason, msg) + duplicate := status.SetGatewayClassAccepted(gc.DeepCopy(), accepted, reason, msg) if err := r.client.Status().Update(ctx, duplicate); err != nil && !kerrors.IsNotFound(err) { return fmt.Errorf("error updating status of gatewayclass %s: %w", duplicate.Name, err)