Skip to content

Commit af5201a

Browse files
committed
Fix some typos and formatted the Kep properly
Signed-off-by: Ricardo Pchevuzinske Katz <[email protected]>
1 parent fb32a49 commit af5201a

File tree

2 files changed

+136
-123
lines changed

2 files changed

+136
-123
lines changed

keps/sig-network/20201014-NamespaceAsName.md renamed to keps/sig-network/2112-netpol-namespace-name-selector/README.md

+101-123
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,3 @@
1-
<!--
2-
**Note:** When your KEP is complete, all of these comment blocks should be removed.
3-
4-
To get started with this template:
5-
6-
- [X] **Pick a hosting SIG.**
7-
Make sure that the problem space is something the SIG is interested in taking
8-
up. KEPs should not be checked in without a sponsoring SIG.
9-
- [X] **Create an issue in kubernetes/enhancements**
10-
When filing an enhancement tracking issue, please make sure to complete all
11-
fields in that template. One of the fields asks for a link to the KEP. You
12-
can leave that blank until this KEP is filed, and then go back to the
13-
enhancement and add the link.
14-
- [X] **Make a copy of this template directory.**
15-
Copy this template into the owning SIG's directory and name it
16-
`NNNN-short-descriptive-title`, where `NNNN` is the issue number (with no
17-
leading-zero padding) assigned to your enhancement above.
18-
- [X] **Fill out as much of the kep.yaml file as you can.**
19-
At minimum, you should fill in the "Title", "Authors", "Owning-sig",
20-
"Status", and date-related fields.
21-
- [X] **Fill out this file as best you can.**
22-
At minimum, you should fill in the "Summary" and "Motivation" sections.
23-
These should be easy if you've preflighted the idea of the KEP with the
24-
appropriate SIG(s).
25-
- [X] **Create a PR for this KEP.**
26-
Assign it to people in the SIG who are sponsoring this process.
27-
- [ ] **Merge early and iterate.**
28-
Avoid getting hung up on specific details and instead aim to get the goals of
29-
the KEP clarified and merged quickly. The best way to do this is to just
30-
start with the high-level sections and fill out details incrementally in
31-
subsequent PRs.
32-
33-
Just because a KEP is merged does not mean it is complete or approved. Any KEP
34-
marked as `provisional` is a working document and subject to change. You can
35-
denote sections that are under active debate as follows:
36-
37-
```
38-
<<[UNRESOLVED optional short context or usernames ]>>
39-
Stuff that is being argued.
40-
<<[/UNRESOLVED]>>
41-
```
42-
43-
When editing KEPS, aim for tightly-scoped, single-topic PRs to keep discussions
44-
focused. If you disagree with what is already in a document, open a new PR
45-
with suggested changes.
46-
47-
One KEP corresponds to one "feature" or "enhancement" for its whole lifecycle.
48-
You do not need a new KEP to move from beta to GA, for example. If
49-
new details emerge that belong in the KEP, edit the KEP. Once a feature has become
50-
"implemented", major changes should get new KEPs.
51-
52-
The canonical place for the latest set of instructions (and the likely source
53-
of this file) is [here](/keps/NNNN-kep-template/README.md).
54-
55-
**Note:** Any PRs to move a KEP to `implementable`, or significant changes once
56-
it is marked `implementable`, must be approved by each of the KEP approvers.
57-
If none of those approvers are still appropriate, then changes to that list
58-
should be approved by the remaining approvers and/or the owning SIG (or
59-
SIG Architecture for cross-cutting KEPs).
60-
-->
61-
# KEP-xxxx: Add Namespace as Name field to NetworkPolicy
62-
631
<!-- toc -->
642
- [Release Signoff Checklist](#release-signoff-checklist)
653
- [Summary](#summary)
@@ -105,67 +43,102 @@ Items marked with (R) are required *prior to targeting to a milestone / release*
10543

10644
## Summary
10745

108-
The ability to target namespaces using names, when building NetworkPolicy objects, has been a request from the broader k8s community for quite some time. In the sig-network-networkpolicy API group, it was one of the most popular policies which was voted on.
46+
The ability to target namespaces using names, when building NetworkPolicy
47+
objects, has been a request from the broader k8s community for quite some
48+
time. In the sig-network networkpolicy API sub project, it was one of the
49+
most popular policies which was voted on.
10950

11051
## Motivation
11152

112-
NetworkPolicies are under utilized by developers when defining applications, and the most obvious tenancy boundary for a developer is that of **the Namespace**. We thus aim to make this boundary **extremely** obvious and easy for users to target in a maximally secure manner.
53+
NetworkPolicies are under utilized by developers when defining applications,
54+
and the most obvious tenancy boundary for a developer is that of **the Namespace**.
55+
We thus aim to make this boundary **extremely** obvious and easy for users
56+
to target in a maximally secure manner.
11357

114-
NetworkPolicies are also used by administrators to make specific default policies (for example, the common `kube-system` namespaces might be one which an administrator wants to protect from unwanted traffic).
58+
NetworkPolicies are also used by administrators to make specific default
59+
policies (for example, the common `kube-system` namespaces might be one which
60+
an administrator wants to protect from unwanted traffic).
11561

116-
Although service-mesh and other technologies have been slated to obviate the need for developer driven security boundaries, these technologies aren't available in most clusters, and aren't supported by the Kubernetes API.
62+
Although service-mesh and other technologies have been slated to obviate the
63+
need for developer driven security boundaries, these technologies aren't
64+
available in most clusters, and aren't supported by the Kubernetes API.
11765

118-
The ability to provide granular and intuitive network boundaries between apps is part of the braoder vision to make the NetworkPolicy API a universal security construct implemented in all production applications. Many conversations have come up around this topic, with https://github.com/kubernetes/kubernetes/issues/88253 being one of the most recent ones.
66+
The ability to provide granular and intuitive network boundaries between apps
67+
is part of the braoder vision to make the NetworkPolicy API a universal
68+
security construct implemented in all production applications. Many
69+
conversations have come up around this topic, with [kubernetes #88253](https://github.com/kubernetes/kubernetes/issues/88253)
70+
being one of the most recent ones.
11971

12072
### Generic motivation
12173

122-
- Embrace the immutable nature of a namespace name as a fundamental security construct in the Kubernetes ecosystem.
123-
- Making network policies more secure by making it impossible to "impersonate" a bespoke namespace.
124-
- Making network policy tenancy boundaries more declarative to use by *not* requiring developers to copy/duplicate namespace labels
74+
- Embrace the immutable nature of a namespace name as a fundamental security
75+
construct in the Kubernetes ecosystem.
76+
- Making network policies more secure by making it impossible to "impersonate"
77+
a bespoke namespace.
78+
- Making network policy tenancy boundaries more declarative to use by *not*
79+
requiring developers to copy/duplicate namespace labels
12580

126-
These two motivating factors are mostly self explanatory, but in the next section we outline concrete feedback in these areas.
81+
These three motivating factors are mostly self explanatory, but in the next
82+
section we outline concrete feedback in these areas.
12783

12884
### Community feedback on the namespace.Name selector
12985

130-
- In 2016, the argument for namespace as name selectors was first made... https://groups.google.com/g/kubernetes-sig-network/c/GzSGt-pxBYQ/m/Rbrxve-gGgAJ, based on the fact that labels can be retroactively added to namespaces pretty easily, even if your namespace isn't intended to be able to send traffic somewhere:
86+
- In 2016, the argument for namespace as name selectors was first made in
87+
the [mailing list](https://groups.google.com/g/kubernetes-sig-network/c/GzSGt-pxBYQ/m/Rbrxve-gGgAJ), based on the fact that labels can be
88+
retroactively added to namespaces pretty easily, even if your namespace isn't
89+
intended to be able to send traffic somewhere:
13190

13291
```
133-
we need to clarify how namespaces are matched. I'm pretty
92+
we need to clarify how namespaces are matched. I'm pretty
13493
uncomfortable with using labels here, since anyone can add labels at
13594
any time to any namespace and thus send traffic to your pod if they
13695
know the label you're using. If it were simply a namespace name, it's
13796
much easier to specifically allow only namespaces you control since you
13897
know your own namespace names.
13998
```
14099

141-
- Another recent argument was made on the basis of targetting namespaces using names, rather then labels, on the basis of **sheer convenience**.
100+
- Another recent argument was made on the basis of targetting namespaces
101+
using names, rather then labels, on the basis of **sheer convenience**.
142102

143103
```
144-
While matching things like pods etc by label is certainly worthwhile, when matching a namespace I suspect the majority of the time you only want to match a single namespace. It been great match against the name rather than just a label. I suspect most people don't think to add labels to the namespaces.
104+
While matching things like pods etc by label is certainly worthwhile, when
105+
matching a namespace I suspect the majority of the time you only want to match
106+
a single namespace. It been great match against the name rather than just a
107+
label. I suspect most people don't think to add labels to the namespaces.
145108
```
146109

147-
The latter comment received 9 likes as a github issue - indiciating the general popularity of this as a request, and that correlates well to feedback we've seen in the broader community as well.
110+
The latter comment received 9 likes as a github issue - indiciating the
111+
general popularity of this as a request, and that correlates well to feedback
112+
we've seen in the broader community as well.
148113

149-
We thus conclude that, even though targetting an object using its name is not normal in K8s, in the case of NetworkPolicies, the overwhelming need for universal, easy to define security boundaries, makes a strong case for amending the API to support a "special" selector for namespace names that is **independent** of labels.
114+
We thus conclude that, even though targetting an object using its name is not
115+
normal in K8s, in the case of NetworkPolicies, the overwhelming need for
116+
universal, easy to define security boundaries, makes a strong case for
117+
amending the API to support a "special" selector for namespace names that is
118+
**independent** of labels.
150119

151120
### Goals
152121

153-
- Add a `namespace` option (which is additive to the current `matchLabels` selector).
154-
- Allow multiple `matchName` values, so that many namespaces can be allowed using the same field
122+
- Add a `namespaceNames` option (which is additive to the current `matchLabels` selector).
123+
- Allow multiple `namespaceNames` values, so that many namespaces can be
124+
allowed using the same field
155125

156126
### Non-Goals
157127

158128
- Support matching of wildcard namespaces
159129
- Changing the internal details of how namespaceSelector works with arbitrary syntax
160-
- Depending on more sophisticated features (like virtual labels) to accomplish this feature without changing the API (note that, if someone were
161-
to write a virtualLabels KEP, however, it might change the trajectory of this KEP, which is worth discussing)
130+
- Depending on more sophisticated features (like virtual labels) to accomplish
131+
this feature without changing the API (note that, if someone were
132+
to write a virtualLabels KEP, however, it might change the trajectory of this
133+
KEP, which is worth discussing)
162134

163135
## Proposal
164136

165137
In NetworkPolicy specification, inside `NetworkPolicyPeer` specify a new `namespaceNames` field.
166138

167-
1) One simple way to implement this feature is to modify the NetworkPolicyPeer object, like so. Since this
168-
doesn't involve modifying a go type (i.e. were not replacing a labelSelector with a different type, we expect it
139+
1) One simple way to implement this feature is to modify the NetworkPolicyPeer
140+
object, like so. Since this doesn't involve modifying a go type (i.e. were
141+
not replacing a labelSelector with a different type, we expect it
169142
to be a cleaner implementation:
170143

171144
```
@@ -182,36 +155,40 @@ type NetworkPolicyPeer struct {
182155

183156
### User Stories (Optional)
184157

185-
<!--
186-
Detail the things that people will be able to do if this KEP is implemented.
187-
Include as much detail as possible so that people can understand the "how" of
188-
the system. The goal here is to make this feel real for users without getting
189-
bogged down.
190-
-->
191-
192158
#### Story 1
193159

194-
As an administrator i want to allow access from monitoring pods in kube-system namespace, into any pod in my cluster, as a fundamental policy.
160+
As an administrator i want to allow access from monitoring pods in kube-system
161+
namespace, into any pod in my cluster, as a fundamental policy.
195162

196163
#### Story 2
197164

198-
As an user I want to "just add" a namespace to my allow list without having to manage the labels which might get added/removed over time from said namespace.
165+
As an user I want to "just add" a namespace to my allow list without having to
166+
manage the labels which might get added/removed over time from said namespace.
199167

200168
### Notes/Constraints/Caveats (Optional)
201169

202170
### Risks and Mitigations
203171

204-
- CNIs may **NOT** choose, initially to support this construct, and dilligent communication with CNI providers will be needed to make sure its widely adopted.
205-
- We need to make sure that hidden defaults don't break the meaning of existing policys, for example:
206-
- if a namespcee name is retrieved by an api client which doesn't yet support it, the client doesnt crash (and the plugin doesnt crash, either).
207-
- if a namespace name policy doesn't exist (is null), then the policy should behave identically to any policy made before this field was added, that is,
208-
- Both "allow all" and "allow none" could be incorrectly interpretted incorrectly, so we need to make sure that plugins not implementing the feature don't get misled by the new data structure.
209-
210-
the `NetworkPolicyPeer` should be as obvious as possible to interpret in a way that is compatible with the semantics of the v1 policy API **before** this feature was added to it.
172+
- CNIs may **NOT** choose, initially to support this construct, and dilligent
173+
communication with CNI providers will be needed to make sure its widely
174+
adopted.
175+
- We need to make sure that hidden defaults don't break the meaning of
176+
existing policys, for example:
177+
- if a namespaece name is retrieved by an api client which doesn't yet
178+
support it, the client doesnt crash (and the plugin doesnt crash, either).
179+
- if a namespace name policy doesn't exist (is null), then the policy should
180+
behave identically to any policy made before this field was added, that is,
181+
- Both "allow all" and "allow none" could be incorrectly interpreted
182+
incorrectly, so we need to make sure that plugins not implementing the feature
183+
don't get misled by the new data structure.
184+
185+
The `NetworkPolicyPeer` should be as obvious as possible to interpret in a way that is compatible with the semantics of the v1 policy API **before** this feature was added to it.
211186

212187
## Design Details
213188

214-
- Add a new selector to the network policy peer data structure which can switch between allowing a "matchName" or "matchLabels" implementation, supporting a policy that is expressed like this:
189+
- Add a new selector to the network policy peer data structure which can
190+
switch between allowing a "namespaceNames" or "matchLabels" implementation,
191+
supporting a policy that is expressed like this:
215192

216193
- A list of conventional namespaces
217194
The "conventional namespaces" will look like so:
@@ -226,42 +203,53 @@ spec:
226203
app: mysql
227204
ingress:
228205
- from:
229-
matchName:
206+
namespaceNames:
230207
- my-frontend
231208
```
232209

233210
### Test Plan
234211

235-
We will add tests for this new api semantic into the exting test/e2e/ network policy test suites in upstream which cover both of these scenarios, using the validation framework outlined in https://github.com/kubernetes/enhancements/blob/master/keps/sig-network/20200204-NetworkPolicy-verification-rearchitecture.md#motivation.
212+
We will add tests for this new api semantic into the exting test/e2e/ network
213+
policy test suites in upstream which cover both of these scenarios, using the
214+
validation framework outlined in https://github.com/kubernetes/enhancements/blob/master/keps/sig-network/20200204-NetworkPolicy-verification-rearchitecture.md#motivation.
236215

237216
### Graduation Criteria
238217

239-
All new field introductions need gates for at least one release, thus, we would add this feature gate in alpha, so we must use
240-
feature gates idiomatically to implement this change.
218+
All new field introductions need gates for at least one release, thus, we
219+
would add this feature gate in alpha, so we must use feature gates
220+
idiomatically to implement this change.
241221

242222
Gone are the days of changing the API with reckless abandon.
243223

244224
#### Alpha
245225
- Communicate CNI providers about the new field.
246-
- Add validation tests in API which confirm several positive / negative scenarios in the test matrix for when this field is present/absent
247-
- All new field introductions need gates for at least one release, thus, we would add this feature gate in alpha.
226+
- Add validation tests in API which confirm several positive / negative
227+
scenarios in the test matrix for when this field is present/absent
228+
- All new field introductions need gates for at least one release, thus, we
229+
would add this feature gate in alpha.
248230

249231

250232
#### Beta
251233
- The name selector has been supported for at least 1 minor release.
252-
- Four commonly used NetworkPolicy (or CNI providers) implement the new field, with generally positive feedback on its usage.
234+
- Four commonly used NetworkPolicy (or CNI providers) implement the new field,
235+
with generally positive feedback on its usage.
253236
- Feature Gate is enabled by Default.
254237

255238
#### GA Graduation
256239

257-
- At least **four** NetworkPolicy providers (or CNI providers) support the The name selector field.
240+
- At least **four** NetworkPolicy providers (or CNI providers) support the The
241+
name selector field.
258242
- The name selector has been enabled by default for at least 1 minor release.
259243

260244
### Upgrade / Downgrade Strategy
261245

262-
If upgraded no impact should happen as this is a new matching option and not colliding with old ones. There will potentially be some golang magic required to convert objects at the type level to be flexible enough to support different inputs, but this will use the K8s API Translation layer.
246+
If upgraded no impact should happen as this is a new matching option and not
247+
colliding with old ones. There will potentially be some golang magic required
248+
to convert objects at the type level to be flexible enough to support
249+
different inputs, but this will use the K8s API Translation layer.
263250

264-
If downgraded the CNI wont be able to look into the new field, as this does not exists and network policies using this field will stop working.
251+
If downgraded the CNI wont be able to look into the new field, as this does
252+
not exists and network policies using this field will stop working.
265253

266254
### Version Skew Strategy
267255

@@ -285,7 +273,8 @@ _This section must be completed when targeting alpha to a release._
285273
Yes, but CNIs relying on the new field wont recognize it anymore
286274

287275
* **What happens if we reenable the feature if it was previously rolled back?**
288-
Nothing. Just need to check if the data is persisted in ``etcd`` after the feature is disabled and reenabled or if the data is missed
276+
Nothing. Just need to check if the data is persisted in ``etcd`` after the
277+
feature is disabled and reenabled or if the data is missed
289278

290279
* **Are there any tests for feature enablement/disablement?**
291280

@@ -311,18 +300,7 @@ the health of the service?**
311300
_This section must be completed when targeting beta graduation to a release._
312301

313302
* **Does this feature depend on any specific services running in the cluster?**
314-
Think about both cluster-level services (e.g. metrics-server) as well
315-
as node-level agents (e.g. specific version of CRI). Focus on external or
316-
optional services that are needed. For example, if this feature depends on
317-
a cloud provider API, or upon an external software-defined storage or network
318-
control plane.
319-
320-
For each of these, fill in the following—thinking about running existing user workloads
321-
and creating new ones, as well as about cluster-level services (e.g. DNS):
322-
- [Dependency name]
323-
- Usage description:
324-
- Impact of its outage on the feature:
325-
- Impact of its degraded performance or high-error rates on the feature:
303+
No
326304

327305
## Implementation History
328306

0 commit comments

Comments
 (0)