Skip to content

Commit

Permalink
test: Remove "Checks service on same node" test
Browse files Browse the repository at this point in the history
It is covered by [1] running on ci-datapath: "echo" pod can run on the
same node as either of the "client" pods./

[1]: https://github.com/cilium/cilium-cli/blob/v0.13.1/connectivity/tests/service.go#L17

Signed-off-by: Martynas Pumputis <m@lambda.lt>
  • Loading branch information
brb authored and borkmann committed Mar 13, 2023
1 parent b5e0e12 commit 6c8efa7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 58 deletions.
10 changes: 0 additions & 10 deletions test/k8s/service_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,6 @@ func ciliumDelService(kubectl *helpers.Kubectl, id int64) {
}
}

func ciliumHasServiceIP(kubectl *helpers.Kubectl, pod, vip string) bool {
service := kubectl.CiliumExecMustSucceed(context.TODO(), pod, "cilium service list", "Cannot retrieve services on cilium Pod")
vip4 := fmt.Sprintf(" %s:", vip)
if strings.Contains(service.Stdout(), vip4) {
return true
}
vip6 := fmt.Sprintf(" [%s]:", vip)
return strings.Contains(service.Stdout(), vip6)
}

var newlineRegexp = regexp.MustCompile(`\n[ \t\n]*`)

func trimNewlines(script string) string {
Expand Down
51 changes: 3 additions & 48 deletions test/k8s/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ import (
)

const (
appServiceName = "app1-service"
appServiceNameIPv6 = "app1-service-ipv6"
echoServiceName = "echo"
echoPodLabel = "name=echo"
app2PodLabel = "id=app2"
appServiceName = "app1-service"
echoServiceName = "echo"
echoPodLabel = "name=echo"
// echoServiceNameIPv6 = "echo-ipv6"

testDSClient = "zgroup=testDSClient"
Expand Down Expand Up @@ -97,49 +95,6 @@ var _ = SkipDescribeIf(helpers.RunsOn54Kernel, "K8sDatapathServicesTest", func()
ExpectAllPodsTerminated(kubectl)
})

// This is testing bpf_lxc LB (= KPR=disabled) when both client and
// server are running on the same node. Thus, skipping when running with
// KPR.
SkipItIf(func() bool {
return helpers.RunsWithKubeProxyReplacement()
}, "Checks service on same node", func() {
serviceNames := []string{appServiceName}
if helpers.DualStackSupported() {
serviceNames = append(serviceNames, appServiceNameIPv6)
}

ciliumPods, err := kubectl.GetCiliumPods()
Expect(err).To(BeNil(), "Cannot get cilium pods")

for _, svcName := range serviceNames {
clusterIP, _, err := kubectl.GetServiceHostPort(helpers.DefaultNamespace, svcName)
Expect(err).Should(BeNil(), "Cannot get service %s", svcName)
Expect(govalidator.IsIP(clusterIP)).Should(BeTrue(), "ClusterIP is not an IP")

By("testing connectivity via cluster IP %s", clusterIP)

httpSVCURL := fmt.Sprintf("http://%s/", net.JoinHostPort(clusterIP, "80"))
tftpSVCURL := fmt.Sprintf("tftp://%s/hello", net.JoinHostPort(clusterIP, "69"))

status := kubectl.ExecInHostNetNS(context.TODO(), ni.K8s1NodeName,
helpers.CurlFail(httpSVCURL))
Expect(status).Should(helpers.CMDSuccess(), "cannot curl to service IP from host: %s", status.CombineOutput())

status = kubectl.ExecInHostNetNS(context.TODO(), ni.K8s1NodeName,
helpers.CurlFail(tftpSVCURL))
Expect(status).Should(helpers.CMDSuccess(), "cannot curl to service IP from host: %s", status.CombineOutput())

for _, pod := range ciliumPods {
Expect(ciliumHasServiceIP(kubectl, pod, clusterIP)).Should(BeTrue(),
"ClusterIP is not present in the cilium service list")
}
// Send requests from "app2" pod which runs on the same node as
// "app1" pods
testCurlFromPods(kubectl, app2PodLabel, httpSVCURL, 10, 0)
testCurlFromPods(kubectl, app2PodLabel, tftpSVCURL, 10, 0)
}
})

SkipContextIf(helpers.DoesNotRunWithKubeProxyReplacement, "Checks in-cluster KPR", func() {
It("Tests HealthCheckNodePort", func() {
testHealthCheckNodePort(kubectl, ni)
Expand Down

0 comments on commit 6c8efa7

Please sign in to comment.