mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
Describe IPBlock for NetworkPolicyIngressRule.
This commit is contained in:
parent
eb658d699a
commit
d735f660bc
@ -3118,7 +3118,7 @@ func describeNetworkPolicySpec(nps networking.NetworkPolicySpec, w PrefixWriter)
|
|||||||
|
|
||||||
func printNetworkPolicySpecIngressFrom(npirs []networking.NetworkPolicyIngressRule, initialIndent string, w PrefixWriter) {
|
func printNetworkPolicySpecIngressFrom(npirs []networking.NetworkPolicyIngressRule, initialIndent string, w PrefixWriter) {
|
||||||
if len(npirs) == 0 {
|
if len(npirs) == 0 {
|
||||||
w.WriteLine("<none> (Selected pods are isolated for ingress connectivity)")
|
w.Write(LEVEL_0, "%s%s\n", initialIndent, "<none> (Selected pods are isolated for ingress connectivity)")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for i, npir := range npirs {
|
for i, npir := range npirs {
|
||||||
@ -3144,6 +3144,10 @@ func printNetworkPolicySpecIngressFrom(npirs []networking.NetworkPolicyIngressRu
|
|||||||
w.Write(LEVEL_0, "%s: %s\n", "From Pod Selector", metav1.FormatLabelSelector(from.PodSelector))
|
w.Write(LEVEL_0, "%s: %s\n", "From Pod Selector", metav1.FormatLabelSelector(from.PodSelector))
|
||||||
} else if from.NamespaceSelector != nil {
|
} 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 Namespace Selector", 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)
|
||||||
|
w.Write(LEVEL_0, "%s%sExcept: %v\n", initialIndent, initialIndent, strings.Join(from.IPBlock.Except, ", "))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1664,6 +1664,9 @@ Spec:
|
|||||||
From Pod Selector: id=app2,id2=app3
|
From Pod Selector: id=app2,id2=app3
|
||||||
From Namespace Selector: id=app2,id2=app3
|
From Namespace Selector: id=app2,id2=app3
|
||||||
From Namespace Selector: foo in (bar1,bar2),id=app2,id2=app3
|
From Namespace Selector: 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
|
||||||
----------
|
----------
|
||||||
To Port: <any> (traffic allowed to all ports)
|
To Port: <any> (traffic allowed to all ports)
|
||||||
From: <any> (traffic not restricted by source)
|
From: <any> (traffic not restricted by source)
|
||||||
@ -1724,6 +1727,12 @@ Spec:
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
IPBlock: &networking.IPBlock{
|
||||||
|
CIDR: "192.168.0.0/16",
|
||||||
|
Except: []string{"192.168.3.0/24", "192.168.4.0/24"},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
|
Loading…
Reference in New Issue
Block a user