Skip to content

Commit c4fd90f

Browse files
committed
fix: r
Signed-off-by: Ashing Zheng <[email protected]>
1 parent d7a96ec commit c4fd90f

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

internal/controller/gatewayproxy_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ func (r *GatewayProxyController) Reconcile(ctx context.Context, req ctrl.Request
113113
Namespace: gp.Namespace,
114114
Name: providerService.Name,
115115
}
116+
service := &corev1.Service{}
117+
if err := r.Get(ctx, serviceNN, service); err != nil {
118+
return reconcile.Result{}, err
119+
}
120+
tctx.Services[serviceNN] = service
116121
if err := collectEndpointsWithEndpointSliceSupport(tctx, r.Client, tctx, serviceNN, r.supportsEndpointSlice, nil); err != nil {
117122
return reconcile.Result{}, err
118123
}

test/e2e/crds/v1alpha1/gatewayproxy.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,20 +168,16 @@ spec:
168168

169169
By("scale apisix to replicas 2")
170170
s.Deployer.DeployDataplane(scaffold.DeployDataplaneOptions{
171-
Replicas: ptr.To(2),
171+
Replicas: ptr.To(2),
172+
SkipCreateTunnels: true,
172173
})
173174

174175
By("check pod ready")
175-
err = wait.PollUntilContextTimeout(context.Background(), time.Second, 10*time.Second, true, func(ctx context.Context) (done bool, err error) {
176-
pods := s.GetPods(s.Namespace(), "app.kubernetes.io/name=apisix")
177-
if len(pods) != 2 {
176+
err = wait.PollUntilContextTimeout(context.Background(), time.Second, 60*time.Second, true, func(ctx context.Context) (done bool, err error) {
177+
endpoints := s.GetEndpoints(s.Namespace(), framework.ProviderType)
178+
if len(endpoints.Subsets) != 1 || len(endpoints.Subsets[0].Addresses) != 2 {
178179
return false, nil
179180
}
180-
for _, pod := range pods {
181-
if pod.Status.PodIP == "" {
182-
return false, nil
183-
}
184-
}
185181
return true, nil
186182
})
187183
Expect(err).NotTo(HaveOccurred(), "check pods ready")

test/e2e/framework/k8s.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ func (f *Framework) GetPods(namespace, selector string) []corev1.Pod {
215215
return podList.Items
216216
}
217217

218+
func (f *Framework) GetEndpoints(namespace, name string) *corev1.Endpoints {
219+
endpoints, err := f.clientset.CoreV1().Endpoints(cmp.Or(namespace, _namespace)).Get(f.Context, name, metav1.GetOptions{})
220+
f.GomegaT.Expect(err).ShouldNot(HaveOccurred())
221+
return endpoints
222+
}
223+
218224
func (f *Framework) applySSLSecret(namespace, name string, cert, pkey, caCert []byte) {
219225
kind := "Secret"
220226
apiVersion := "v1"

0 commit comments

Comments
 (0)