mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 18:58:18 +00:00
implement LegacyServiceAccountTokenCleanUp alpha
This commit is contained in:
@@ -68,6 +68,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/controller/volume/pvprotection"
|
||||
quotainstall "k8s.io/kubernetes/pkg/quota/v1/install"
|
||||
"k8s.io/kubernetes/pkg/volume/csimigration"
|
||||
"k8s.io/utils/clock"
|
||||
netutils "k8s.io/utils/net"
|
||||
)
|
||||
|
||||
@@ -581,6 +582,25 @@ func startTTLAfterFinishedController(ctx context.Context, controllerContext Cont
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
func startLegacySATokenCleaner(ctx context.Context, controllerContext ControllerContext) (controller.Interface, bool, error) {
|
||||
cleanUpPeriod := controllerContext.ComponentConfig.LegacySATokenCleaner.CleanUpPeriod.Duration
|
||||
legacySATokenCleaner, err := serviceaccountcontroller.NewLegacySATokenCleaner(
|
||||
controllerContext.InformerFactory.Core().V1().ServiceAccounts(),
|
||||
controllerContext.InformerFactory.Core().V1().Secrets(),
|
||||
controllerContext.InformerFactory.Core().V1().Pods(),
|
||||
controllerContext.ClientBuilder.ClientOrDie("legacy-service-account-token-cleaner"),
|
||||
clock.RealClock{},
|
||||
serviceaccountcontroller.LegacySATokenCleanerOptions{
|
||||
CleanUpPeriod: cleanUpPeriod,
|
||||
SyncInterval: serviceaccountcontroller.DefaultCleanerSyncInterval,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, true, fmt.Errorf("failed to start the legacy service account token cleaner: %v", err)
|
||||
}
|
||||
go legacySATokenCleaner.Run(ctx)
|
||||
return nil, true, nil
|
||||
}
|
||||
|
||||
// processCIDRs is a helper function that works on a comma separated cidrs and returns
|
||||
// a list of typed cidrs
|
||||
// error if failed to parse any of the cidrs or invalid length of cidrs
|
||||
|
||||
Reference in New Issue
Block a user