Skip to content

Commit 37eb843

Browse files
committed
Address review comments
Signed-off-by: Rita Zhang <[email protected]>
1 parent 0438bc7 commit 37eb843

File tree

1 file changed

+28
-20
lines changed
  • keps/sig-auth/3221-structured-authorization-configuration

1 file changed

+28
-20
lines changed

keps/sig-auth/3221-structured-authorization-configuration/README.md

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,13 @@ is unreachable.
8888
- Define a configuration file format for configuring Kubernetes API Server
8989
Authorization chain.
9090
- Allow ordered definition of authorization modes.
91-
- Allow definition of multiple webhooks in the authorization chain.
91+
- Allow definition of multiple webhooks in the authorization chain while all
92+
other types of authorizers should only be specified once.
9293
- Allow resource/user based pre-filtering of webhooks using CEL to prevent unnecessary
9394
invocations.
9495
- Enable user to define the policy when a webhook can't be reached due to
9596
network errors etc.
96-
- Enable hot reload of the configuration.
97+
- Enable automatic reload of the configuration.
9798

9899
### Non-Goals
99100

@@ -187,11 +188,9 @@ authorizers:
187188
# only intercept requests to kube-system (assumption i)
188189
- expression: request.resourceAttributes.namespace == 'kube-system'
189190
# don't intercept requests from kube-system service accounts
190-
- expression: !('system:serviceaccounts:kube-kube-superuser' in request.user.groups)
191-
# only intercept update, delete and deletecollection requests
192-
- expression: request.resourceAttributes.verb == 'update'
193-
- expression: request.resourceAttributes.verb == 'delete'
194-
- expression: request.resourceAttributes.verb == 'deletecollection'
191+
- expression: !('system:serviceaccounts:kube-system' in request.user.groups)
192+
# only intercept update, delete or deletecollection requests
193+
- expression: request.resourceAttributes.verb in ['update', 'delete','deletecollection']
195194
- type: Node
196195
- type: RBAC
197196
```
@@ -252,7 +251,7 @@ authorizers:
252251
#### Story 3: Denying requests on certain scenarios
253252

254253
The authorizer chain should be powerful enough to deny anyone making a request
255-
if certain conditions are satisfied.
254+
if certain conditions are satisfied, except for the `system:masters` user group.
256255

257256
#### Story 4: Controlling access of a privileged RBAC role
258257

@@ -298,7 +297,8 @@ The configuration would be validated at startup and the API server will fail to
298297
start if the configuration is invalid.
299298

300299
The API server will periodically reload the configuration at a specific time
301-
interval. If it changes, the new configuration will be used for the Authorizer
300+
interval. If it or any of referenced files change, and the new configuration
301+
passes validation, then the new configuration will be used for the Authorizer
302302
chain. The reloader will also check if the webhook is healthy, thereby
303303
preventing any typo/misconfiguration with the Webhook resulting in bad
304304
Authorizer config. If healthcheck on the webhook failed, the last known good
@@ -322,10 +322,10 @@ authorizers:
322322
# Name used to describe the webhook
323323
# This is explicitly used in monitoring machinery for metrics
324324
# Note:
325-
# - Do exercise caution when setting the value
326325
# - If not specified, the default would be set to ""
327326
# - If there are multiple webhooks in the authorizer chain,
328327
# this field is required
328+
# - Validation for this field is similar to how K8s labels are validated today.
329329
name: super-important-kube-system-authorizer
330330
# The duration to cache 'authorized' responses from the webhook
331331
# authorizer.
@@ -373,11 +373,11 @@ authorizers:
373373
# There are a maximum of 64 match conditions allowed.
374374
#
375375
# The exact matching logic is (in order):
376-
# 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.
377-
# 2. If ALL matchConditions evaluate to TRUE, the webhook is called.
378-
# 3. If any matchCondition evaluates to an error (but none are FALSE):
379-
# - If failurePolicy=Deny, reject the request
380-
# - If failurePolicy=NoOpinion, the error is ignored and the webhook is skipped
376+
# 1. If at least one matchCondition evaluates to FALSE, then the webhook is skipped.
377+
# 2. If ALL matchConditions evaluate to TRUE, then the webhook is called.
378+
# 3. If at least one matchCondition evaluates to an error (but none are FALSE):
379+
# - If failurePolicy=Deny, then the webhook rejects the request
380+
# - If failurePolicy=NoOpinion, then the error is ignored and the webhook is skipped
381381
matchConditions:
382382
# expression represents the expression which will be evaluated by CEL. Must evaluate to bool.
383383
# CEL expressions have access to the contents of the SubjectAccessReview
@@ -405,7 +405,7 @@ authorizers:
405405
```
406406
407407
Validation will allow multiple authorizers of type "Webhook" to be added to the
408-
config, but one authorizer each for other types. The ordering of this chain will
408+
config, but at most one authorizer each for other types. The ordering of this chain will
409409
be decided by the order specified in the file.
410410
411411
The keys `kubeConfigFile`, `authorizedTTL`, `unauthorizedTTL` and
@@ -425,11 +425,11 @@ to a `request` variable containing a `SubjectAccessReview` object in the version
425425
by `subjectAccessReviewVersion`.
426426

427427
When no matchConditions are satisfied for a request, the webhook would be skipped. In such
428-
situations, the decision is logged in the audit log with the `webhook_skipped` annotation.
428+
situations, the decision is logged in the audit log with the `webhookskipped.k8s.io` annotation.
429429
Benefit of this is that resource and user info will also be logged.
430430

431-
The code path for enabling the above will only be triggered if the feature flag is enabled until
432-
the feature flag is removed and this feature graduates to GA.
431+
The code path for enabling the above will only be triggered if the feature flag is enabled
432+
while the feature is in alpha and beta.
433433

434434
### Monitoring
435435

@@ -445,7 +445,9 @@ Labels {along with possible values}:
445445
- `decision` {Allow, Deny}
446446

447447
**Note:** Some examples of <authorizer_name>: `RBAC`, `Node`, `ABAC`, `webhook{,_<name>}`.
448-
If there is only one webhook, there would be no `_<name>` suffix.
448+
If there is only one webhook and no name specified, there would be no `_<name>` suffix.
449+
If the webhook has a named specified, even if there is only one webhook, then the name
450+
should be in the metrics and exposed via the metrics endpoint.
449451

450452
2. `apiserver_authorization_webhook_evaluations_total`
451453

@@ -515,6 +517,9 @@ authorization configuration file (feature flag turned on)
515517
- with a webhook - successful request
516518
- with a webhook - error on request with `failurePolicy: Deny`
517519
- with a webhook - error on request with `failurePolicy: NoOpinion`
520+
- Automatic reload periodically checks for changes in the configuration
521+
and validates the new configuration and ensures the webhook is healthy
522+
before the new config can be used.
518523

519524
There will be a mix and match of various authorization mechanisms to ensure all
520525
desired functionality works.
@@ -610,6 +615,9 @@ command line flags should return an error.
610615
A rollout can fail when the authorization configuration file being passed doesn't
611616
exist or is invalid.
612617

618+
A rollback can fail if the admins failed to set the existing command line flag
619+
`--authorization-webhook-*`.
620+
613621
Already running workloads won't be impacted but cluster users won't be able to
614622
access the control plane if the cluster is single-node.
615623

0 commit comments

Comments
 (0)