Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make min resync period configurable #270

Merged
merged 1 commit into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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