Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
feat(windows): Adds node selector to pods deployed by tests (#3855)
Browse files Browse the repository at this point in the history
* feat(windows): Adds node selector to pods deployed by tests

Signed-off-by: Sotiris Nanopoulos <[email protected]>
  • Loading branch information
Sotiris Nanopoulos authored Aug 6, 2021
1 parent 2e3f008 commit 73f7407
Show file tree
Hide file tree
Showing 32 changed files with 212 additions and 88 deletions.
10 changes: 7 additions & 3 deletions tests/e2e/e2e_certmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ var _ = OSMDescribe("1 Client pod -> 1 Server pod test using cert-manager",
}

// Get simple pod definitions for the HTTP server
svcAccDef, podDef, svcDef := Td.SimplePodApp(
svcAccDef, podDef, svcDef, err := Td.SimplePodApp(
SimplePodAppDef{
Name: "server",
Namespace: destNs,
Image: "kennethreitz/httpbin",
Ports: []int{80},
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(destNs, &svcAccDef)
_, err = Td.CreateServiceAccount(destNs, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
dstPod, err := Td.CreatePod(destNs, podDef)
Expect(err).NotTo(HaveOccurred())
Expand All @@ -59,14 +61,16 @@ var _ = OSMDescribe("1 Client pod -> 1 Server pod test using cert-manager",
Expect(Td.WaitForPodsRunningReady(destNs, 60*time.Second, 1, nil)).To(Succeed())

// Get simple Pod definitions for the client
svcAccDef, podDef, svcDef = Td.SimplePodApp(SimplePodAppDef{
svcAccDef, podDef, svcDef, err = Td.SimplePodApp(SimplePodAppDef{
Name: "client",
Namespace: sourceNs,
Command: []string{"/bin/bash", "-c", "--"},
Args: []string{"while true; do sleep 30; done;"},
Image: "songrgg/alpine-debug",
Ports: []int{80},
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err = Td.CreateServiceAccount(sourceNs, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/e2e_controller_restart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ func testHTTPTrafficWithControllerRestart() {
}

// Get simple pod definitions for the HTTP server
svcAccDef, podDef, svcDef := Td.SimplePodApp(
svcAccDef, podDef, svcDef, err := Td.SimplePodApp(
SimplePodAppDef{
Name: destName,
Namespace: destName,
Image: "kennethreitz/httpbin",
Ports: []int{80},
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(destName, &svcAccDef)
_, err = Td.CreateServiceAccount(destName, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
_, err = Td.CreatePod(destName, podDef)
Expect(err).NotTo(HaveOccurred())
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/e2e_debug_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ var _ = OSMDescribe("Test Debug Server by toggling enableDebugServer",
Expect(Td.CreateNs(sourceNs, nil)).To(Succeed())

// Get simple Pod definitions for the client
svcAccDef, podDef, svcDef := Td.SimplePodApp(SimplePodAppDef{
svcAccDef, podDef, svcDef, err := Td.SimplePodApp(SimplePodAppDef{
Name: "client",
Namespace: sourceNs,
Command: []string{"/bin/bash", "-c", "--"},
Args: []string{"while true; do sleep 30; done;"},
Image: "songrgg/alpine-debug",
Ports: []int{80},
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(sourceNs, &svcAccDef)
_, err = Td.CreateServiceAccount(sourceNs, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
srcPod, err := Td.CreatePod(sourceNs, podDef)
Expect(err).NotTo(HaveOccurred())
Expand Down
11 changes: 8 additions & 3 deletions tests/e2e/e2e_deployment_client_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,19 @@ var _ = OSMDescribe("Test HTTP traffic from N deployment client -> 1 deployment
}

// Use a deployment with multiple replicaset at serverside
svcAccDef, deploymentDef, svcDef := Td.SimpleDeploymentApp(
svcAccDef, deploymentDef, svcDef, err := Td.SimpleDeploymentApp(
SimpleDeploymentAppDef{
Name: "server",
Namespace: destApp,
ReplicaCount: int32(replicaSetPerService),
Image: "kennethreitz/httpbin",
Ports: []int{DefaultUpstreamServicePort},
Command: HttpbinCmd,
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(destApp, &svcAccDef)
_, err = Td.CreateServiceAccount(destApp, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
_, err = Td.CreateDeployment(destApp, deploymentDef)
Expect(err).NotTo(HaveOccurred())
Expand All @@ -78,7 +80,7 @@ var _ = OSMDescribe("Test HTTP traffic from N deployment client -> 1 deployment

// Create all client deployments, also with replicaset
for _, srcClient := range sourceNamespaces {
svcAccDef, deploymentDef, svcDef = Td.SimpleDeploymentApp(
svcAccDef, deploymentDef, svcDef, err = Td.SimpleDeploymentApp(
SimpleDeploymentAppDef{
Name: srcClient,
Namespace: srcClient,
Expand All @@ -87,7 +89,10 @@ var _ = OSMDescribe("Test HTTP traffic from N deployment client -> 1 deployment
Args: []string{"while true; do sleep 30; done;"},
Image: "songrgg/alpine-debug",
Ports: []int{DefaultUpstreamServicePort}, // Can't deploy services with empty/no ports
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err = Td.CreateServiceAccount(srcClient, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
_, err = Td.CreateDeployment(srcClient, deploymentDef)
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/e2e_egress_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,18 @@ func testEgressPolicy(scenario testScenario) {
Expect(Td.AddNsToMesh(true, sourceNs)).To(Succeed())

// Create simple pod definitions for the source
srcSvcAcc, srcPodDef, _ := Td.SimplePodApp(SimplePodAppDef{
srcSvcAcc, srcPodDef, _, err := Td.SimplePodApp(SimplePodAppDef{
Name: sourceName,
Namespace: sourceNs,
Command: []string{"/bin/bash", "-c", "--"},
Args: []string{"while true; do sleep 30; done;"},
Image: "songrgg/alpine-debug",
Ports: []int{80},
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(sourceNs, &srcSvcAcc)
_, err = Td.CreateServiceAccount(sourceNs, &srcSvcAcc)
Expect(err).NotTo(HaveOccurred())
srcPod, err := Td.CreatePod(sourceNs, srcPodDef)
Expect(err).NotTo(HaveOccurred())
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/e2e_egress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,18 @@ var _ = OSMDescribe("HTTP and HTTPS Egress",
Expect(Td.AddNsToMesh(true, sourceNs)).To(Succeed())

// Get simple Pod definitions for the client
svcAccDef, podDef, svcDef := Td.SimplePodApp(SimplePodAppDef{
svcAccDef, podDef, svcDef, err := Td.SimplePodApp(SimplePodAppDef{
Name: "client",
Namespace: sourceNs,
Command: []string{"/bin/bash", "-c", "--"},
Args: []string{"while true; do sleep 30; done;"},
Image: "songrgg/alpine-debug",
Ports: []int{80},
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(sourceNs, &svcAccDef)
_, err = Td.CreateServiceAccount(sourceNs, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
srcPod, err := Td.CreatePod(sourceNs, podDef)
Expect(err).NotTo(HaveOccurred())
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/e2e_garbage_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var _ = OSMDescribe("Test garbage collection for unused envoy bootstrap config s
Expect(Td.AddNsToMesh(true, userService)).To(Succeed())

// User app
svcAccDef, deploymentDef, svcDef := Td.SimpleDeploymentApp(
svcAccDef, deploymentDef, svcDef, err := Td.SimpleDeploymentApp(
SimpleDeploymentAppDef{
Name: userService,
Namespace: userService,
Expand All @@ -44,9 +44,11 @@ var _ = OSMDescribe("Test garbage collection for unused envoy bootstrap config s
Args: []string{"while true; do sleep 30; done;"},
Image: "songrgg/alpine-debug",
Ports: []int{80},
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(userService, &svcAccDef)
_, err = Td.CreateServiceAccount(userService, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
_, err = Td.CreateDeployment(userService, deploymentDef)
Expect(err).NotTo(HaveOccurred())
Expand Down
12 changes: 8 additions & 4 deletions tests/e2e/e2e_grpc_insecure_origination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,18 @@ func testGRPCTraffic() {
}

// Get simple pod definitions for the gRPC server
svcAccDef, podDef, svcDef := Td.SimplePodApp(
svcAccDef, podDef, svcDef, err := Td.SimplePodApp(
SimplePodAppDef{
Name: destName,
Namespace: destName,
Image: "moul/grpcbin",
Ports: []int{grpcbinInsecurePort},
AppProtocol: "grpc",
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(destName, &svcAccDef)
_, err = Td.CreateServiceAccount(destName, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
_, err = Td.CreatePod(destName, podDef)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -142,14 +144,16 @@ func testGRPCTraffic() {

func setupGRPCClient(sourceName string) *corev1.Pod {
// Get simple Pod definitions for the client
svcAccDef, podDef, _ := Td.SimplePodApp(SimplePodAppDef{
svcAccDef, podDef, _, err := Td.SimplePodApp(SimplePodAppDef{
Name: sourceName,
Namespace: sourceName,
Command: []string{"sleep", "365d"},
Image: "networld/grpcurl",
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(sourceName, &svcAccDef)
_, err = Td.CreateServiceAccount(sourceName, &svcAccDef)
Expect(err).NotTo(HaveOccurred())

srcPod, err := Td.CreatePod(sourceName, podDef)
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/e2e_grpc_secure_origination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,18 @@ func testSecureGRPCTraffic() {
}

// Get simple pod definitions for the gRPC server
svcAccDef, podDef, svcDef := Td.SimplePodApp(
svcAccDef, podDef, svcDef, err := Td.SimplePodApp(
SimplePodAppDef{
Name: destName,
Namespace: destName,
Image: "moul/grpcbin",
Ports: []int{grpcbinSecurePort},
AppProtocol: "tcp",
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(destName, &svcAccDef)
_, err = Td.CreateServiceAccount(destName, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
_, err = Td.CreatePod(destName, podDef)
Expect(err).NotTo(HaveOccurred())
Expand Down
10 changes: 7 additions & 3 deletions tests/e2e/e2e_hashivault_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,17 @@ var _ = OSMDescribe("1 Client pod -> 1 Server pod test using Vault",
}

// Get simple pod definitions for the HTTP server
svcAccDef, podDef, svcDef := Td.SimplePodApp(
svcAccDef, podDef, svcDef, err := Td.SimplePodApp(
SimplePodAppDef{
Name: "server",
Namespace: destNs,
Image: "kennethreitz/httpbin",
Ports: []int{80},
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(destNs, &svcAccDef)
_, err = Td.CreateServiceAccount(destNs, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
dstPod, err := Td.CreatePod(destNs, podDef)
Expect(err).NotTo(HaveOccurred())
Expand All @@ -58,14 +60,16 @@ var _ = OSMDescribe("1 Client pod -> 1 Server pod test using Vault",
Expect(Td.WaitForPodsRunningReady(destNs, 60*time.Second, 1, nil)).To(Succeed())

// Get simple Pod definitions for the client
svcAccDef, podDef, svcDef = Td.SimplePodApp(SimplePodAppDef{
svcAccDef, podDef, svcDef, err = Td.SimplePodApp(SimplePodAppDef{
Name: "client",
Namespace: sourceNs,
Command: []string{"/bin/bash", "-c", "--"},
Args: []string{"while true; do sleep 30; done;"},
Image: "songrgg/alpine-debug",
Ports: []int{80},
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err = Td.CreateServiceAccount(sourceNs, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/e2e_ingressbackend.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@ func testIngressBackend() {
Expect(Td.AddNsToMesh(true, destNs)).To(Succeed())

// Get simple pod definitions for the HTTP server
svcAccDef, podDef, svcDef := Td.SimplePodApp(
svcAccDef, podDef, svcDef, err := Td.SimplePodApp(
SimplePodAppDef{
Name: "server",
Namespace: destNs,
Image: "kennethreitz/httpbin",
Ports: []int{serverPort},
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(destNs, &svcAccDef)
_, err = Td.CreateServiceAccount(destNs, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
_, err = Td.CreatePod(destNs, podDef)
Expect(err).NotTo(HaveOccurred())
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/e2e_ip_exclusion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ func testIPExclusion() {
Expect(Td.AddNsToMesh(true, sourceName)).To(Succeed())

// Set up the destination HTTP server. It is not part of the mesh
svcAccDef, podDef, svcDef := Td.SimplePodApp(
svcAccDef, podDef, svcDef, err := Td.SimplePodApp(
SimplePodAppDef{
Name: destName,
Namespace: destName,
Image: "kennethreitz/httpbin",
Ports: []int{80},
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(destName, &svcAccDef)
_, err = Td.CreateServiceAccount(destName, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
_, err = Td.CreatePod(destName, podDef)
Expect(err).NotTo(HaveOccurred())
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/e2e_k8s_ingress_http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ var _ = OSMDescribe("HTTP ingress using k8s Ingress API",
Expect(Td.AddNsToMesh(true, destNs)).To(Succeed())

// Get simple pod definitions for the HTTP server
svcAccDef, podDef, svcDef := Td.SimplePodApp(
svcAccDef, podDef, svcDef, err := Td.SimplePodApp(
SimplePodAppDef{
Name: "server",
Namespace: destNs,
Image: "kennethreitz/httpbin",
Ports: []int{80},
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(destNs, &svcAccDef)
_, err = Td.CreateServiceAccount(destNs, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
_, err = Td.CreatePod(destNs, podDef)
Expect(err).NotTo(HaveOccurred())
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/e2e_k8s_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@ func testK8sVersion(version string) {
}

// Get simple pod definitions for the HTTP server
svcAccDef, podDef, svcDef := Td.SimplePodApp(
svcAccDef, podDef, svcDef, err := Td.SimplePodApp(
SimplePodAppDef{
Name: destName,
Namespace: destName,
Image: "kennethreitz/httpbin",
Ports: []int{80},
OS: Td.ClusterOS,
})
Expect(err).NotTo(HaveOccurred())

_, err := Td.CreateServiceAccount(destName, &svcAccDef)
_, err = Td.CreateServiceAccount(destName, &svcAccDef)
Expect(err).NotTo(HaveOccurred())
_, err = Td.CreatePod(destName, podDef)
Expect(err).NotTo(HaveOccurred())
Expand Down
Loading

0 comments on commit 73f7407

Please sign in to comment.