Skip to content

Commit f050c2b

Browse files
authored
Added deads review comments
1 parent 9815e57 commit f050c2b

File tree

1 file changed

+7
-7
lines changed
  • keps/sig-api-machinery/2161-apiserver-default-labels

1 file changed

+7
-7
lines changed

keps/sig-api-machinery/2161-apiserver-default-labels/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ cases, that namespaces have a default label, thereby leveraging existing
8686
functionalities offered by label selectors.
8787

8888
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
9090
definition would be most easily referenced by a default label.
9191

9292
### Goals
@@ -108,7 +108,7 @@ the namespace's name with traditional label selector mechanisms.
108108

109109
- If this label is missing, it is added by the apiserver as a default.
110110
- 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.
112112
- api clients always see this default label, because of this mutation.
113113

114114

@@ -118,10 +118,9 @@ the namespace's name with traditional label selector mechanisms.
118118

119119
NetworkPolicies allow users to open up traffic to/from their namespaces with the help of `namespaceSelector` field.
120120
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.
125124

126125
#### Lack of permissions
127126

@@ -136,6 +135,7 @@ able to select a single namespace to enforce those controllers. Similarly, it is
136135
users to remember the names of the namespaces rather than labels associated with those namespaces while defining
137136
NetworkPolicies or writing admission controller configurations.
138137

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.
139139

140140
### Notes/Constraints/Caveats (Optional)
141141

@@ -381,7 +381,7 @@ need for new API semantics in the networkpolicy specification, which is already
381381

382382
For example, you may need a way to declare namespaceAsName selectors, which is distinct from namespace label selectors.
383383
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.
385385

386386
This is thoroughly debated in the [KEP](https://github.com/kubernetes/enhancements/issues/2112). Fail-closed is a requirement.
387387

0 commit comments

Comments
 (0)