diff --git a/cmd/controller-manager/app/server.go b/cmd/controller-manager/app/server.go index 233dc6bb8372867e0fb28fe3da2914f83fe9fe5c..da93bf1311e442a7a803a235615d572720b5abbf 100644 --- a/cmd/controller-manager/app/server.go +++ b/cmd/controller-manager/app/server.go @@ -228,7 +228,7 @@ func run(s *options.KubeSphereControllerManagerOptions, stopCh <-chan struct{}) klog.Fatal("Unable to create helm category controller") } - if !s.OpenPitrixOptions.IsEmpty() { + if !s.OpenPitrixOptions.AppStoreConfIsEmpty() { storageClient, err := s3.NewS3Client(s.OpenPitrixOptions.S3Options) if err != nil { klog.Fatalf("failed to connect to s3, please check openpitrix s3 service status, error: %v", err) diff --git a/pkg/apiserver/config/config.go b/pkg/apiserver/config/config.go index 4ec842b42257e2d60a808caa66e8798c1396feb8..4954270c6be72ae71adb0a7d11ea4ca9b4cbfc6b 100644 --- a/pkg/apiserver/config/config.go +++ b/pkg/apiserver/config/config.go @@ -200,11 +200,14 @@ func (conf *Config) ToMap() map[string]bool { } if name == "openpitrix" { - if conf.OpenPitrixOptions.IsEmpty() { + // openpitrix is always true + result[name] = true + if conf.OpenPitrixOptions == nil { result["openpitrix.appstore"] = false } else { - result["openpitrix.appstore"] = true + result["openpitrix.appstore"] = conf.OpenPitrixOptions.AppStoreConfIsEmpty() } + continue } if c.Field(i).IsNil() { @@ -240,10 +243,6 @@ func (conf *Config) stripEmptyOptions() { conf.LdapOptions = nil } - if conf.OpenPitrixOptions != nil && conf.OpenPitrixOptions.IsEmpty() { - conf.OpenPitrixOptions = nil - } - if conf.NetworkOptions != nil && conf.NetworkOptions.IsEmpty() { conf.NetworkOptions = nil } diff --git a/pkg/simple/client/openpitrix/options.go b/pkg/simple/client/openpitrix/options.go index f6d09681f59d1da977e028365af2223e455dbbfc..132fc33d8edf2f8615bbce60c2071377caffa463 100644 --- a/pkg/simple/client/openpitrix/options.go +++ b/pkg/simple/client/openpitrix/options.go @@ -39,7 +39,7 @@ func (s *Options) Validate() []error { return errors } -func (s *Options) IsEmpty() bool { +func (s *Options) AppStoreConfIsEmpty() bool { return s.S3Options == nil || s.S3Options.Endpoint == "" }