@@ -93,11 +93,12 @@ func (p *GatewayAPIProcessor) Run(dag *DAG, source *KubernetesCache) {
9393 )
9494 defer commit ()
9595
96- var gatewayNotReadyCondition * metav1.Condition
96+ var gatewayNotProgrammedCondition * metav1.Condition
9797
9898 if ! isAddressAssigned (p .source .gateway .Spec .Addresses , p .source .gateway .Status .Addresses ) {
99- gatewayNotReadyCondition = & metav1.Condition {
100- Type : string (gatewayapi_v1beta1 .GatewayConditionReady ),
99+ // TODO(sk) resolve condition type-reason mismatch
100+ gatewayNotProgrammedCondition = & metav1.Condition {
101+ Type : string (gatewayapi_v1beta1 .GatewayConditionProgrammed ),
101102 Status : metav1 .ConditionFalse ,
102103 Reason : string (gatewayapi_v1beta1 .GatewayReasonAddressNotAssigned ),
103104 Message : "None of the addresses in Spec.Addresses have been assigned to the Gateway" ,
@@ -148,7 +149,7 @@ func (p *GatewayAPIProcessor) Run(dag *DAG, source *KubernetesCache) {
148149 routeParentStatusAccessor := routeAccessor .StatusUpdateFor (routeParentRef )
149150
150151 // If the Gateway is invalid, set status on the route and we're done.
151- if gatewayNotReadyCondition != nil {
152+ if gatewayNotProgrammedCondition != nil {
152153 routeParentStatusAccessor .AddCondition (gatewayapi_v1beta1 .RouteConditionAccepted , metav1 .ConditionFalse , status .ReasonInvalidGateway , "Invalid Gateway" )
153154 continue
154155 }
@@ -215,7 +216,7 @@ func (p *GatewayAPIProcessor) Run(dag *DAG, source *KubernetesCache) {
215216 routeParentStatusAccessor := routeAccessor .StatusUpdateFor (routeParentRef )
216217
217218 // If the Gateway is invalid, set status on the route and we're done.
218- if gatewayNotReadyCondition != nil {
219+ if gatewayNotProgrammedCondition != nil {
219220 routeParentStatusAccessor .AddCondition (gatewayapi_v1beta1 .RouteConditionAccepted , metav1 .ConditionFalse , status .ReasonInvalidGateway , "Invalid Gateway" )
220221 return
221222 }
@@ -266,7 +267,7 @@ func (p *GatewayAPIProcessor) Run(dag *DAG, source *KubernetesCache) {
266267 gwAccessor .SetListenerAttachedRoutes (listenerName , attachedRoutes )
267268 }
268269
269- p .computeGatewayConditions (gwAccessor , gatewayNotReadyCondition )
270+ p .computeGatewayConditions (gwAccessor , gatewayNotProgrammedCondition )
270271}
271272
272273func (p * GatewayAPIProcessor ) getListenersForRouteParentRef (
@@ -385,38 +386,38 @@ func (p *GatewayAPIProcessor) computeListener(
385386 gwAccessor * status.GatewayStatusUpdate ,
386387 validateListenersResult gatewayapi.ValidateListenersResult ,
387388) (bool , * listenerInfo ) {
388- // set the listener's "Ready " condition based on whether we've
389+ // set the listener's "Programmed " condition based on whether we've
389390 // added any other conditions for the listener. The assumption
390391 // here is that if another condition is set, the listener is
391- // invalid/not ready .
392+ // invalid/not programmed .
392393 defer func () {
393394 listenerStatus := gwAccessor .ListenerStatus [string (listener .Name )]
394395
395396 if listenerStatus == nil || len (listenerStatus .Conditions ) == 0 {
396397 gwAccessor .AddListenerCondition (
397398 string (listener .Name ),
398- gatewayapi_v1beta1 .ListenerConditionReady ,
399+ gatewayapi_v1beta1 .ListenerConditionProgrammed ,
399400 metav1 .ConditionTrue ,
400- gatewayapi_v1beta1 .ListenerReasonReady ,
401+ gatewayapi_v1beta1 .ListenerReasonProgrammed ,
401402 "Valid listener" ,
402403 )
403404 } else {
404- readyConditionExists := false
405+ programmedConditionExists := false
405406 for _ , cond := range listenerStatus .Conditions {
406- if cond .Type == string (gatewayapi_v1beta1 .ListenerConditionReady ) {
407- readyConditionExists = true
407+ if cond .Type == string (gatewayapi_v1beta1 .ListenerConditionProgrammed ) {
408+ programmedConditionExists = true
408409 break
409410 }
410411 }
411412
412- // Only set the Ready condition if it doesn't already
413+ // Only set the Programmed condition if it doesn't already
413414 // exist in the status update, since if it does exist,
414415 // it will contain more specific information about what
415416 // was invalid.
416- if ! readyConditionExists {
417+ if ! programmedConditionExists {
417418 gwAccessor .AddListenerCondition (
418419 string (listener .Name ),
419- gatewayapi_v1beta1 .ListenerConditionReady ,
420+ gatewayapi_v1beta1 .ListenerConditionProgrammed ,
420421 metav1 .ConditionFalse ,
421422 gatewayapi_v1beta1 .ListenerReasonInvalid ,
422423 "Invalid listener, see other listener conditions for details" ,
@@ -443,7 +444,7 @@ func (p *GatewayAPIProcessor) computeListener(
443444 if listener .AllowedRoutes .Namespaces .Selector == nil {
444445 gwAccessor .AddListenerCondition (
445446 string (listener .Name ),
446- gatewayapi_v1beta1 .ListenerConditionReady ,
447+ gatewayapi_v1beta1 .ListenerConditionProgrammed ,
447448 metav1 .ConditionFalse ,
448449 gatewayapi_v1beta1 .ListenerReasonInvalid ,
449450 "Listener.AllowedRoutes.Namespaces.Selector is required when Listener.AllowedRoutes.Namespaces.From is set to \" Selector\" ." ,
@@ -454,7 +455,7 @@ func (p *GatewayAPIProcessor) computeListener(
454455 if len (listener .AllowedRoutes .Namespaces .Selector .MatchExpressions )+ len (listener .AllowedRoutes .Namespaces .Selector .MatchLabels ) == 0 {
455456 gwAccessor .AddListenerCondition (
456457 string (listener .Name ),
457- gatewayapi_v1beta1 .ListenerConditionReady ,
458+ gatewayapi_v1beta1 .ListenerConditionProgrammed ,
458459 metav1 .ConditionFalse ,
459460 gatewayapi_v1beta1 .ListenerReasonInvalid ,
460461 "Listener.AllowedRoutes.Namespaces.Selector must specify at least one MatchLabel or MatchExpression." ,
@@ -467,7 +468,7 @@ func (p *GatewayAPIProcessor) computeListener(
467468 if err != nil {
468469 gwAccessor .AddListenerCondition (
469470 string (listener .Name ),
470- gatewayapi_v1beta1 .ListenerConditionReady ,
471+ gatewayapi_v1beta1 .ListenerConditionProgrammed ,
471472 metav1 .ConditionFalse ,
472473 gatewayapi_v1beta1 .ListenerReasonInvalid ,
473474 fmt .Sprintf ("Error parsing Listener.AllowedRoutes.Namespaces.Selector: %v." , err ),
@@ -488,7 +489,7 @@ func (p *GatewayAPIProcessor) computeListener(
488489 if listener .TLS == nil {
489490 gwAccessor .AddListenerCondition (
490491 string (listener .Name ),
491- gatewayapi_v1beta1 .ListenerConditionReady ,
492+ gatewayapi_v1beta1 .ListenerConditionProgrammed ,
492493 metav1 .ConditionFalse ,
493494 gatewayapi_v1beta1 .ListenerReasonInvalid ,
494495 fmt .Sprintf ("Listener.TLS is required when protocol is %q." , listener .Protocol ),
@@ -499,7 +500,7 @@ func (p *GatewayAPIProcessor) computeListener(
499500 if listener .TLS .Mode != nil && * listener .TLS .Mode != gatewayapi_v1beta1 .TLSModeTerminate {
500501 gwAccessor .AddListenerCondition (
501502 string (listener .Name ),
502- gatewayapi_v1beta1 .ListenerConditionReady ,
503+ gatewayapi_v1beta1 .ListenerConditionProgrammed ,
503504 metav1 .ConditionFalse ,
504505 gatewayapi_v1beta1 .ListenerReasonInvalid ,
505506 fmt .Sprintf ("Listener.TLS.Mode must be %q when protocol is %q." , gatewayapi_v1beta1 .TLSModeTerminate , listener .Protocol ),
@@ -526,7 +527,7 @@ func (p *GatewayAPIProcessor) computeListener(
526527 if listener .TLS == nil {
527528 gwAccessor .AddListenerCondition (
528529 string (listener .Name ),
529- gatewayapi_v1beta1 .ListenerConditionReady ,
530+ gatewayapi_v1beta1 .ListenerConditionProgrammed ,
530531 metav1 .ConditionFalse ,
531532 gatewayapi_v1beta1 .ListenerReasonInvalid ,
532533 fmt .Sprintf ("Listener.TLS is required when protocol is %q." , listener .Protocol ),
@@ -537,7 +538,7 @@ func (p *GatewayAPIProcessor) computeListener(
537538 if listener .TLS .Mode == nil || * listener .TLS .Mode != gatewayapi_v1beta1 .TLSModePassthrough {
538539 gwAccessor .AddListenerCondition (
539540 string (listener .Name ),
540- gatewayapi_v1beta1 .ListenerConditionReady ,
541+ gatewayapi_v1beta1 .ListenerConditionProgrammed ,
541542 metav1 .ConditionFalse ,
542543 gatewayapi_v1beta1 .ListenerReasonInvalid ,
543544 fmt .Sprintf ("Listener.TLS.Mode must be %q when protocol is %q." , gatewayapi_v1beta1 .TLSModePassthrough , listener .Protocol ),
@@ -548,7 +549,7 @@ func (p *GatewayAPIProcessor) computeListener(
548549 if len (listener .TLS .CertificateRefs ) != 0 {
549550 gwAccessor .AddListenerCondition (
550551 string (listener .Name ),
551- gatewayapi_v1beta1 .ListenerConditionReady ,
552+ gatewayapi_v1beta1 .ListenerConditionProgrammed ,
552553 metav1 .ConditionFalse ,
553554 gatewayapi_v1beta1 .ListenerReasonInvalid ,
554555 fmt .Sprintf ("Listener.TLS.CertificateRefs cannot be defined when Listener.TLS.Mode is %q." , gatewayapi_v1alpha2 .TLSModePassthrough ),
@@ -630,7 +631,7 @@ func (p *GatewayAPIProcessor) resolveListenerSecret(certificateRefs []gatewayapi
630631 if len (certificateRefs ) != 1 {
631632 gwAccessor .AddListenerCondition (
632633 listenerName ,
633- gatewayapi_v1beta1 .ListenerConditionReady ,
634+ gatewayapi_v1beta1 .ListenerConditionProgrammed ,
634635 metav1 .ConditionFalse ,
635636 gatewayapi_v1beta1 .ListenerReasonInvalid ,
636637 "Listener.TLS.CertificateRefs must contain exactly one entry" ,
@@ -871,7 +872,7 @@ func (p *GatewayAPIProcessor) namespaceMatches(namespaces *gatewayapi_v1beta1.Ro
871872 return true
872873}
873874
874- func (p * GatewayAPIProcessor ) computeGatewayConditions (gwAccessor * status.GatewayStatusUpdate , gatewayNotReadyCondition * metav1.Condition ) {
875+ func (p * GatewayAPIProcessor ) computeGatewayConditions (gwAccessor * status.GatewayStatusUpdate , gatewayNotProgrammedCondition * metav1.Condition ) {
875876 // If Contour's running, the Gateway is considered accepted.
876877 gwAccessor .AddCondition (
877878 gatewayapi_v1beta1 .GatewayConditionAccepted ,
@@ -881,39 +882,40 @@ func (p *GatewayAPIProcessor) computeGatewayConditions(gwAccessor *status.Gatewa
881882 )
882883
883884 switch {
884- case gatewayNotReadyCondition != nil :
885+ case gatewayNotProgrammedCondition != nil :
885886 gwAccessor .AddCondition (
886- gatewayapi_v1beta1 .GatewayConditionType (gatewayNotReadyCondition .Type ),
887- gatewayNotReadyCondition .Status ,
888- gatewayapi_v1beta1 .GatewayConditionReason (gatewayNotReadyCondition .Reason ),
889- gatewayNotReadyCondition .Message ,
887+ gatewayapi_v1beta1 .GatewayConditionType (gatewayNotProgrammedCondition .Type ),
888+ gatewayNotProgrammedCondition .Status ,
889+ gatewayapi_v1beta1 .GatewayConditionReason (gatewayNotProgrammedCondition .Reason ),
890+ gatewayNotProgrammedCondition .Message ,
890891 )
891892 default :
892- // Check for any listeners with a Ready : false condition.
893- allListenersReady := true
893+ // Check for any listeners with a Programmed : false condition.
894+ allListenersProgrammed := true
894895 for _ , ls := range gwAccessor .ListenerStatus {
895896 if ls == nil {
896897 continue
897898 }
898899
899900 for _ , cond := range ls .Conditions {
900- if cond .Type == string (gatewayapi_v1beta1 .ListenerConditionReady ) && cond .Status == metav1 .ConditionFalse {
901- allListenersReady = false
901+ if cond .Type == string (gatewayapi_v1beta1 .ListenerConditionProgrammed ) && cond .Status == metav1 .ConditionFalse {
902+ allListenersProgrammed = false
902903 break
903904 }
904905 }
905906
906- if ! allListenersReady {
907+ if ! allListenersProgrammed {
907908 break
908909 }
909910 }
910911
911- if ! allListenersReady {
912- // If we have invalid listeners, set Ready=false.
913- gwAccessor .AddCondition (gatewayapi_v1beta1 .GatewayConditionReady , metav1 .ConditionFalse , gatewayapi_v1beta1 .GatewayReasonListenersNotValid , "Listeners are not valid" )
912+ if ! allListenersProgrammed {
913+ // If we have invalid listeners, set Programmed=false.
914+ // TODO(sk) resolve condition type-reason mismatch
915+ gwAccessor .AddCondition (gatewayapi_v1beta1 .GatewayConditionProgrammed , metav1 .ConditionFalse , gatewayapi_v1beta1 .GatewayReasonListenersNotValid , "Listeners are not valid" )
914916 } else {
915- // Otherwise, Ready =true.
916- gwAccessor .AddCondition (gatewayapi_v1beta1 .GatewayConditionReady , metav1 .ConditionTrue , gatewayapi_v1beta1 .GatewayReasonReady , status .MessageValidGateway )
917+ // Otherwise, Programmed =true.
918+ gwAccessor .AddCondition (gatewayapi_v1beta1 .GatewayConditionProgrammed , metav1 .ConditionTrue , gatewayapi_v1beta1 .GatewayReasonProgrammed , status .MessageValidGateway )
917919 }
918920 }
919921}
0 commit comments