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

Implement NKG-specific field validation for Gateways #407

Merged
merged 9 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
60 changes: 36 additions & 24 deletions internal/state/change_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,18 @@ var _ = Describe("ChangeProcessor", func() {
ObservedGeneration: gw1.Generation,
ListenerStatuses: map[string]state.ListenerStatus{
"listener-80-1": {
Valid: false,
AttachedRoutes: 1,
Conditions: append(
conditions.NewDefaultListenerConditions(),
conditions.NewTODO("GatewayClass is invalid or doesn't exist"),
),
},
"listener-443-1": {
Valid: false,
AttachedRoutes: 1,
Conditions: append(
conditions.NewDefaultListenerConditions(),
conditions.NewTODO("GatewayClass is invalid or doesn't exist"),
),
},
},
},
Expand All @@ -303,13 +309,13 @@ var _ = Describe("ChangeProcessor", func() {
"listener-80-1": {
Conditions: append(
conditions.NewDefaultRouteConditions(),
conditions.NewRouteTODO("GatewayClass is invalid or doesn't exist"),
conditions.NewTODO("GatewayClass is invalid or doesn't exist"),
),
},
"listener-443-1": {
Conditions: append(
conditions.NewDefaultRouteConditions(),
conditions.NewRouteTODO("GatewayClass is invalid or doesn't exist"),
conditions.NewTODO("GatewayClass is invalid or doesn't exist"),
),
},
},
Expand Down Expand Up @@ -391,12 +397,12 @@ var _ = Describe("ChangeProcessor", func() {
ObservedGeneration: gw1.Generation,
ListenerStatuses: map[string]state.ListenerStatus{
"listener-80-1": {
Valid: true,
AttachedRoutes: 1,
Conditions: conditions.NewDefaultListenerConditions(),
},
"listener-443-1": {
Valid: true,
AttachedRoutes: 1,
Conditions: conditions.NewDefaultListenerConditions(),
},
},
},
Expand Down Expand Up @@ -500,12 +506,12 @@ var _ = Describe("ChangeProcessor", func() {
ObservedGeneration: gw1.Generation,
ListenerStatuses: map[string]state.ListenerStatus{
"listener-80-1": {
Valid: true,
AttachedRoutes: 1,
Conditions: conditions.NewDefaultListenerConditions(),
},
"listener-443-1": {
Valid: true,
AttachedRoutes: 1,
Conditions: conditions.NewDefaultListenerConditions(),
},
},
},
Expand Down Expand Up @@ -610,12 +616,12 @@ var _ = Describe("ChangeProcessor", func() {
ObservedGeneration: gw1Updated.Generation,
ListenerStatuses: map[string]state.ListenerStatus{
"listener-80-1": {
Valid: true,
AttachedRoutes: 1,
Conditions: conditions.NewDefaultListenerConditions(),
},
"listener-443-1": {
Valid: true,
AttachedRoutes: 1,
Conditions: conditions.NewDefaultListenerConditions(),
},
},
},
Expand Down Expand Up @@ -719,12 +725,12 @@ var _ = Describe("ChangeProcessor", func() {
ObservedGeneration: gw1Updated.Generation,
ListenerStatuses: map[string]state.ListenerStatus{
"listener-80-1": {
Valid: true,
AttachedRoutes: 1,
Conditions: conditions.NewDefaultListenerConditions(),
},
"listener-443-1": {
Valid: true,
AttachedRoutes: 1,
Conditions: conditions.NewDefaultListenerConditions(),
},
},
},
Expand Down Expand Up @@ -827,12 +833,12 @@ var _ = Describe("ChangeProcessor", func() {
ObservedGeneration: gw1Updated.Generation,
ListenerStatuses: map[string]state.ListenerStatus{
"listener-80-1": {
Valid: true,
AttachedRoutes: 1,
Conditions: conditions.NewDefaultListenerConditions(),
},
"listener-443-1": {
Valid: true,
AttachedRoutes: 1,
Conditions: conditions.NewDefaultListenerConditions(),
},
},
},
Expand Down Expand Up @@ -928,12 +934,12 @@ var _ = Describe("ChangeProcessor", func() {
ObservedGeneration: gw1Updated.Generation,
ListenerStatuses: map[string]state.ListenerStatus{
"listener-80-1": {
Valid: true,
AttachedRoutes: 1,
Conditions: conditions.NewDefaultListenerConditions(),
},
"listener-443-1": {
Valid: true,
AttachedRoutes: 1,
Conditions: conditions.NewDefaultListenerConditions(),
},
},
},
Expand All @@ -960,13 +966,13 @@ var _ = Describe("ChangeProcessor", func() {
"listener-80-1": {
Conditions: append(
conditions.NewDefaultRouteConditions(),
conditions.NewRouteTODO("Gateway is ignored"),
conditions.NewTODO("Gateway is ignored"),
),
},
"listener-443-1": {
Conditions: append(
conditions.NewDefaultRouteConditions(),
conditions.NewRouteTODO("Gateway is ignored"),
conditions.NewTODO("Gateway is ignored"),
),
},
},
Expand Down Expand Up @@ -1049,12 +1055,12 @@ var _ = Describe("ChangeProcessor", func() {
ObservedGeneration: gw2.Generation,
ListenerStatuses: map[string]state.ListenerStatus{
"listener-80-1": {
Valid: true,
AttachedRoutes: 1,
Conditions: conditions.NewDefaultListenerConditions(),
},
"listener-443-1": {
Valid: true,
AttachedRoutes: 1,
Conditions: conditions.NewDefaultListenerConditions(),
},
},
},
Expand Down Expand Up @@ -1113,12 +1119,12 @@ var _ = Describe("ChangeProcessor", func() {
ObservedGeneration: gw2.Generation,
ListenerStatuses: map[string]state.ListenerStatus{
"listener-80-1": {
Valid: true,
AttachedRoutes: 0,
Conditions: conditions.NewDefaultListenerConditions(),
},
"listener-443-1": {
Valid: true,
AttachedRoutes: 0,
Conditions: conditions.NewDefaultListenerConditions(),
},
},
},
Expand Down Expand Up @@ -1146,12 +1152,18 @@ var _ = Describe("ChangeProcessor", func() {
ObservedGeneration: gw2.Generation,
ListenerStatuses: map[string]state.ListenerStatus{
"listener-80-1": {
Valid: false,
AttachedRoutes: 0,
Conditions: append(
conditions.NewDefaultListenerConditions(),
conditions.NewTODO("GatewayClass is invalid or doesn't exist"),
),
},
"listener-443-1": {
Valid: false,
AttachedRoutes: 0,
Conditions: append(
conditions.NewDefaultListenerConditions(),
conditions.NewTODO("GatewayClass is invalid or doesn't exist"),
),
},
},
},
Expand Down
Loading