Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: bitliu <bitliu@tencent.com>
  • Loading branch information
Xunzhuo committed Jan 9, 2023
1 parent d8fc059 commit f6a179e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
5 changes: 3 additions & 2 deletions internal/gatewayapi/contexts.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,12 @@ func (r *RouteParentContext) SetCondition(route RouteContext, conditionType v1be
idx := -1
routeStatus := route.GetRouteStatus()
for i, existing := range routeStatus.Parents[r.routeParentStatusIdx].Conditions {
if existing.Type == cond.Type && existing.ObservedGeneration == cond.ObservedGeneration {
if existing.Type == cond.Type {
// return early if the condition is unchanged
if existing.Status == cond.Status &&
existing.Reason == cond.Reason &&
existing.Message == cond.Message {
existing.Message == cond.Message &&
existing.ObservedGeneration == cond.ObservedGeneration {
return
}
idx = i
Expand Down
22 changes: 1 addition & 21 deletions internal/provider/kubernetes/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,14 +495,7 @@ func (r *gatewayAPIReconciler) statusUpdateForGateway(gtw *gwapiv1b1.Gateway, sv
}
gCopy := g.DeepCopy()
gCopy.Status.Conditions = status.MergeConditions(gCopy.Status.Conditions, gtw.Status.Conditions...)
for index := range gCopy.Status.Conditions {
gCopy.Status.Conditions[index].ObservedGeneration = gtw.Generation
}
for listenerIndex, listener := range gCopy.Status.Listeners {
for index := range listener.Conditions {
gCopy.Status.Listeners[listenerIndex].Conditions[index].ObservedGeneration = gtw.Generation
}
}

gCopy.Status.Addresses = gtw.Status.Addresses
return gCopy
}),
Expand Down Expand Up @@ -903,14 +896,6 @@ func (r *gatewayAPIReconciler) subscribeAndUpdateStatus(ctx context.Context) {
gCopy := g.DeepCopy()
gCopy.Status.Listeners = val.Status.Listeners

for index := range gCopy.Status.Conditions {
gCopy.Status.Conditions[index].ObservedGeneration = gCopy.Generation
}
for listenerIndex, listener := range gCopy.Status.Listeners {
for index := range listener.Conditions {
gCopy.Status.Listeners[listenerIndex].Conditions[index].ObservedGeneration = gCopy.Generation
}
}
return gCopy
}),
})
Expand Down Expand Up @@ -940,11 +925,6 @@ func (r *gatewayAPIReconciler) subscribeAndUpdateStatus(ctx context.Context) {
hCopy := h.DeepCopy()
hCopy.Status.Parents = val.Status.Parents

for parentIndex, parent := range hCopy.Status.Parents {
for conditionIndex := range parent.Conditions {
hCopy.Status.Parents[parentIndex].Conditions[conditionIndex].ObservedGeneration = hCopy.Generation
}
}
return hCopy
}),
})
Expand Down

0 comments on commit f6a179e

Please sign in to comment.