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

Wait for active gateway when creating network pod #1183

Merged
merged 1 commit into from
Mar 27, 2023
Merged
Changes from all 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
14 changes: 9 additions & 5 deletions test/e2e/framework/network_pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,16 @@ func (np *NetworkPod) nodeAffinity(scheduling NetworkPodScheduling) *v1.Affinity

switch scheduling {
case GatewayNode:
smGWPodList, err := KubeClients[np.Config.Cluster].CoreV1().Pods(TestContext.SubmarinerNamespace).List(context.TODO(),
metav1.ListOptions{LabelSelector: ActiveGatewayLabel})
smGWPodList := AwaitUntil("await active gateway Pod",
func() (interface{}, error) {
return KubeClients[np.Config.Cluster].CoreV1().Pods(TestContext.SubmarinerNamespace).List(context.TODO(),
metav1.ListOptions{LabelSelector: ActiveGatewayLabel})
},
func(result interface{}) (bool, string, error) {
return len(result.(*v1.PodList).Items) == 1, "", nil
}).(*v1.PodList)

Expect(err).NotTo(HaveOccurred())
Expect(len(smGWPodList.Items)).To(Equal(1))
hostname := smGWPodList.Items[0].GetObjectMeta().GetLabels()["gateway.submariner.io/node"]
hostname := smGWPodList.Items[0].Labels["gateway.submariner.io/node"]
Expect(len(hostname)).NotTo(BeZero())
nodeSelTerms = addNodeSelectorTerm(nodeSelTerms, "kubernetes.io/hostname", v1.NodeSelectorOpIn, []string{hostname})

Expand Down