config: remove prometheus secondary-endpoint flag

Signed-off-by: huanggze <loganhuang@yunify.com>
This commit is contained in:
huanggze
2020-05-29 17:12:43 +08:00
parent a575c3eda8
commit 22cbbb30b1
3 changed files with 4 additions and 15 deletions

View File

@@ -186,8 +186,7 @@ func (conf *Config) stripEmptyOptions() {
conf.DevopsOptions = nil conf.DevopsOptions = nil
} }
if conf.MonitoringOptions != nil && conf.MonitoringOptions.Endpoint == "" && if conf.MonitoringOptions != nil && conf.MonitoringOptions.Endpoint == "" {
conf.MonitoringOptions.SecondaryEndpoint == "" {
conf.MonitoringOptions = nil conf.MonitoringOptions = nil
} }

View File

@@ -104,7 +104,6 @@ func newTestConfig() (*Config, error) {
}, },
MonitoringOptions: &prometheus.Options{ MonitoringOptions: &prometheus.Options{
Endpoint: "http://prometheus.kubesphere-monitoring-system.svc", Endpoint: "http://prometheus.kubesphere-monitoring-system.svc",
SecondaryEndpoint: "http://prometheus.kubesphere-monitoring-system.svc",
}, },
LoggingOptions: &elasticsearch.Options{ LoggingOptions: &elasticsearch.Options{
Host: "http://elasticsearch-logging.kubesphere-logging-system.svc:9200", Host: "http://elasticsearch-logging.kubesphere-logging-system.svc:9200",

View File

@@ -6,13 +6,11 @@ import (
type Options struct { type Options struct {
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint"` Endpoint string `json:"endpoint,omitempty" yaml:"endpoint"`
SecondaryEndpoint string `json:"secondaryEndpoint,omitempty" yaml:"secondaryEndpoint"`
} }
func NewPrometheusOptions() *Options { func NewPrometheusOptions() *Options {
return &Options{ return &Options{
Endpoint: "", Endpoint: "",
SecondaryEndpoint: "",
} }
} }
@@ -25,17 +23,10 @@ func (s *Options) ApplyTo(options *Options) {
if s.Endpoint != "" { if s.Endpoint != "" {
options.Endpoint = s.Endpoint options.Endpoint = s.Endpoint
} }
if s.SecondaryEndpoint != "" {
options.SecondaryEndpoint = s.SecondaryEndpoint
}
} }
func (s *Options) AddFlags(fs *pflag.FlagSet, c *Options) { func (s *Options) AddFlags(fs *pflag.FlagSet, c *Options) {
fs.StringVar(&s.Endpoint, "prometheus-endpoint", c.Endpoint, ""+ fs.StringVar(&s.Endpoint, "prometheus-endpoint", c.Endpoint, ""+
"Prometheus service endpoint which stores KubeSphere monitoring data, if left "+ "Prometheus service endpoint which stores KubeSphere monitoring data, if left "+
"blank, will use builtin metrics-server as data source.") "blank, will use builtin metrics-server as data source.")
fs.StringVar(&s.SecondaryEndpoint, "prometheus-secondary-endpoint", c.SecondaryEndpoint, ""+
"Prometheus secondary service endpoint, if left empty and endpoint is set, will use endpoint instead.")
} }