-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
NetworkPolicy allows an empty podSelector:
// NetworkPolicySpec provides the specification of a NetworkPolicy
type NetworkPolicySpec struct {
// podSelector selects the pods to which this NetworkPolicy object applies.
// The array of ingress rules is applied to any pods selected by this field.
// Multiple network policies can select the same set of pods. In this case,
// the ingress rules for each are combined additively.
// This field is NOT optional and follows standard label selector semantics.
// An empty podSelector matches all pods in this namespace.
PodSelector metav1.LabelSelector `json:"podSelector" protobuf:"bytes,1,opt,name=podSelector"`
However, MultiNetworkPolicy does not:
trozet@fedora:~/go/src/github.com/ovn-org/ovn-kubernetes/contrib$ cat /home/trozet/network_policy_port_range_udn.yml
---
apiVersion: k8s.cni.cncf.io/v1beta1
kind: MultiNetworkPolicy
metadata:
name: deny-by-default
annotations:
k8s.v1.cni.cncf.io/policy-for: ns1/l3-network
spec:
podSelector:
# matchLabels:
# key: value
policyTypes:
- Egress
egress:
- to:
- ipBlock:
cidr: 10.244.0.0/16
ports:
- protocol: TCP
port: 15384
endPort: 65535
- port: 1337
endPort: 1338
trozet@fedora:~/go/src/github.com/ovn-org/ovn-kubernetes/contrib$ oc create -f /home/trozet/network_policy_port_range_udn.yml
The MultiNetworkPolicy "deny-by-default" is invalid: spec.podSelector: Required value
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels