Skip to content

Commit 3a9799e

Browse files
committed
update PRR & test plan contents
1 parent ab8d240 commit 3a9799e

File tree

1 file changed

+47
-9
lines changed
  • keps/sig-auth/4193-bound-service-account-token-improvements

1 file changed

+47
-9
lines changed

keps/sig-auth/4193-bound-service-account-token-improvements/README.md

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@
4545

4646
Items marked with (R) are required *prior to targeting to a milestone / release*.
4747

48-
- [ ] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
49-
- [ ] (R) KEP approvers have approved the KEP status as `implementable`
50-
- [ ] (R) Design details are appropriately documented
51-
- [ ] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors)
48+
- [x] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
49+
- [x] (R) KEP approvers have approved the KEP status as `implementable`
50+
- [x] (R) Design details are appropriately documented
51+
- [x] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors)
5252
- [ ] e2e Tests for all Beta API Operations (endpoints)
5353
- [ ] (R) Ensure GA e2e tests meet requirements for [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md)
5454
- [ ] (R) Minimum Two Week Window for GA e2e tests to prove flake free
55-
- [ ] (R) Graduation criteria is in place
55+
- [x] (R) Graduation criteria is in place
5656
- [ ] (R) [all GA Endpoints](https://github.com/kubernetes/community/pull/1806) must be hit by [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md)
5757
- [ ] (R) Production readiness review completed
5858
- [ ] (R) Production readiness review approved
@@ -219,7 +219,7 @@ when drafting this test plan.
219219
[testing-guidelines]: https://git.k8s.io/community/contributors/devel/sig-testing/testing.md
220220
-->
221221

222-
[ ] I/we understand the owners of the involved components may require updates to
222+
[x] I/we understand the owners of the involved components may require updates to
223223
existing tests to make this code solid enough prior to committing the changes necessary
224224
to implement this enhancement.
225225

@@ -232,17 +232,34 @@ implementing this enhancement to ensure the enhancements have also solid foundat
232232

233233
##### Unit tests
234234

235+
`pkg/registry/core/serviceaccount/storage`:
236+
* Coverage before (`release-1.28`): `k8s.io/kubernetes/pkg/registry/core/serviceaccount/storage 8.354s coverage: 10.7% of statements`
237+
* Coverage after: `k8s.io/kubernetes/pkg/registry/core/serviceaccount/storage 8.394s coverage: 8.7% of statements`
238+
* Test ensuring audit annotations are added to audit events for the `serviceaccounts/<name>/token` subresource.
239+
* Tests verifying it's possible to bind a token to a Node object.
240+
* Tests ensuring tokens bound to pod objects also embed associated node metadata.
241+
* NOTE: the majority of this file is untested with *unit tests* (instead, using integration tests). [#121515](https://github.com/kubernetes/kubernetes/issues/121515).
242+
235243
`staging/src/k8s.io/apiserver/pkg/authentication/serviceaccount`:
244+
* Coverage before (`release-1.28`): `k8s.io/apiserver/pkg/authentication/serviceaccount 0.567s coverage: 60.8% of statements`
245+
* Coverage after: `k8s.io/apiserver/pkg/authentication/serviceaccount 0.569s coverage: 70.1% of statements`
236246
* Test ensuring that service account info (JTI, node name and UID) is correctly extracted from a presented JWT.
237247
* Tests to ensure the information is NOT extracted when the feature gate is disabled.
238248

239249
`pkg/serviceaccount`:
250+
* Coverage before (`release-1.28`): `k8s.io/kubernetes/pkg/serviceaccount 0.755s coverage: 72.4% of statements`
251+
* Coverage after: `k8s.io/kubernetes/pkg/serviceaccount 0.786s coverage: 72.7% of statements`
240252
* Extending tests to ensure Node info is embedded into extended claims (name and uid)
241253
* Tests to ensure `ID`/`JTI` field is always set to a random UUID.
242254
* Tests to ensure the info embedded on a JWT is extracted from the token and into the ServiceAccountInfo when
243255
a token is validated.
244256
* Tests to ensure the information is NOT embedded or extracted when the feature gate is disabled.
245257

258+
`staging/src/k8s.io/kubectl/pkg/cmd/create`:
259+
* Coverage before (`release-1.28`): `k8s.io/kubectl/pkg/cmd/create 0.995s coverage: 55.1% of statements`
260+
* Coverage after: `k8s.io/kubectl/pkg/cmd/create 0.949s coverage: 55.2% of statements`
261+
* Add tests ensuring it's possible to request a token that is bound to a Node object (gated by environment variable during alpha)
262+
246263
<!--
247264
In principle every added code should have complete unit test coverage, so providing
248265
the exact set of tests will not bring additional value.
@@ -370,8 +387,12 @@ you need any help or guidance.
370387
* `ServiceAccountTokenNodeBindingValidation` feature flag will toggle the apiserver validating Node claims in node bound service account tokens.
371388
* `ServiceAccountTokenNodeBinding` feature flag will toggle allowing service account tokens to be bound to Node objects.
372389

373-
The `ServiceAccountTokenNodeBindingValidation` feature will graduate to beta one release earlier than `ServiceAccountTokenNodeBinding`
374-
to ensure a safe rollback from version N+1 to N (more info below in rollback considerations section).
390+
The `ServiceAccountTokenNodeBindingValidation` feature will graduate to beta in version v1.30, a release earlier than `ServiceAccountTokenNodeBinding`
391+
to ensure a safe rollback from version v1.31 to v1.30 (more info below in rollback considerations section).
392+
393+
The `ServiceAccountTokenNodeBinding` feature gate must only be enabled once the `ServiceAccountTokenNodeBindingValidation` feature has been enabled.
394+
Disabling the `ServiceAccountTokenNodeBindingValidation` feature whilst keeping `ServiceAccountTokenNodeBinding` would allow tokens that are expected to
395+
be bound to the lifetime of a particular Node to validate even if that Node no longer exists.
375396

376397
All other feature flags can be disabled without any unexpected adverse affects or coordination required.
377398

@@ -424,7 +445,8 @@ The `ServiceAccountTokenNodeBindingValidation` feature gate should be enabled an
424445
any server.
425446

426447
The `ServiceAccountTokenNodeBindingValidation` will be defaulted to on one release **before** `ServiceAccountTokenNodeBinding`
427-
to account for this.
448+
to account for this. Concretely, `ServiceAccountTokenNodeBindingValidation` will be enabled by default in v1.30 and
449+
`ServiceAccountTokenNodeBinding` will be enabled by default in v1.31.
428450

429451
This should not have any issues/affect during upgrades.
430452
Rollback is done by removing/disabling the feature gate(s).
@@ -442,6 +464,10 @@ To help avoid this, the feature will be graduated in two phases:
442464

443465
This allows for a safe rollback in which the same security expectations are enforced once a token has been issued.
444466

467+
If a user explicitly *disables* `ServiceAccountTokenNodeBindingValidation` but keeps `ServiceAccountTokenNodeBinding` enabled,
468+
the node claims in the issued tokens will not be properly validated. This configuration will be explicitly denied by the
469+
kube-apiserver and will cause it to exit on startup.
470+
445471
###### What specific metrics should inform a rollback?
446472

447473
* `authentication_attempts`
@@ -603,8 +629,20 @@ For each of them, fill in the following information by copying the below templat
603629

604630
###### What steps should be taken if SLOs are not being met to determine the problem?
605631

632+
After observing an issue (e.g. uptick in denied authentication requests or a significant shift in any metrics added for this KEP),
633+
kube-apiserver logs from the authenticator may be used to debug.
634+
635+
Additionally, manually attempting to exercise the affected codepaths would surface information that'd aid debugging.
636+
For example, attempting to issue a node bound token, or attempting to authenticate to the apiserver using a node bound token.
637+
606638
## Implementation History
607639

640+
* KEP marked implementable and merged for the v1.29 release
641+
* KEP implemented in an alpha state for v1.29
642+
* Renamed audit annotation used for the `serviceaccounts/<name>/token` endpoint to be clearer: https://github.com/kubernetes/kubernetes/pull/123098
643+
* Added restrictions to disallow enabling `ServiceAccountTokenNodeBinding` without `ServiceAccountTokenNodeBindingValidation`: https://github.com/kubernetes/kubernetes/pull/123135
644+
* `ServiceAccountTokenJTI`, `ServiceAccountTokenNodeBindingValidation` and `ServiceAccountTokenPodNodeInfo` promoted to beta for v1.30 release
645+
608646
<!--
609647
Major milestones in the lifecycle of a KEP should be tracked in this section.
610648
Major milestones might include:

0 commit comments

Comments
 (0)