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:
59
pkg/simple/client/servicemesh/options.go
Normal file
59
pkg/simple/client/servicemesh/options.go
Normal file
@@ -0,0 +1,59 @@
|
||||
package servicemesh
|
||||
|
||||
import "github.com/spf13/pflag"
|
||||
|
||||
type ServiceMeshOptions struct {
|
||||
|
||||
// istio pilot discovery service url
|
||||
IstioPilotHost string `json:"istioPilotHost,omitempty" yaml:"istioPilotHost,omitempty"`
|
||||
|
||||
// jaeger query service url
|
||||
JaegerQueryHost string `json:"jaegerQueryHost,omitempty" yaml:"jaegerQueryHost,omitempty"`
|
||||
|
||||
// prometheus service url for servicemesh metrics
|
||||
ServicemeshPrometheusHost string `json:"servicemeshPrometheusHost,omitempty" yaml:"servicemeshPrometheusHost,omitempty"`
|
||||
}
|
||||
|
||||
// NewServiceMeshOptions returns a `zero` instance
|
||||
func NewServiceMeshOptions() *ServiceMeshOptions {
|
||||
return &ServiceMeshOptions{
|
||||
IstioPilotHost: "",
|
||||
JaegerQueryHost: "",
|
||||
ServicemeshPrometheusHost: "",
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ServiceMeshOptions) Validate() []error {
|
||||
errors := []error{}
|
||||
|
||||
return errors
|
||||
}
|
||||
|
||||
func (s *ServiceMeshOptions) ApplyTo(options *ServiceMeshOptions) {
|
||||
if options == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if s.ServicemeshPrometheusHost != "" {
|
||||
options.ServicemeshPrometheusHost = s.ServicemeshPrometheusHost
|
||||
}
|
||||
|
||||
if s.JaegerQueryHost != "" {
|
||||
options.JaegerQueryHost = s.JaegerQueryHost
|
||||
}
|
||||
|
||||
if s.IstioPilotHost != "" {
|
||||
options.IstioPilotHost = s.IstioPilotHost
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ServiceMeshOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.StringVar(&s.IstioPilotHost, "istio-pilot-host", s.IstioPilotHost, ""+
|
||||
"istio pilot discovery service url")
|
||||
|
||||
fs.StringVar(&s.JaegerQueryHost, "jaeger-query-host", s.JaegerQueryHost, ""+
|
||||
"jaeger query service url")
|
||||
|
||||
fs.StringVar(&s.ServicemeshPrometheusHost, "servicemesh-prometheus-host", s.ServicemeshPrometheusHost, ""+
|
||||
"prometheus service for servicemesh")
|
||||
}
|
||||
Reference in New Issue
Block a user