mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
e2e network policy enclose IPv6 destinations
We moved to DNS destination to IP:Port, so we need to be sure that IPv6 addresses are enclosed in square brackets with that format.
This commit is contained in:
parent
c1f36fa6f2
commit
60f739ac17
@ -21,6 +21,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
@ -1033,7 +1034,6 @@ var _ = SIGDescribe("NetworkPolicy [LinuxOnly]", func() {
|
||||
ginkgo.By("client-b should not be able to communicate with server port 81 in namespace-a", func() {
|
||||
testCannotConnect(f, nsB, "client-b", service, notAllowedPort)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
ginkgo.It("should enforce egress policy allowing traffic to a server in a different namespace based on PodSelector and NamespaceSelector [Feature:NetworkPolicy]", func() {
|
||||
@ -1333,7 +1333,6 @@ var _ = SIGDescribe("NetworkPolicy [LinuxOnly]", func() {
|
||||
ginkgo.By("Creating client-a which should be able to contact the server.", func() {
|
||||
testCanConnect(f, f.Namespace, "client-a", service, 80)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
ginkgo.It("should allow egress access to server in CIDR block [Feature:NetworkPolicy]", func() {
|
||||
@ -1580,7 +1579,6 @@ var _ = SIGDescribe("NetworkPolicy [LinuxOnly]", func() {
|
||||
ginkgo.By("Creating client-a which should still be able to contact the server after recreating the network policy with except clause.", func() {
|
||||
testCanConnect(f, f.Namespace, "client-a", service, 80)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
ginkgo.It("should enforce policies to check ingress and egress policies can be controlled independently based on PodSelector [Feature:NetworkPolicy]", func() {
|
||||
@ -2144,7 +2142,7 @@ func createNetworkClientPodWithRestartPolicy(f *framework.Framework, namespace *
|
||||
Command: []string{"/bin/sh"},
|
||||
Args: []string{
|
||||
"-c",
|
||||
fmt.Sprintf("for i in $(seq 1 5); do /agnhost connect %s:%d --protocol %s --timeout 8s && exit 0 || sleep 1; done; exit 1", targetService.Spec.ClusterIP, targetPort, connectProtocol),
|
||||
fmt.Sprintf("for i in $(seq 1 5); do /agnhost connect %s --protocol %s --timeout 8s && exit 0 || sleep 1; done; exit 1", net.JoinHostPort(targetService.Spec.ClusterIP, strconv.Itoa(targetPort)), connectProtocol),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -2200,10 +2198,12 @@ var _ = SIGDescribe("NetworkPolicy API", func() {
|
||||
npVersion := "v1"
|
||||
npClient := f.ClientSet.NetworkingV1().NetworkPolicies(ns)
|
||||
npTemplate := &networkingv1.NetworkPolicy{
|
||||
ObjectMeta: metav1.ObjectMeta{GenerateName: "e2e-example-netpol",
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
GenerateName: "e2e-example-netpol",
|
||||
Labels: map[string]string{
|
||||
"special-label": f.UniqueName,
|
||||
}},
|
||||
},
|
||||
},
|
||||
Spec: networkingv1.NetworkPolicySpec{
|
||||
// Apply this policy to the Server
|
||||
PodSelector: metav1.LabelSelector{
|
||||
|
Loading…
Reference in New Issue
Block a user