提交 87c71ed2 编写于 作者: L LiHui

Fix: handle openpititx config

Signed-off-by: NLiHui <andrewli@yunify.com>
上级 01600081
...@@ -228,7 +228,7 @@ func run(s *options.KubeSphereControllerManagerOptions, stopCh <-chan struct{}) ...@@ -228,7 +228,7 @@ func run(s *options.KubeSphereControllerManagerOptions, stopCh <-chan struct{})
klog.Fatal("Unable to create helm category controller") klog.Fatal("Unable to create helm category controller")
} }
if !s.OpenPitrixOptions.IsEmpty() { if !s.OpenPitrixOptions.AppStoreConfIsEmpty() {
storageClient, err := s3.NewS3Client(s.OpenPitrixOptions.S3Options) storageClient, err := s3.NewS3Client(s.OpenPitrixOptions.S3Options)
if err != nil { if err != nil {
klog.Fatalf("failed to connect to s3, please check openpitrix s3 service status, error: %v", err) klog.Fatalf("failed to connect to s3, please check openpitrix s3 service status, error: %v", err)
......
...@@ -200,11 +200,14 @@ func (conf *Config) ToMap() map[string]bool { ...@@ -200,11 +200,14 @@ func (conf *Config) ToMap() map[string]bool {
} }
if name == "openpitrix" { if name == "openpitrix" {
if conf.OpenPitrixOptions.IsEmpty() { // openpitrix is always true
result[name] = true
if conf.OpenPitrixOptions == nil {
result["openpitrix.appstore"] = false result["openpitrix.appstore"] = false
} else { } else {
result["openpitrix.appstore"] = true result["openpitrix.appstore"] = conf.OpenPitrixOptions.AppStoreConfIsEmpty()
} }
continue
} }
if c.Field(i).IsNil() { if c.Field(i).IsNil() {
...@@ -240,10 +243,6 @@ func (conf *Config) stripEmptyOptions() { ...@@ -240,10 +243,6 @@ func (conf *Config) stripEmptyOptions() {
conf.LdapOptions = nil conf.LdapOptions = nil
} }
if conf.OpenPitrixOptions != nil && conf.OpenPitrixOptions.IsEmpty() {
conf.OpenPitrixOptions = nil
}
if conf.NetworkOptions != nil && conf.NetworkOptions.IsEmpty() { if conf.NetworkOptions != nil && conf.NetworkOptions.IsEmpty() {
conf.NetworkOptions = nil conf.NetworkOptions = nil
} }
......
...@@ -39,7 +39,7 @@ func (s *Options) Validate() []error { ...@@ -39,7 +39,7 @@ func (s *Options) Validate() []error {
return errors return errors
} }
func (s *Options) IsEmpty() bool { func (s *Options) AppStoreConfIsEmpty() bool {
return s.S3Options == nil || s.S3Options.Endpoint == "" return s.S3Options == nil || s.S3Options.Endpoint == ""
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册