-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Is your enhancement request related to a problem? Please describe.
Currently only TCP, UDP, and SCTP protocols are supported, but there are more protocols (ICMP, ICMPv6 are the most popular requests) that may be useful. An example use case is "I want to only allow ICMP connections to implement health monitoring and deny everything else."
Describe the solution you'd like
To potentially implement it in the future, we may need to re-consider AdminNetworkPolicyPort https://github.com/kubernetes-sigs/network-policy-api/blob/main/apis/v1alpha1/shared_types.go#L52 design, which puts protocol inside the port definition, while some protocols don't have ports, it may be difficult to expand.
Describe alternatives you've considered
We could add an extra protocols field at the same level as ports https://github.com/kubernetes-sigs/network-policy-api/blob/main/apis/v1alpha1/adminnetworkpolicy_types.go#L151, but that may be confusing.
Example solution:
type AdminNetworkPolicyProtocol struct {
NamedPort *string `json:"namedPort,omitempty"`
TCP *PortProtocol `json:"TCP,omitempty"`
UDP *PortProtocol `json:"UDP,omitempty"`
SCTP *PortProtocol `json:"SCTP,omitempty"`
// may be added in the future as
ICMP *SimpleProtocol `json:"ICMP,omitempty"`
}
type SimpleProtocol struct {}
type PortProtocol struct {
Ports *[]int32 `json:"ports,omitempty"`
PortRanges *[]PortRange `json:"portRanges,omitempty"`
}
type PortRange struct {
Start int32 `json:"start"`
End int32 `json:"end"`
}
then the current ports spec
ports:
- namedPort: containerPort
- portNumber:
protocol: TCP
port: 1111
- portNumber:
protocol: TCP
port: 2222
- portRange:
protocol: UDP
start: 1
end: 9999
- portRange:
protocol: SCTP
start: 1
end: 65535
may look like
protocols:
- namedPort: containerPort
- TCP:
ports: [1111, 2222]
- UDP:
portRanges:
- start: 1
end: 9999
- SCTP: {}
Metadata
Metadata
Assignees
Labels
Type
Projects
Status