Skip to content

Commit

Permalink
fix gwc status
Browse files Browse the repository at this point in the history
Signed-off-by: qicz <[email protected]>
  • Loading branch information
qicz committed Oct 25, 2024
1 parent dcbf112 commit cecfc84
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions internal/provider/kubernetes/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cecfc84

Please sign in to comment.