Skip to content

Commit

Permalink
UPSTREAM: 96856: e2e network policy enclose IPv6 destinations
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Antonio Ojea authored and stbenjam committed Mar 19, 2021
1 parent e1bc274 commit f2da9fb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/e2e/network/network_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"encoding/json"
"fmt"
"net"
"strconv"
"time"

v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -1158,7 +1158,7 @@ var _ = SIGDescribe("NetworkPolicy [LinuxOnly]", func() {
ginkgo.By("Creating a network policy for the server which allows traffic from all clients.")
policyIngressAllowAll := &networkingv1.NetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
//Namespace: f.Namespace.Name,
// Namespace: f.Namespace.Name,
Name: "allow-all",
},
Spec: networkingv1.NetworkPolicySpec{
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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),
},
},
},
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit f2da9fb

Please sign in to comment.