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

fix(e2e): port forward to service instead of pod of kuma-cp to improve test stability (backport of #11737) #11743

Merged
merged 3 commits into from
Oct 10, 2024
Merged
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
17 changes: 7 additions & 10 deletions test/framework/k8s_controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,14 @@ func (c *K8sControlPlane) GetKubectlOptions(namespace ...string) *k8s.KubectlOpt
}

func (c *K8sControlPlane) PortForwardKumaCP() {
kumaCpPods := c.GetKumaCPPods()
// There could be multiple pods still starting so pick one that's available already
for i := range kumaCpPods {
if k8s.IsPodAvailable(&kumaCpPods[i]) {
c.portFwd.apiServerTunnel = k8s.NewTunnel(c.GetKubectlOptions(Config.KumaNamespace), k8s.ResourceTypePod, kumaCpPods[i].Name, 0, 5681)
c.portFwd.apiServerTunnel.ForwardPort(c.t)
c.portFwd.ApiServerEndpoint = c.portFwd.apiServerTunnel.Endpoint()
return
}
kumaCpSvc := c.GetKumaCPSvc()
if k8s.IsServiceAvailable(&kumaCpSvc) {
c.portFwd.apiServerTunnel = k8s.NewTunnel(c.GetKubectlOptions(Config.KumaNamespace), k8s.ResourceTypeService, kumaCpSvc.Name, 0, 5681)
c.portFwd.apiServerTunnel.ForwardPort(c.t)
c.portFwd.ApiServerEndpoint = c.portFwd.apiServerTunnel.Endpoint()
}
c.t.Fatalf("Failed finding an available pod, allPods: %v", kumaCpPods)

c.t.Fatalf("Failed finding an available service, service: %v", kumaCpSvc)
}

func (c *K8sControlPlane) ClosePortForwards() {
Expand Down
Loading