forked from rancher/rancher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setting.go
39 lines (32 loc) · 938 Bytes
/
setting.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package auth
import (
"github.com/rancher/rancher/pkg/auth/providerrefresh"
v3 "github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/rancher/types/config"
"k8s.io/apimachinery/pkg/runtime"
)
const (
authSettingController = "mgmt-auth-settings-controller"
)
type SettingController struct {
settings v3.SettingInterface
}
func newAuthSettingController(mgmt *config.ManagementContext) *SettingController {
n := &SettingController{
settings: mgmt.Management.Settings(""),
}
return n
}
//sync is called periodically and on real updates
func (n *SettingController) sync(key string, obj *v3.Setting) (runtime.Object, error) {
if obj == nil || obj.DeletionTimestamp != nil {
return nil, nil
}
switch obj.Name {
case "auth-user-info-resync-cron":
providerrefresh.UpdateRefreshCronTime(obj.Value)
case "auth-user-info-max-age-seconds":
providerrefresh.UpdateRefreshMaxAge(obj.Value)
}
return nil, nil
}