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

fix:修复没有开启主动监听polaris配置数据问题 #154

Merged
merged 2 commits into from
Dec 26, 2023
Merged
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
9 changes: 6 additions & 3 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,19 +199,22 @@ func NewPolarisController(
p.provider = providerAPI

p.config = config
return p, nil

return p, p.watchPolarisConfig()
}

// AllowSyncFromConfigMap 是否开启配置同步从 ConfigMap 到 Polaris
func (p *PolarisController) AllowSyncFromConfigMap() bool {
syncDirection := p.config.PolarisController.ConfigSync.SyncDirection
return p.config.PolarisController.ConfigSync.Enable && (syncDirection == util.SyncDirectionKubernetesToPolaris || syncDirection == util.SyncDirectionBoth)
allowSyn := syncDirection == util.SyncDirectionKubernetesToPolaris || syncDirection == util.SyncDirectionBoth
return p.config.PolarisController.ConfigSync.Enable && allowSyn
}

// AllowSyncToConfigMap 是否开启配置同步从 Polaris 到 Kubernetes
func (p *PolarisController) AllowSyncToConfigMap() bool {
syncDirection := p.config.PolarisController.ConfigSync.SyncDirection
return p.config.PolarisController.ConfigSync.Enable && (syncDirection == util.SyncDirectionPolarisToKubernetes || syncDirection == util.SyncDirectionBoth)
allowSync := syncDirection == util.SyncDirectionPolarisToKubernetes || syncDirection == util.SyncDirectionBoth
return p.config.PolarisController.ConfigSync.Enable && allowSync
}

func (p *PolarisController) allowDeleteConfig() bool {
Expand Down
Loading