diff --git a/pkg/printers/internalversion/describe_test.go b/pkg/printers/internalversion/describe_test.go index fef1f70fe9a..0eb6f3af13c 100644 --- a/pkg/printers/internalversion/describe_test.go +++ b/pkg/printers/internalversion/describe_test.go @@ -1670,6 +1670,18 @@ Spec: ---------- To Port: (traffic allowed to all ports) From: (traffic not restricted by source) + Allowing egress traffic: + From Port: 80/TCP + From Port: 82/TCP + To Pod Selector: id=app2,id2=app3 + To Namespace Selector: id=app2,id2=app3 + To Namespace Selector: foo in (bar1,bar2),id=app2,id2=app3 + To IPBlock: + CIDR: 192.168.0.0/16 + Except: 192.168.3.0/24, 192.168.4.0/24 + ---------- + From Port: (traffic allowed to all ports) + To: (traffic not restricted by source) ` port80 := intstr.FromInt(80) @@ -1737,6 +1749,50 @@ Spec: }, {}, }, + Egress: []networking.NetworkPolicyEgressRule{ + { + Ports: []networking.NetworkPolicyPort{ + {Port: &port80}, + {Port: &port82, Protocol: &protoTCP}, + }, + To: []networking.NetworkPolicyPeer{ + { + PodSelector: &metav1.LabelSelector{ + MatchLabels: map[string]string{ + "id": "app2", + "id2": "app3", + }, + }, + }, + { + NamespaceSelector: &metav1.LabelSelector{ + MatchLabels: map[string]string{ + "id": "app2", + "id2": "app3", + }, + }, + }, + { + NamespaceSelector: &metav1.LabelSelector{ + MatchLabels: map[string]string{ + "id": "app2", + "id2": "app3", + }, + MatchExpressions: []metav1.LabelSelectorRequirement{ + {Key: "foo", Operator: "In", Values: []string{"bar1", "bar2"}}, + }, + }, + }, + { + IPBlock: &networking.IPBlock{ + CIDR: "192.168.0.0/16", + Except: []string{"192.168.3.0/24", "192.168.4.0/24"}, + }, + }, + }, + }, + {}, + }, }, }) d := NetworkPolicyDescriber{versionedFake}