generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 38
npep-187: More protocols support #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
npinaeva
wants to merge
1
commit into
kubernetes-sigs:main
Choose a base branch
from
npinaeva:npep-187
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+104
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# NPEP-187: More protocols support | ||
|
||
* Issue: [#187](https://github.com/kubernetes-sigs/network-policy-api/issues/187) | ||
* Status: Provisional | ||
|
||
## TLDR | ||
|
||
Change existing `ports` selector to allow more protocols in the future. | ||
|
||
## Goals | ||
|
||
Change existing `ports` selector to allow more protocols in the future. | ||
|
||
## Non-Goals | ||
|
||
Adding new protocols to the API. | ||
|
||
## Introduction | ||
|
||
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. | ||
|
||
## User-Stories/Use-Cases | ||
|
||
Story 1: Protocols extension | ||
|
||
As a cluster admin I want to be able to use protocols other than TCP, UDP, and SCTP in my ANP. | ||
For example, I want to only allow ICMP connections to implement health monitoring and deny everything else. | ||
|
||
## API | ||
|
||
As we only support port-based protocols (TCP, UDP, and SCTP), current protocol matching is expressed as | ||
```yaml | ||
ports: | ||
- portNumber: | ||
protocol: TCP | ||
port: 80 | ||
- portRange: | ||
protocol: UDP | ||
start: 1 | ||
end: 100 | ||
``` | ||
To enable more protocols support in the future, we need to change the high-level field name from `port` to `protocol` to be more generic. | ||
|
||
In the `protocols` filter design we decided to start from the YAML that we want (i.e. YAML that is easy to write and understand). | ||
We want to make popular filters (TCP and UDN ports) easy and less popular filters (like ICMP and named ports) possible. | ||
This brings us to the following design: | ||
|
||
```yaml | ||
protocols: | ||
- protocol: TCP | ||
port: 8080 | ||
- protocol: UDP | ||
portRange: | ||
start: 8080 | ||
end: 9090 | ||
- namedPort: http | ||
# protocol: "" # must be empty string: defaulted / omitempty | ||
``` | ||
|
||
with the validation like so: | ||
- empty `protocols` list is not allowed | ||
- at least 1 field for each `protocol` element must be set | ||
- if `namedPort` is set, `protocol` must be unset | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we were thinking to not have namedPort for the first pass? |
||
- if `protocol` is TCP/UDP/SCTP, `port: int` or `portRange: {start: int, end: int}` must be set, but not at the same time | ||
|
||
Using ICMP as a potential example for a pure protocol match (`protocol: ICMP`) or protocol with extra fields (e.g. ICMP type and code), | ||
a future extension could look like this: | ||
|
||
```yaml | ||
protocols: | ||
# option 1: A little inconsistent with port match as it has an extra `icmp` field instead of flat parameters | ||
- protocol: ICMP | ||
icmp: | ||
type: 7 | ||
code: 3 | ||
# option 2: Flat parameters, may conflict with the future protocol that also have type or code | ||
- protocol: ICMP | ||
type: 7 | ||
code: 3 | ||
# option 3: Same as option 1, but without a discriminator (protocol) | ||
- icmp: | ||
type: 7 | ||
code: 3 | ||
``` | ||
|
||
## Conformance Details | ||
|
||
(This section describes the names to be used for the feature or | ||
features in conformance tests and profiles. | ||
|
||
These should be `CamelCase` names that specify the feature as | ||
precisely as possible, and are particularly important for | ||
Extended features, since they may be surfaced to users.) | ||
|
||
## Alternatives | ||
|
||
(List other design alternatives and why we did not go in that | ||
direction) | ||
|
||
## References | ||
|
||
(Add any additional document links. Again, we should try to avoid | ||
too much content not in version control to avoid broken links) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarification: this is having just
protocols: but no list
?