66 appsv1 "k8s.io/api/apps/v1"
77 corev1 "k8s.io/api/core/v1"
88 apierrs "k8s.io/apimachinery/pkg/api/errors"
9+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
910 "k8s.io/apimachinery/pkg/util/wait"
1011 elbv2gw "sigs.k8s.io/aws-load-balancer-controller/apis/gateway/v1beta1"
1112 "sigs.k8s.io/aws-load-balancer-controller/pkg/algorithm"
@@ -15,7 +16,6 @@ import (
1516 "sigs.k8s.io/controller-runtime/pkg/client"
1617 gwv1 "sigs.k8s.io/gateway-api/apis/v1"
1718 "strconv"
18- "time"
1919)
2020
2121func newCommonResourceStack (dp * appsv1.Deployment , svc * corev1.Service , gwc * gwv1.GatewayClass , gw * gwv1.Gateway , lbc * elbv2gw.LoadBalancerConfiguration , baseName string , enablePodReadinessGate bool ) * commonResourceStack {
@@ -76,8 +76,7 @@ func (s *commonResourceStack) Deploy(ctx context.Context, f *framework.Framework
7676 if err := resourceSpecificCreation (ctx , f , s .ns .Name ); err != nil {
7777 return err
7878 }
79- // TODO -- Fix
80- time .Sleep (7 * time .Minute )
79+
8180 if err := s .waitUntilDeploymentReady (ctx , f ); err != nil {
8281 return err
8382 }
@@ -198,9 +197,15 @@ func (s *commonResourceStack) waitUntilGatewayReady(ctx context.Context, f *fram
198197 if err := f .K8sClient .Get (ctx , k8s .NamespacedName (s .gw ), observedGw ); err != nil {
199198 return false , err
200199 }
201- if observedGw .Status .Addresses != nil && len (observedGw .Status .Addresses ) > 0 {
202- return true , nil
200+
201+ if observedGw .Status .Conditions != nil {
202+ for _ , cond := range observedGw .Status .Conditions {
203+ if cond .Type == string (gwv1 .GatewayConditionProgrammed ) && cond .Status == metav1 .ConditionTrue {
204+ return true , nil
205+ }
206+ }
203207 }
208+
204209 return false , nil
205210 }, ctx .Done ())
206211 if err != nil {
0 commit comments