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

v1.12 Backports 2023-04-03 #24709

Merged
merged 3 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions daemon/cmd/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,14 +694,14 @@ func (d *Daemon) DeleteEndpoint(id string) (int, error) {
logfields.IPv6: ep.GetIPv6Address(),
logfields.EndpointID: ep.ID,
logfields.K8sPodName: ep.GetK8sPodName(),
logfields.K8sNamespace: ep.GetK8sPodName(),
logfields.K8sNamespace: ep.GetK8sNamespace(),
}).Info(msg)
default:
log.WithFields(logrus.Fields{
logfields.ContainerID: containerID,
logfields.EndpointID: ep.ID,
logfields.K8sPodName: ep.GetK8sPodName(),
logfields.K8sNamespace: ep.GetK8sPodName(),
logfields.K8sNamespace: ep.GetK8sNamespace(),
}).Info(msg)
}
return d.deleteEndpoint(ep), nil
Expand Down
21 changes: 14 additions & 7 deletions test/k8s/datapath_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,10 +718,6 @@ var _ = Describe("K8sDatapathConfig", func() {
kubectl.Exec("kubectl label nodes --all status-")
})

AfterEach(func() {
kubectl.Exec(fmt.Sprintf("%s delete --all ccnp", helpers.KubectlCmd))
})

SkipItIf(func() bool {
return !helpers.IsIntegration(helpers.CIIntegrationGKE)
}, "Check connectivity with IPv6 disabled", func() {
Expand Down Expand Up @@ -838,6 +834,10 @@ func testHostFirewall(kubectl *helpers.Kubectl) {
By(fmt.Sprintf("Applying policies %s", demoHostPolicies))
_, err := kubectl.CiliumClusterwidePolicyAction(demoHostPolicies, helpers.KubectlApply, helpers.HelperTimeout)
ExpectWithOffset(1, err).Should(BeNil(), fmt.Sprintf("Error creating resource %s: %s", demoHostPolicies, err))
defer func() {
_, err := kubectl.CiliumClusterwidePolicyAction(demoHostPolicies, helpers.KubectlDelete, helpers.HelperTimeout)
ExpectWithOffset(1, err).Should(BeNil(), fmt.Sprintf("Error deleting resource %s: %s", demoHostPolicies, err))
}()

var wg sync.WaitGroup
wg.Add(1)
Expand Down Expand Up @@ -964,18 +964,24 @@ func fetchPodsWithOffset(kubectl *helpers.Kubectl, namespace, name, filter, host
return targetPod, targetPodJSON
}

func applyL3Policy(kubectl *helpers.Kubectl, ns string) {
func applyL3Policy(kubectl *helpers.Kubectl, ns string) (withdrawPolicy func()) {
demoPolicyL3 := helpers.ManifestGet(kubectl.BasePath(), "l3-policy-demo.yaml")
By(fmt.Sprintf("Applying policy %s", demoPolicyL3))
_, err := kubectl.CiliumPolicyAction(ns, demoPolicyL3, helpers.KubectlApply, helpers.HelperTimeout)
ExpectWithOffset(1, err).Should(BeNil(), fmt.Sprintf("Error creating resource %s: %s", demoPolicyL3, err))

return func() {
_, err := kubectl.CiliumPolicyAction(ns, demoPolicyL3, helpers.KubectlDelete, helpers.HelperTimeout)
ExpectWithOffset(1, err).Should(BeNil(), fmt.Sprintf("Error deleting resource %s: %s", demoPolicyL3, err))
}
}

func testPodConnectivityAndReturnIP(kubectl *helpers.Kubectl, requireMultiNode bool, callOffset int) (bool, string) {
callOffset++

randomNamespace := deploymentManager.DeployRandomNamespaceShared(DemoDaemonSet)
applyL3Policy(kubectl, randomNamespace)
withdrawPolicy := applyL3Policy(kubectl, randomNamespace)
defer withdrawPolicy()
deploymentManager.WaitUntilReady()

By("Checking pod connectivity between nodes")
Expand Down Expand Up @@ -1038,7 +1044,8 @@ func testPodHTTPToOutside(kubectl *helpers.Kubectl, outsideURL string, expectNod
}

namespace := deploymentManager.DeployRandomNamespaceShared(DemoDaemonSet)
applyL3Policy(kubectl, namespace)
withdrawPolicy := applyL3Policy(kubectl, namespace)
defer withdrawPolicy()
deploymentManager.WaitUntilReady()

label := "zgroup=testDSClient"
Expand Down