Add limit to the TokenRequest expiration time#63653
Add limit to the TokenRequest expiration time#63653k8s-github-robot merged 1 commit intokubernetes:masterfrom
Conversation
f69720e to
ff1e95b
Compare
|
/test pull-kubernetes-integration |
|
@mikedanese PTAL |
There was a problem hiding this comment.
I'm not sure if this is useful to configure. I would suggest leaving the command line option out until people ask for it.
ff1e95b to
57cfbaa
Compare
|
@mikedanese WDYT this time |
|
@mikedanese friendly ping |
There was a problem hiding this comment.
This doesn't need to be plumbed through if the value is static.
There was a problem hiding this comment.
static validation should occur in pkg/apis/authentication/validation
There was a problem hiding this comment.
can you call this service-account-token-max-expiration and give it a type of pflag.Duration:
|
I'd suggest only implementing maximum in this PR. How can we also enforce this maximum on the service account token volume projection? |
|
if you request over the max, do you get rejected or truncated to the max? if you get rejected, that means any pod spec that specifies a max is non-portable. |
|
From my point of view, we can simply do like other projected-volume did. In other words, we don't need special process here, the api-server would refuse the TokenRequest and the pod would be stuck at ContainerCreating stage with "expiration time out of range" warning.
|
|
@liggitt I think we can add support of percent expiration-time.
|
what are the reasons someone would request a specific validity period? requesting a percentage of an unknown period doesn't make sense to me. |
|
I suggest we do none configurable hard validation as in #63999 and do a configurable soft validation. i.e. we should add a flag |
|
@mikedanese I think for lower bound, none configurable hard validation is reasonable. Maybe we can do like this, user can't request a token with expiration time lower than 10minutes, its hard validation and non-configurable. For upper bound, if it is configured, any larger request would be truncated into max value. If it is not configured, there's no upper bound on expiration time. |
57cfbaa to
94b4a87
Compare
c7f9618 to
eb05913
Compare
|
@liggitt @mikedanese test added, PTAL |
cmd/kube-apiserver/app/server.go
Outdated
There was a problem hiding this comment.
if non-zero, should verify this is:
>=the default value (1 hour)<=the max value (2^32 seconds)
12c943e to
30b99bd
Compare
|
/test pull-kubernetes-e2e-gce |
|
@liggitt done PTAL |
cmd/kube-apiserver/app/server.go
Outdated
cmd/kube-apiserver/app/server.go
Outdated
There was a problem hiding this comment.
lowBound := time.Hour would be simpler
cmd/kube-apiserver/app/server.go
Outdated
There was a problem hiding this comment.
upBound := time.Duration(1<<32) * time.Second would be simpler
|
@liggitt Done PTAL |
There was a problem hiding this comment.
name this maxExpirationSeconds so it's clear what the unit is
cmd/kube-apiserver/app/server.go
Outdated
|
/approve |
…ins a TokenRequest's expiration time to avoid extreme value which could harm the cluster.
7b8b02c to
f16470c
Compare
|
@mikedanese PTAL |
|
@mikedanese friendly ping |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liggitt, mikedanese, WanLinghao The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
2 similar comments
|
/retest |
|
/retest |
|
/test all [submit-queue is verifying that this PR is safe to merge] |
|
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
A new API TokenRequest has been implemented.It improves current serviceaccount model from many ways.
This patch adds limit to TokenRequest expiration time.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #63575
Special notes for your reviewer:
Release note: