Example #1
0
func InMultiTenantContext(body func()) {
	Context("when using a multi-tenant plugin", func() {
		BeforeEach(func() {
			if !pluginIsolatesNamespaces() {
				e2e.Skipf("Not a multi-tenant plugin.")
			}
		})

		body()
	})
}
Example #2
0
func InSingleTenantContext(body func()) {
	Context("when using a single-tenant plugin", func() {
		BeforeEach(func() {
			if pluginIsolatesNamespaces() {
				e2e.Skipf("Not a single-tenant plugin.")
			}
		})

		body()
	})
}
Example #3
0
func checkPodIsolation(f1, f2 *e2e.Framework, numNodes int) error {
	nodes, err := e2e.GetReadyNodes(f1)
	if err != nil {
		e2e.Failf("Failed to list nodes: %v", err)
	}
	var serverNode, clientNode *api.Node
	serverNode = &nodes.Items[0]
	if numNodes == 2 {
		if len(nodes.Items) == 1 {
			e2e.Skipf("Only one node is available in this environment")
		}
		clientNode = &nodes.Items[1]
	} else {
		clientNode = serverNode
	}

	podName := "isolation-webserver"
	defer f1.Client.Pods(f1.Namespace.Name).Delete(podName, nil)
	ip := e2e.LaunchWebserverPod(f1, podName, serverNode.Name)

	return checkConnectivityToHost(f2, clientNode.Name, "isolation-wget", ip, 10)
}
Example #4
0
func checkServiceConnectivity(serverFramework, clientFramework *e2e.Framework, numNodes int) error {
	nodes, err := e2e.GetReadyNodes(serverFramework)
	if err != nil {
		e2e.Failf("Failed to list nodes: %v", err)
	}
	var serverNode, clientNode *api.Node
	serverNode = &nodes.Items[0]
	if numNodes == 2 {
		if len(nodes.Items) == 1 {
			e2e.Skipf("Only one node is available in this environment")
		}
		clientNode = &nodes.Items[1]
	} else {
		clientNode = serverNode
	}

	podName := "service-webserver"
	defer serverFramework.Client.Pods(serverFramework.Namespace.Name).Delete(podName, nil)
	ip := launchWebserverService(serverFramework, podName, serverNode.Name)

	return checkConnectivityToHost(clientFramework, clientNode.Name, "service-wget", ip, 10)
}
Example #5
0
func skipIfMultiTenant() {
	if pluginIsolatesNamespaces() {
		e2e.Skipf("Not a single-tenant plugin.")
	}
}
Example #6
0
func skipIfSingleTenant() {
	if !pluginIsolatesNamespaces() {
		e2e.Skipf("Not a multi-tenant plugin.")
	}
}
Example #7
0
		defer f.Client.Pods(f.Namespace.Name).Delete(podName, nil)
		ip := e2e.LaunchWebserverPod(f, podName, node.Name)

		By("Checking that the webserver is accessible from a pod on the same node")
		expectNoError(checkConnectivityToHost(f, node.Name, "same-node-wget", ip, timeout))
	})

	It("should function for pod communication between nodes", func() {
		podClient := f.Client.Pods(f.Namespace.Name)

		By("Picking multiple nodes")
		nodes, err := e2e.GetReadyNodes(f)
		if err != nil {
			e2e.Failf("Failed to list nodes: %v", err)
		}
		if len(nodes.Items) == 1 {
			e2e.Skipf("Only one node is available in this environment")
		}
		node1 := nodes.Items[0]
		node2 := nodes.Items[1]

		By("Creating a webserver pod")
		podName := "different-node-webserver"
		defer podClient.Delete(podName, nil)
		ip := e2e.LaunchWebserverPod(f, podName, node1.Name)

		By("Checking that the webserver is accessible from a pod on a different node")
		expectNoError(checkConnectivityToHost(f, node2.Name, "different-node-wget", ip, timeout))
	})
})