Skip to content

Commit e4e3c1e

Browse files
committed
Revert "fix: gateway router should wait for accepted condition"
This reverts commit bb7ad65.
1 parent bf87c49 commit e4e3c1e

File tree

3 files changed

+1
-125
lines changed

3 files changed

+1
-125
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ require (
2929
k8s.io/client-go v0.34.1
3030
k8s.io/code-generator v0.34.1
3131
k8s.io/klog/v2 v2.130.1
32-
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
3332
knative.dev/serving v0.46.6
3433
)
3534

@@ -100,6 +99,7 @@ require (
10099
gopkg.in/yaml.v3 v3.0.1 // indirect
101100
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
102101
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
102+
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
103103
knative.dev/networking v0.0.0-20250902160145-7dad473f6351 // indirect
104104
knative.dev/pkg v0.0.0-20250909011231-077dcf0d00e8 // indirect
105105
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect

pkg/router/gateway_api.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -275,26 +275,6 @@ func (gwr *GatewayAPIRouter) GetRoutes(canary *flaggerv1.Canary) (
275275
err = fmt.Errorf("HTTPRoute %s.%s get error: %w", routeName, hrNamespace, err)
276276
return
277277
}
278-
279-
currentGeneration := httpRoute.GetGeneration()
280-
for _, parentRef := range httpRoute.Spec.CommonRouteSpec.ParentRefs {
281-
for _, parentStatus := range httpRoute.Status.Parents {
282-
if !reflect.DeepEqual(parentStatus.ParentRef, parentRef) {
283-
continue
284-
}
285-
286-
for _, condition := range parentStatus.Conditions {
287-
if condition.Type == string(v1.RouteConditionAccepted) && (condition.Status != metav1.ConditionTrue || condition.ObservedGeneration < currentGeneration) {
288-
err = fmt.Errorf(
289-
"HTTPRoute %s.%s parent %s is not ready (status: %s, observed generation: %d, current generation: %d)",
290-
routeName, hrNamespace, parentRef.Name, string(condition.Status), condition.ObservedGeneration, currentGeneration,
291-
)
292-
return 0, 0, false, err
293-
}
294-
}
295-
}
296-
}
297-
298278
var weightedRule *v1.HTTPRouteRule
299279
for _, rule := range httpRoute.Spec.Rules {
300280
// If session affinity is enabled, then we are only interested in the rule

pkg/router/gateway_api_test.go

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"github.com/stretchr/testify/assert"
2929
"github.com/stretchr/testify/require"
3030
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
31-
"k8s.io/utils/ptr"
3231

3332
flaggerv1 "github.com/fluxcd/flagger/pkg/apis/flagger/v1beta1"
3433
v1 "github.com/fluxcd/flagger/pkg/apis/gatewayapi/v1"
@@ -643,106 +642,3 @@ func TestGatewayAPIRouter_makeFilters_CORS(t *testing.T) {
643642
// Assert MaxAge (24h = 86400 seconds)
644643
assert.Equal(t, int32(86400), corsFilter.CORS.MaxAge)
645644
}
646-
647-
func TestGatewayAPIRouter_GetRoutes(t *testing.T) {
648-
canary := newTestGatewayAPICanary()
649-
mocks := newFixture(canary)
650-
router := &GatewayAPIRouter{
651-
gatewayAPIClient: mocks.meshClient,
652-
kubeClient: mocks.kubeClient,
653-
logger: mocks.logger,
654-
}
655-
656-
httpRoute := &v1.HTTPRoute{
657-
ObjectMeta: metav1.ObjectMeta{
658-
Name: "podinfo",
659-
Generation: 1,
660-
},
661-
Spec: v1.HTTPRouteSpec{
662-
Rules: []v1.HTTPRouteRule{
663-
{
664-
BackendRefs: []v1.HTTPBackendRef{
665-
{
666-
BackendRef: v1.BackendRef{
667-
BackendObjectReference: v1.BackendObjectReference{
668-
Name: "podinfo-canary",
669-
},
670-
Weight: ptr.To(int32(10)),
671-
},
672-
},
673-
{
674-
BackendRef: v1.BackendRef{
675-
BackendObjectReference: v1.BackendObjectReference{
676-
Name: "podinfo-primary",
677-
},
678-
Weight: ptr.To(int32(90)),
679-
},
680-
},
681-
},
682-
},
683-
},
684-
CommonRouteSpec: v1.CommonRouteSpec{
685-
ParentRefs: []v1.ParentReference{
686-
{
687-
Name: "podinfo",
688-
},
689-
},
690-
},
691-
},
692-
}
693-
httpRoute, err := router.gatewayAPIClient.GatewayapiV1().HTTPRoutes("default").Create(context.TODO(), httpRoute, metav1.CreateOptions{})
694-
require.NoError(t, err)
695-
696-
t.Run("httproute generation", func(t *testing.T) {
697-
httpRoute.ObjectMeta.Generation = 5
698-
httpRoute.Status.Parents = []v1.RouteParentStatus{
699-
{
700-
ParentRef: v1.ParentReference{
701-
Name: "podinfo",
702-
SectionName: ptr.To(v1.SectionName("https")),
703-
},
704-
Conditions: []metav1.Condition{
705-
{
706-
Type: string(v1.RouteConditionAccepted),
707-
Status: metav1.ConditionTrue,
708-
ObservedGeneration: 1,
709-
},
710-
},
711-
},
712-
{
713-
ParentRef: v1.ParentReference{
714-
Name: "podinfo",
715-
},
716-
Conditions: []metav1.Condition{
717-
{
718-
Type: string(v1.RouteConditionAccepted),
719-
Status: metav1.ConditionFalse,
720-
ObservedGeneration: 4,
721-
},
722-
},
723-
},
724-
}
725-
httpRoute, err := router.gatewayAPIClient.GatewayapiV1().HTTPRoutes("default").Update(context.TODO(), httpRoute, metav1.UpdateOptions{})
726-
require.NoError(t, err)
727-
728-
_, _, _, err = router.GetRoutes(canary)
729-
require.Error(t, err)
730-
731-
httpRoute.Status.Parents[1].Conditions[0].ObservedGeneration = 5
732-
_, err = router.gatewayAPIClient.GatewayapiV1().HTTPRoutes("default").Update(context.TODO(), httpRoute, metav1.UpdateOptions{})
733-
require.NoError(t, err)
734-
735-
_, _, _, err = router.GetRoutes(canary)
736-
require.Error(t, err)
737-
738-
httpRoute.Status.Parents[1].Conditions[0].Status = metav1.ConditionTrue
739-
_, err = router.gatewayAPIClient.GatewayapiV1().HTTPRoutes("default").Update(context.TODO(), httpRoute, metav1.UpdateOptions{})
740-
require.NoError(t, err)
741-
742-
primaryWeight, canaryWeight, mirrored, err := router.GetRoutes(canary)
743-
require.NoError(t, err)
744-
assert.Equal(t, 90, primaryWeight)
745-
assert.Equal(t, 10, canaryWeight)
746-
assert.False(t, mirrored)
747-
})
748-
}

0 commit comments

Comments
 (0)