mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-22 18:37:15 +00:00
svcacct: default expiration of TokenRequest
* default expiration seconds to 1 hour
This commit is contained in:
@@ -17,9 +17,17 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
authenticationv1 "k8s.io/api/authentication/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||
return RegisterDefaults(scheme)
|
||||
}
|
||||
|
||||
func SetDefaults_TokenRequestSpec(obj *authenticationv1.TokenRequestSpec) {
|
||||
if obj.ExpirationSeconds == nil {
|
||||
hour := int64(60 * 60)
|
||||
obj.ExpirationSeconds = &hour
|
||||
}
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/authentication/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
@@ -28,5 +29,10 @@ import (
|
||||
// Public to allow building arbitrary schemes.
|
||||
// All generated defaulters are covering - they call all nested defaulters.
|
||||
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||
scheme.AddTypeDefaultingFunc(&v1.TokenRequest{}, func(obj interface{}) { SetObjectDefaults_TokenRequest(obj.(*v1.TokenRequest)) })
|
||||
return nil
|
||||
}
|
||||
|
||||
func SetObjectDefaults_TokenRequest(in *v1.TokenRequest) {
|
||||
SetDefaults_TokenRequestSpec(&in.Spec)
|
||||
}
|
||||
|
Reference in New Issue
Block a user