We have currently implemented it this way:
If pod is selected and has at least one egress policy attached, egress
is limited to the sum of all allowed CIDRs. I understand that this is
not entirely consistent. While at ingress, an empty selector means
allow-all, at egress, an empty []toCIDR means allow to none. Couldn't
come up with anything better so far.
// EgressRule contains all rule types which can be applied at egress, i.e.
// network traffic that originates inside the endpoint and exits the endpoint
// selected by the endpointSelector.
//
// - All members of this structure are optional. If omitted or empty, the
// member will have no effect on the rule.
type EgressRule struct {
// ToPorts is a list of destination ports identified by port
number and
// protocol which the endpoint subject to the rule is allowed to
// connect to.
//
// Example:
// Any endpoint with the label "role=frontend" is allowed to initiate
// connections to destination port 8080/tcp
//
// +optional
ToPorts []PortRule `json:"toPorts,omitempty"`
// ToCIDR is a list of IP blocks which the endpoint subject
to the rule
// is allowed to initiate connections to in addition to connections
// which are allowed via FromEndpoints. This will match on the
// destination IP address of outgoing connections.
//
// Example:
// Any endpoint with the label "app=database-proxy" is allowed to
// initiate connections to
10.2.3.0/24
//
// +optional
ToCIDR []CIDR `json:"toCIDR,omitempty"`
}