Skip to content

Commit f19fe4d

Browse files
committed
Resolve lmktfy's comment
Signed-off-by: Jian Qiu <[email protected]>
1 parent d80baa4 commit f19fe4d

File tree

2 files changed

+31
-34
lines changed

2 files changed

+31
-34
lines changed

keps/sig-auth/5284-constrained-impersonation/README.md

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ the certain name/namespace. The resources must be `serviceaccounts`.
201201
- `impersonate:scheduled-node` that limits the impersonator to impersonate the node the
202202
impersonator is running on. The resources must be `nodes`.
203203

204-
For the imperonsonator, two permissions will be required:
205-
204+
For clusters that use RBAC authz mode, two permissions will be required for impersonation. For example:
206205
1. The permission to impersonate a certain user. This is a cluster scoped
207206
permission.
208207
```yaml
@@ -394,7 +393,7 @@ metadata:
394393
name: impersonate-user
395394
rules:
396395
- apiGroups:
397-
- auhtentications.k8s.io
396+
- authentications.k8s.io
398397
resources:
399398
- users
400399
verbs:
@@ -672,15 +671,15 @@ This can be done with:
672671
- a search in the Kubernetes bug triage tool (https://storage.googleapis.com/k8s-triage/index.html)
673672
-->
674673

675-
- SAR check on impersonate user with permission:
674+
- SubjectAccessReview check on impersonating user. For RBAC authz mode, this might look like:
676675
```yaml
677676
apiVersion: rbac.authorization.k8s.io/v1
678677
kind: ClusterRole
679678
metadata:
680679
name: impersonate-user
681680
rules:
682681
- apiGroups:
683-
- auhtentications.k8s.io
682+
- authentications.k8s.io
684683
resources:
685684
- users
686685
resourceNames:
@@ -715,7 +714,7 @@ metadata:
715714
name: impersonate-user
716715
rules:
717716
- apiGroups:
718-
- auhtentications.k8s.io
717+
- authentications.k8s.io
719718
resources:
720719
- nodes
721720
verbs:
@@ -744,20 +743,8 @@ rules:
744743
745744
##### e2e tests
746745
747-
<!--
748-
This question should be filled when targeting a release.
749-
For Alpha, describe what tests will be added to ensure proper quality of the enhancement.
750-
751-
For Beta and GA, document that tests have been written,
752-
have been executed regularly, and have been stable.
753-
This can be done with:
754-
- permalinks to the GitHub source code
755-
- links to the periodic job (typically a job owned by the SIG responsible for the feature), filtered by the test name
756-
- a search in the Kubernetes bug triage tool (https://storage.googleapis.com/k8s-triage/index.html)
757-
758-
We expect no non-infra related flakes in the last month as a GA graduation criteria.
759-
If e2e tests are not necessary or useful, explain why.
760-
-->
746+
This feature is fully tested with unit and integration tests. An eventual conformance
747+
test is needed as part of GA
761748
762749
- [test name](https://github.com/kubernetes/kubernetes/blob/2334b8469e1983c525c0c6382125710093a25883/test/e2e/...): [SIG ...](https://testgrid.k8s.io/sig-...?include-filter-by-regex=MyCoolFeature), [triage search](https://storage.googleapis.com/k8s-triage/index.html?test=MyCoolFeature)
763750
@@ -800,11 +787,11 @@ Below are some examples to consider, in addition to the aforementioned [maturity
800787
- Determine if additional tests are necessary
801788
- Ensure reliability of existing tests
802789

803-
804790
#### GA
805791

806792
- At least one successful adoption of each user story (node agent and deputy).
807793
- All bugs resolved and no new bugs requiring code change since the previous shipped release.
794+
- Conformance tests are added.
808795

809796
### Upgrade / Downgrade Strategy
810797

@@ -821,7 +808,7 @@ enhancement:
821808
-->
822809

823810
On upgrade to a version that enables the feature
824-
* the previous inpersonator with impersonate permission will still work, but it is highly
811+
* the previous impersonator with impersonate permission will still work, but it is highly
825812
recommanded to use the new permissions with less privilege.
826813

827814

@@ -894,7 +881,7 @@ No. Impersonator with existing impersonate permission will still be allowed to i
894881

895882
###### Can the feature be disabled once it has been enabled (i.e. can we roll back the enablement)?
896883

897-
Yes. Set the FeatureGate to false and restart the kube-apiserver.
884+
Yes. Set the feature gate to false and restart the kube-apiserver.
898885

899886
###### What happens if we reenable the feature if it was previously rolled back?
900887

@@ -935,6 +922,8 @@ What signals should users be paying attention to when the feature is young
935922
that might indicate a serious problem?
936923
-->
937924

925+
Authz latency for impersonation is too long.
926+
938927
###### Were upgrade and rollback tested? Was the upgrade->downgrade->upgrade path tested?
939928

940929
<!--
@@ -960,7 +949,11 @@ For GA, this section is required: approvers should be able to confirm the
960949
previous answers based on experience in the field.
961950
-->
962951

963-
None
952+
There are existing metrics to record authz latency and request number:
953+
- authorization latency
954+
- authorization success
955+
- webhook authorizer match condition latency
956+
- webhook authorizer match condition success
964957

965958
###### How can an operator determine if the feature is in use by workloads?
966959

@@ -1026,6 +1019,8 @@ implementation difficulties, etc.).
10261019
There are already metrics for the layers this feature is adding to:
10271020
- authorization latency
10281021
- authorization success
1022+
- webhook authorizer match condition latency
1023+
- webhook authorizer match condition success
10291024

10301025
### Dependencies
10311026

@@ -1119,7 +1114,12 @@ Think about adding additional work or introducing new steps in between
11191114
[existing SLIs/SLOs]: https://git.k8s.io/community/sig-scalability/slos/slos.md#kubernetes-slisslos
11201115
-->
11211116

1122-
It will introduce one additional access review check for request with impersonation.
1117+
The existing impersonation mechanism will introduce 1 access review for request with impersonation. While upon
1118+
feature is enabled:
1119+
- When the check is passed, it will introduce 2-3 access review checks for request with impersonation.
1120+
- 2 access review check if the new access rule is passed.
1121+
- 3 access review check if the new access rule is not passed, and the legacy impersonate access rule is passed.
1122+
- When the check is disallowed, it will introduce 3 access review checks for request with impersonation.
11231123

11241124
###### Will enabling / using this feature result in non-negligible increase of resource usage (CPU, RAM, disk, IO, ...) in any components?
11251125

@@ -1194,17 +1194,15 @@ Major milestones might include:
11941194

11951195
## Drawbacks
11961196

1197-
<!--
1198-
Why should this KEP _not_ be implemented?
1199-
-->
1197+
- Several additional authorization checks are added introducing some overhead.
12001198

12011199
## Alternatives
12021200

12031201
### Subject Access Review
12041202

12051203
The controller can sends a SAR request, and then uses its own permission to perform the action.
12061204
The main difference from impersonation is:
1207-
1. the controller itself needs to have the permission for a certain action, while with impersonataion
1205+
1. the controller itself needs to have the permission for a certain action, while with impersonation
12081206
the controller does not need these permissions, but the permissions to `impersonate-on` certain action.
12091207
2. The audit log shows that controller performs the action, while with impersonatation audit log
12101208
shows controller is impersonating and the target user performs the action.
@@ -1214,11 +1212,11 @@ is running against the target user.
12141212
### Setting a special APIGroup suffix instead of special verb
12151213

12161214
Instead of using a verb with prefix `impersonate-on:`, a special apigroup suffix/prefix can be set for
1217-
each resource to be impersonated, e.g.
1215+
each resource to be impersonated, e.g. setting the apigroup with a suffix of `.impersonation.k8s.io`:
12181216

12191217
```yaml
12201218
- apiGroups:
1221-
- apps.imperonsation.k8s.io
1219+
- apps.impersonation.k8s.io
12221220
resources:
12231221
- deployments
12241222
verbs:
@@ -1229,7 +1227,7 @@ each resource to be impersonated, e.g.
12291227
It is almost the same as the verb based approach in the proposal. However, since existing impersonation flows are
12301228
verb based, so making the new flow verb based as well feels more consistent.
12311229

1232-
### Check permission intersaction of impersonator and target user
1230+
### Check permission intersection of impersonator and target user
12331231

12341232
This is an approach to check intersected permission of the impersonator and the target user, and
12351233
only allow the action if both have the correct permission. Comparing to the proposed approach:
@@ -1258,7 +1256,7 @@ One example is
12581256
"group version": "example.org/v1",
12591257
"name": "elevation-of-privilege"
12601258
},
1261-
"user": "lmktfy",
1259+
"user": "impersonator",
12621260
"group": []
12631261
]
12641262
}

keps/sig-auth/5284-constrained-impersonation/kep.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,3 @@ disable-supported: true
4242

4343
# The following PRR answers are required at beta release
4444
metrics:
45-
- my_feature_metric

0 commit comments

Comments
 (0)