You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: keps/sig-api-machinery/2161-apiserver-default-labels/README.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,7 +86,7 @@ cases, that namespaces have a default label, thereby leveraging existing
86
86
functionalities offered by label selectors.
87
87
88
88
There may also be many other usecases where the security or permissions boundary
89
-
might be conveniently defined in terms of a namepsace name, and that such a
89
+
might be conveniently defined in terms of a namepsace name, and that such a namespace
90
90
definition would be most easily referenced by a default label.
91
91
92
92
### Goals
@@ -108,7 +108,7 @@ the namespace's name with traditional label selector mechanisms.
108
108
109
109
- If this label is missing, it is added by the apiserver as a default.
110
110
- If this label is deleted, it is added by the apiserver as a default.
111
-
- defaults.go mutates namespaces on read, to always have the label `kubernetes.io/metadata.name=obj.Name`.
111
+
- defaults.go mutates namespaces on read, to always have the label `kubernetes.io/metadata.name=obj.Name`, this effectively means a mutation would be an allowed no-op, since the apiserver would always overwrite the value of this field.
112
112
- api clients always see this default label, because of this mutation.
113
113
114
114
@@ -118,10 +118,9 @@ the namespace's name with traditional label selector mechanisms.
118
118
119
119
NetworkPolicies allow users to open up traffic to/from their namespaces with the help of `namespaceSelector` field.
120
120
However, there is a concern that arbitrary labels may not be the most secure way to open up traffic when it comes
121
-
to namespace resource. In case a namespace's labels are known by others, any user can add labels at any time to any
122
-
namespace and thus send traffic to a pod belonging to this namespace. Matching a namespace by its name, on the other
123
-
hand, is a more reliable way to whitelist namespaces as it's much easier to specifically allow only namespaces user
124
-
control since user knows their own namespace names.
121
+
to namespace resource. In case a namespace's labels are known by others, any user with wrote access to a namespace can add labels at any time to said namespace, and thus send traffic to a pod belonging to this namespace.
122
+
123
+
Matching a namespace by its name, on the other hand, is a more reliable way to whitelist namespaces as it's much easier to specifically allow only namespaces user control since user knows their own namespace names.
125
124
126
125
#### Lack of permissions
127
126
@@ -136,6 +135,7 @@ able to select a single namespace to enforce those controllers. Similarly, it is
136
135
users to remember the names of the namespaces rather than labels associated with those namespaces while defining
137
136
NetworkPolicies or writing admission controller configurations.
138
137
138
+
Thus, regardless of wether such a user story is valid, it is clearly 'simpler' to implement (as are other similar stories) when a default mechanism for namespace selection is available.
139
139
140
140
### Notes/Constraints/Caveats (Optional)
141
141
@@ -381,7 +381,7 @@ need for new API semantics in the networkpolicy specification, which is already
381
381
382
382
For example, you may need a way to declare namespaceAsName selectors, which is distinct from namespace label selectors.
383
383
Introducing a new field has its own drawbacks: The obvious API, when combined with a podSelector, decreases security
384
-
of a pod - an old client would be more open than users would expect them to be.
384
+
of a pod - an old client would be more open than users would expect them to be (in the most obvious implementations). We note that there are workarounds involving special "always off" selectors, which can avoid this scenario, but they come with their own obvious inherent technical debt and costs.
385
385
386
386
This is thoroughly debated in the [KEP](https://github.com/kubernetes/enhancements/issues/2112). Fail-closed is a requirement.
0 commit comments