Skip to content

Commit 43ceaed

Browse files
authored
Merge pull request #4157 from yt2985/kep
Revise KEP 2799-reduction-of-secret-based-service-account-token for LegacyServiceaccountTokenCleanup feature.
2 parents 6f435a9 + a4c5ca8 commit 43ceaed

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

keps/sig-auth/2799-reduction-of-secret-based-service-account-token/README.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ tokens which are [less secure than the bound token](https://github.com/kubernete
122122
2. Emit warnings when using auto-generated token secrets.
123123
3. Add pointers of TokenRequest API and manually created tokens in the validation
124124
result.
125+
4. Marked the auto-generated tokens as invalid if they are not used for more
126+
than the duration configured by `--legacy-service-account-token-clean-up-period`
127+
(one year by default). And allow the users to re-activate the invalid
128+
auto-generated tokens within the duration of `--legacy-service-account-token-clean-up-period`
129+
before the tokens are finally deleted.
125130

126131
## Design Details
127132

@@ -154,7 +159,7 @@ indicates if tracking is enabled in the cluster. It is similar to the existing
154159
Token Controller starts to remove unused auto-generated secrets (secrets
155160
bi-directionally referenced by the service account) and not mounted by pods.
156161

157-
When this feature is Beta and enabled by default, delete secrets iff it is over
162+
When this feature is Beta and enabled by default, mark the secrets as invalid iff it is over
158163
a sufficient period of time (one year by default) since last used. The period
159164
can be configured by cluster admins.
160165

@@ -165,6 +170,18 @@ Determine the date that a given secret was last used:
165170

166171
If `kube-apiserver-legacy-service-account-token-tracking` is unavailable, no secret would be removed.
167172

173+
Mark the secrets as invalid and recover:
174+
175+
1. The secrets will be added a label `kubernetes.io/legacy-token-invalid-since`, with the date as value.
176+
2. If the users use the invalid tokens, in the Validate() function of
177+
"kubernetes/pkg/serviceaccount/legacy.go", it will detect the usage of
178+
invalid tokens and return the error information, telling the users to
179+
re-activate the token by updating the label value or use the tokenrequest. At
180+
the same time, the tokens will be updated with the new `kubernetes.io/legacy-token-last-used` date.
181+
3. If the users don't use the invalid tokens, after the duration configured
182+
through `--legacy-service-account-token-clean-up-period` (one year by default)
183+
since the tokens are marked as invalid, the tokens will be finally deleted.
184+
168185
### Test Plan
169186

170187
[X] I/we understand the owners of the involved components may require updates to

keps/sig-auth/2799-reduction-of-secret-based-service-account-token/kep.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ reviewers:
1313
approvers:
1414
- "@liggitt"
1515
stage: beta
16-
latest-milestone: "v1.28"
16+
latest-milestone: "v1.29"
1717
milestone:
1818
beta: "v1.24"
1919
stable: "v1.26"

0 commit comments

Comments
 (0)