Skip to content

Commit d180bf7

Browse files
committed
Correct some more parts of the Kep
Signed-off-by: Ricardo Pchevuzinske Katz <[email protected]>
1 parent fc03f7d commit d180bf7

File tree

2 files changed

+29
-26
lines changed

2 files changed

+29
-26
lines changed

keps/sig-network/2079-network-policy-port-range/README.md

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Items marked with (R) are required *prior to targeting to a milestone / release*
5050

5151
## Summary
5252

53-
Today the ``ports``field in ingress and egress network policies is an array
53+
Today the `ports` field in ingress and egress network policies is an array
5454
that needs a declaration of each single port to be contemplated. This KEP
5555
proposes to add a new field that allows a declaration of a port range,
5656
simplifying the creation of rules with multiple ports.
@@ -87,25 +87,25 @@ spec:
8787

8888
So for the user:
8989
* To allow a range of ports, each of them must be declared as an item from
90-
``ports`` array
90+
`ports` array
9191
* To make an exception needs a declaration of all ports but the exception
9292

93-
Adding a new ``endPort`` field inside the ``ports`` will allow a simpler
93+
Adding a new `endPort` field inside the `ports` will allow a simpler
9494
creation of NetworkPolicy to the user.
9595

9696
### Goals
9797

98-
Add an endPort field in ``NetworkPolicyPort``
98+
Add an endPort field in `NetworkPolicyPort`
9999

100100
### Non-Goals
101101

102-
* Support specific ``Exception`` field.
103-
* Support ``endPort`` when the starting ``port`` is a named port.
102+
* Support specific `Exception` field.
103+
* Support `endPort` when the starting `port` is a named port.
104104

105105
## Proposal
106106

107-
In NetworkPolicy specification, inside ``NetworkPolicyPort`` specify a new
108-
``endPort`` field composed of a numbered port that defines if this is a range
107+
In NetworkPolicy specification, inside `NetworkPolicyPort` specify a new
108+
`endPort` field composed of a numbered port that defines if this is a range
109109
and when it ends.
110110

111111
### User Stories
@@ -150,7 +150,7 @@ of the new field.
150150
## Design Details
151151

152152
API changes to NetworkPolicy:
153-
* Add a new field called ``EndPort`` inside ``NetworkPolicyPort`` as the following:
153+
* Add a new field called `EndPort` inside `NetworkPolicyPort` as the following:
154154
```
155155
// NetworkPolicyPort describes a port to allow traffic on
156156
type NetworkPolicyPort struct {
@@ -159,22 +159,25 @@ type NetworkPolicyPort struct {
159159
// +optional
160160
Protocol *v1.Protocol `json:"protocol,omitempty" protobuf:"bytes,1,opt,name=protocol,casttype=k8s.io/api/core/v1.Protocol"`
161161
162-
// The port on the given protocol. This can either be a numerical or named port on
163-
// a pod. If this field is not provided, this matches all port names and numbers.
162+
// The port on the given protocol. This can either be a numerical or named
163+
// port on a pod. If this field is not provided, this matches all port names and
164+
// numbers, whether an endPort is defined or not.
164165
// +optional
165166
Port *intstr.IntOrString `json:"port,omitempty" protobuf:"bytes,2,opt,name=port"`
166167
167-
// EndPort defines the end of the port range, being the end included within the
168-
// range
168+
// EndPort defines the last port included in the port range.
169+
// Example:
170+
// endPort: 12345
169171
// +optional
170172
EndPort int32 `json:"port,omitempty" protobuf:"bytes,2,opt,name=endPort"`
171173
}
172174
```
173175

174176
### Validations
175-
The ``NetworkPolicyPort`` will need to be validated, with the following scenarios:
176-
* If an ``EndPort`` is specified a ``Port`` must also be specified
177-
* If ``Port`` is a string ``EndPort`` cannot be specified
177+
The `NetworkPolicyPort` will need to be validated, with the following scenarios:
178+
* If an `EndPort` is specified a `Port` must also be specified
179+
* If `Port` is a string (named port) `EndPort` cannot be specified
180+
* `EndPort` must be equal or bigger than `Port`
178181

