add ks-apiserver options

This commit is contained in:
Jeff
2019-09-11 23:40:21 +08:00
committed by zryfish
parent 758f8d7a8c
commit c199b1afc9
3 changed files with 34 additions and 10 deletions

View File

@@ -7,8 +7,12 @@ import (
genericoptions "kubesphere.io/kubesphere/pkg/options"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"kubesphere.io/kubesphere/pkg/simple/client/k8s"
"kubesphere.io/kubesphere/pkg/simple/client/ldap"
"kubesphere.io/kubesphere/pkg/simple/client/mysql"
"kubesphere.io/kubesphere/pkg/simple/client/openpitrix"
"kubesphere.io/kubesphere/pkg/simple/client/prometheus"
"kubesphere.io/kubesphere/pkg/simple/client/redis"
"kubesphere.io/kubesphere/pkg/simple/client/s2is3"
"kubesphere.io/kubesphere/pkg/simple/client/servicemesh"
"kubesphere.io/kubesphere/pkg/simple/client/sonarqube"
"strings"
@@ -17,17 +21,16 @@ import (
type ServerRunOptions struct {
GenericServerRunOptions *genericoptions.ServerRunOptions
KubernetesOptions *k8s.KubernetesOptions
DevopsOptions *devops.DevopsOptions
SonarQubeOptions *sonarqube.SonarQubeOptions
KubernetesOptions *k8s.KubernetesOptions
DevopsOptions *devops.DevopsOptions
SonarQubeOptions *sonarqube.SonarQubeOptions
ServiceMeshOptions *servicemesh.ServiceMeshOptions
MySQLOptions *mysql.MySQLOptions
MonitoringOptions *prometheus.PrometheusOptions
MySQLOptions *mysql.MySQLOptions
MonitoringOptions *prometheus.PrometheusOptions
LdapOptions *ldap.LdapOptions
S3Options *s2is3.S3Options
RedisOptions *redis.RedisOptions
OpenPitrixOptions *openpitrix.OpenPitrixOptions
}
func NewServerRunOptions() *ServerRunOptions {
@@ -40,6 +43,10 @@ func NewServerRunOptions() *ServerRunOptions {
ServiceMeshOptions: servicemesh.NewServiceMeshOptions(),
MySQLOptions: mysql.NewMySQLOptions(),
MonitoringOptions: prometheus.NewPrometheusOptions(),
LdapOptions: ldap.NewLdapOptions(),
S3Options: s2is3.NewS3Options(),
RedisOptions: redis.NewRedisOptions(),
OpenPitrixOptions: openpitrix.NewOpenPitrixOptions(),
}
return &s
@@ -49,8 +56,11 @@ func (s *ServerRunOptions) Flags() (fss cliflag.NamedFlagSets) {
s.GenericServerRunOptions.AddFlags(fss.FlagSet("generic"))
s.KubernetesOptions.AddFlags(fss.FlagSet("kubernetes"))
s.LdapOptions.AddFlags(fss.FlagSet("ldap"))
s.DevopsOptions.AddFlags(fss.FlagSet("devops"))
s.SonarQubeOptions.AddFlags(fss.FlagSet("sonarqube"))
s.S3Options.AddFlags(fss.FlagSet("s3"))
s.RedisOptions.AddFlags(fss.FlagSet("redis"))
s.ServiceMeshOptions.AddFlags(fss.FlagSet("servicemesh"))
s.MonitoringOptions.AddFlags(fss.FlagSet("monitoring"))

View File

@@ -1,5 +1,7 @@
package options
// Validate validates server run options, to find
// options' misconfiguration
func (s *ServerRunOptions) Validate() []error {
var errors []error
@@ -9,6 +11,10 @@ func (s *ServerRunOptions) Validate() []error {
errors = append(errors, s.ServiceMeshOptions.Validate()...)
errors = append(errors, s.MonitoringOptions.Validate()...)
errors = append(errors, s.SonarQubeOptions.Validate()...)
errors = append(errors, s.LdapOptions.Validate()...)
errors = append(errors, s.S3Options.Validate()...)
errors = append(errors, s.RedisOptions.Validate()...)
errors = append(errors, s.OpenPitrixOptions.Validate()...)
return errors
}

View File

@@ -291,6 +291,10 @@ func Complete(s *options.ServerRunOptions) error {
KubernetesOptions: s.KubernetesOptions,
ServiceMeshOptions: s.ServiceMeshOptions,
MonitoringOptions: s.MonitoringOptions,
LdapOptions: s.LdapOptions,
RedisOptions: s.RedisOptions,
S3Options: s.S3Options,
OpenPitrixOptions: s.OpenPitrixOptions,
})
s = &options.ServerRunOptions{
@@ -301,6 +305,10 @@ func Complete(s *options.ServerRunOptions) error {
ServiceMeshOptions: conf.ServiceMeshOptions,
MySQLOptions: conf.MySQLOptions,
MonitoringOptions: conf.MonitoringOptions,
LdapOptions: conf.LdapOptions,
RedisOptions: conf.RedisOptions,
S3Options: conf.S3Options,
OpenPitrixOptions: conf.OpenPitrixOptions,
}
return nil