Skip to content

Commit

Permalink
make min resync period configurable
Browse files Browse the repository at this point in the history
Signed-off-by: sunhaizhou <sunhaizhou@kingsoft.com>
  • Loading branch information
sunhaizhou committed Feb 11, 2022
1 parent b30b98e commit c9fa528
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions pkg/globalmanager/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const (
defaultWebsocketPort = 9000
defaultLCServer = "http://localhost:9100"
defaultKBServer = "http://localhost:9020"
defaultPeriod = 30
)

// ControllerConfig indicates the config of controller
Expand All @@ -58,6 +59,10 @@ type ControllerConfig struct {

// kb config to info the worker
KB KBConfig `json:"knowledgeBaseServer,omitempty"`

// period config min resync period
// default 30s
MinResyncPeriodSeconds int64 `json:"minResyncPeriodSeconds,omitempty"`
}

// WebSocket describes GM of websocket config
Expand Down Expand Up @@ -120,6 +125,7 @@ func NewDefaultControllerConfig() *ControllerConfig {
KB: KBConfig{
Server: defaultKBServer,
},
MinResyncPeriodSeconds: defaultPeriod,
}
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/globalmanager/controllers/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ func (m *Manager) Start() error {
namespace = metav1.NamespaceAll
}

// TODO(llhuii): make this period configurable
minResyncPeriod := time.Second * 30
minResyncPeriod := time.Second * time.Duration(m.Config.MinResyncPeriodSeconds)

kubeInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(kubeClient, genResyncPeriod(minResyncPeriod), kubeinformers.WithNamespace(namespace))

Expand Down

0 comments on commit c9fa528

Please sign in to comment.