mirror of https://github.com/k3s-io/k3s
Switch field types to PodSelector and NamespaceSelector
parent
bcdff4f174
commit
c691be3acf
|
@ -3106,7 +3106,7 @@ func describeNetworkPolicy(networkPolicy *networking.NetworkPolicy) (string, err
|
|||
|
||||
func describeNetworkPolicySpec(nps networking.NetworkPolicySpec, w PrefixWriter) {
|
||||
w.Write(LEVEL_0, "Spec:\n")
|
||||
w.Write(LEVEL_1, "Pod Selector: ")
|
||||
w.Write(LEVEL_1, "PodSelector: ")
|
||||
if len(nps.PodSelector.MatchLabels) == 0 && len(nps.PodSelector.MatchExpressions) == 0 {
|
||||
w.Write(LEVEL_2, "<none> (Allowing the specific traffic to all pods in this namespace)\n")
|
||||
} else {
|
||||
|
@ -3144,9 +3144,9 @@ func printNetworkPolicySpecIngressFrom(npirs []networking.NetworkPolicyIngressRu
|
|||
for _, from := range npir.From {
|
||||
w.Write(LEVEL_0, "%s", initialIndent)
|
||||
if from.PodSelector != nil {
|
||||
w.Write(LEVEL_0, "%s: %s\n", "From Pod Selector", metav1.FormatLabelSelector(from.PodSelector))
|
||||
w.Write(LEVEL_0, "%s: %s\n", "From PodSelector", metav1.FormatLabelSelector(from.PodSelector))
|
||||
} else if from.NamespaceSelector != nil {
|
||||
w.Write(LEVEL_0, "%s: %s\n", "From Namespace Selector", metav1.FormatLabelSelector(from.NamespaceSelector))
|
||||
w.Write(LEVEL_0, "%s: %s\n", "From NamespaceSelector", metav1.FormatLabelSelector(from.NamespaceSelector))
|
||||
} else if from.IPBlock != nil {
|
||||
w.Write(LEVEL_0, "From IPBlock:\n")
|
||||
w.Write(LEVEL_0, "%s%sCIDR: %s\n", initialIndent, initialIndent, from.IPBlock.CIDR)
|
||||
|
@ -3185,9 +3185,9 @@ func printNetworkPolicySpecEgressTo(npers []networking.NetworkPolicyEgressRule,
|
|||
for _, to := range nper.To {
|
||||
w.Write(LEVEL_0, "%s", initialIndent)
|
||||
if to.PodSelector != nil {
|
||||
w.Write(LEVEL_0, "%s: %s\n", "To Pod Selector", metav1.FormatLabelSelector(to.PodSelector))
|
||||
w.Write(LEVEL_0, "%s: %s\n", "To PodSelector", metav1.FormatLabelSelector(to.PodSelector))
|
||||
} else if to.NamespaceSelector != nil {
|
||||
w.Write(LEVEL_0, "%s: %s\n", "To Namespace Selector", metav1.FormatLabelSelector(to.NamespaceSelector))
|
||||
w.Write(LEVEL_0, "%s: %s\n", "To NamespaceSelector", metav1.FormatLabelSelector(to.NamespaceSelector))
|
||||
} else if to.IPBlock != nil {
|
||||
w.Write(LEVEL_0, "To IPBlock:\n")
|
||||
w.Write(LEVEL_0, "%s%sCIDR: %s\n", initialIndent, initialIndent, to.IPBlock.CIDR)
|
||||
|
|
|
@ -1657,13 +1657,13 @@ Created on: 2017-06-04 21:45:56 -0700 PDT
|
|||
Labels: <none>
|
||||
Annotations: <none>
|
||||
Spec:
|
||||
Pod Selector: foo in (bar1,bar2),foo2 notin (bar1,bar2),id1=app1,id2=app2
|
||||
PodSelector: foo in (bar1,bar2),foo2 notin (bar1,bar2),id1=app1,id2=app2
|
||||
Allowing ingress traffic:
|
||||
To Port: 80/TCP
|
||||
To Port: 82/TCP
|
||||
From Pod Selector: id=app2,id2=app3
|
||||
From Namespace Selector: id=app2,id2=app3
|
||||
From Namespace Selector: foo in (bar1,bar2),id=app2,id2=app3
|
||||
From PodSelector: id=app2,id2=app3
|
||||
From NamespaceSelector: id=app2,id2=app3
|
||||
From NamespaceSelector: foo in (bar1,bar2),id=app2,id2=app3
|
||||
From IPBlock:
|
||||
CIDR: 192.168.0.0/16
|
||||
Except: 192.168.3.0/24, 192.168.4.0/24
|
||||
|
@ -1673,9 +1673,9 @@ Spec:
|
|||
Allowing egress traffic:
|
||||
To Port: 80/TCP
|
||||
To 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 PodSelector: id=app2,id2=app3
|
||||
To NamespaceSelector: id=app2,id2=app3
|
||||
To NamespaceSelector: 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
|
||||
|
|
Loading…
Reference in New Issue