This is a huge commit, it does following things:
1. refactor kubesphere dependency service client creation, we can disable dependency by config 2. dependencies can be configured by configuration file 3. refactor cmd package using cobra.Command, so we can use hypersphere to invoke command sepearately. Later we only need to build one image to contains all kubesphere core components. One command to rule them all! 4. live reloading configuration currently not implemented
This commit is contained in:
37
pkg/simple/client/prometheus/options.go
Normal file
37
pkg/simple/client/prometheus/options.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package prometheus
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
|
||||
)
|
||||
|
||||
type PrometheusOptions struct {
|
||||
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
|
||||
SecondaryEndpoint string `json:"secondaryEndpoint,omitempty" yaml:"secondaryEndpoint,omitempty"`
|
||||
}
|
||||
|
||||
func NewPrometheusOptions() *PrometheusOptions {
|
||||
return &PrometheusOptions{
|
||||
Endpoint: "",
|
||||
SecondaryEndpoint: "",
|
||||
}
|
||||
}
|
||||
|
||||
func (s *PrometheusOptions) Validate() []error {
|
||||
errs := []error{}
|
||||
|
||||
return errs
|
||||
}
|
||||
|
||||
func (s *PrometheusOptions) ApplyTo(options *PrometheusOptions) {
|
||||
reflectutils.Override(s, options)
|
||||
}
|
||||
|
||||
func (s *PrometheusOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.StringVar(&s.Endpoint, "prometheus-endpoint", s.Endpoint, ""+
|
||||
"Prometheus service endpoint which stores KubeSphere monitoring data, if left "+
|
||||
"blank, will use builtin metrics-server as data source.")
|
||||
|
||||
fs.StringVar(&s.SecondaryEndpoint, "prometheus-secondary-endpoint", s.SecondaryEndpoint, ""+
|
||||
"Prometheus secondary service endpoint, if left empty and endpoint is set, will use endpoint instead.")
|
||||
}
|
||||
Reference in New Issue
Block a user