Skip to content

Commit

Permalink
Implement NKG-specific field validation for Gateway resource (#407)
Browse files Browse the repository at this point in the history
Implement NKG-specific field validation for Gateway resource

Fixes #406
  • Loading branch information
pleshakov authored Feb 9, 2023
1 parent eb9fea2 commit e4b6446
Show file tree
Hide file tree
Showing 19 changed files with 957 additions and 571 deletions.
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

0 comments on commit e4b6446

Please sign in to comment.