179182
### Test Plan
180183

@@ -195,23 +198,23 @@ validation should be done by CNIs.
195198
- Add validation tests in API
196199

197200
#### Beta
198-
- ``EndPort`` has been supported for at least 1 minor release
201+
- `EndPort` has been supported for at least 1 minor release
199202
- Four commonly used NetworkPolicy (or CNI providers) implement the new field,
200203
with generally positive feedback on its usage.
201204
- Feature Gate is enabled by Default.
202205

203206
#### GA Graduation
204207

205-
- At least **four** NetworkPolicy providers (or CNI providers) support the ``EndPort`` field
206-
- ``EndPort`` has been enabled by default for at least 1 minor release
208+
- At least **four** NetworkPolicy providers (or CNI providers) support the `EndPort` field
209+
- `EndPort` has been enabled by default for at least 1 minor release
207210

208211
### Upgrade / Downgrade Strategy
209212

210213
If upgraded no impact should happen as this is a new field.
211214

212215
If downgraded the CNI wont be able to look into the new field, as this does not
213216
exists and network policies using this field will stop working correctly and
214-
start working incorrectly.
217+
start working incorrectly. This is a fail-closed failure, so it is acceptable.
215218

216219
## Production Readiness Review Questionnaire
217220

@@ -232,7 +235,7 @@ _This section must be completed when targeting alpha to a release._
232235
Yes, but CNIs relying on the new field wont recognize it anymore
233236

234237
* **What happens if we reenable the feature if it was previously rolled back?**
235-
Nothing. Just need to check if the data is persisted in ``etcd`` after the
238+
Nothing. Just need to check if the data is persisted in `etcd` after the
236239
feature is disabled and reenabled or if the data is missed
237240

238241
* **Are there any tests for feature enablement/disablement?**
@@ -282,7 +285,7 @@ previous answers based on experience in the field._
282285
TBD
283286

284287
* **Will enabling / using this feature result in introducing new API types?**
285-
No, unless the new ``EndPort`` is considered a new API type
288+
No, unless the new `EndPort` is considered a new API type
286289

287290
* **Will enabling / using this feature result in any new calls to the cloud
288291
provider?**
@@ -292,7 +295,7 @@ provider?**
292295
the existing API objects?**
293296

294297
- API type(s): NetworkPolicyPorts
295-
- Estimated increase in size: 2 bytes for each new ``EndPort`` specified
298+
- Estimated increase in size: 2 bytes for each new `EndPort` specified
296299
- Estimated amount of new objects: N/A
297300

298301
* **Will enabling / using this feature result in increasing time taken by any
@@ -336,7 +339,7 @@ populate their packet filtering tables with each port.
336339
## Alternatives
337340

338341
During the development of this KEP there was an alternative implementation
339-
of the ``NetworkPolicyPortRange`` field inside the ``NetworkPolicyPort`` as the following:
342+
of the `NetworkPolicyPortRange` field inside the `NetworkPolicyPort` as the following:
340343

341344
```
342345
// NetworkPolicyPort describes a port or a range of ports to allow traffic on
@@ -363,7 +366,7 @@ type NetworkPolicyPort struct {
363366
But the main design suggested in this Kep seems more clear, so this alternative
364367
has been discarded.
365368

366-
Also it has been proposed that the implementation contains an ``Except``` array and a new
369+
Also it has been proposed that the implementation contains an `Except` array and a new
367370
struct to be used in Ingress/Egress rules, but because it would bring much more complexity
368371
than desired the proposal has been dropped right now:
369372

keps/sig-network/2079-network-policy-port-range/kep.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ reviewers:
1010
- "@abhiraut"
1111
- "@danwinship"
1212
approvers:
13-
- TBD
13+
- "@thockin"
1414

1515
# The target maturity stage in the current dev cycle for this KEP.
1616
stage: alpha

0 commit comments

Comments
 (0)