Files
kubesphere/pkg/simple/client/kubesphere/options.go
Jeff 97c9a1786a 1. change glog to klog
2. move types to api package to avoid cyclic import
2019-09-16 18:46:28 +08:00

41 lines
975 B
Go

package kubesphere
import "github.com/spf13/pflag"
type KubeSphereOptions struct {
APIServer string
AccountServer string
}
// NewKubeSphereOptions create a default options
func NewKubeSphereOptions() *KubeSphereOptions {
return &KubeSphereOptions{
APIServer: "http://ks-apiserver.kubesphere-system.svc",
AccountServer: "http://ks-account.kubesphere-system.svc",
}
}
func (s *KubeSphereOptions) ApplyTo(options *KubeSphereOptions) {
if s.AccountServer != "" {
options.AccountServer = s.AccountServer
}
if s.APIServer != "" {
options.APIServer = s.APIServer
}
}
func (s *KubeSphereOptions) Validate() []error {
errs := []error{}
return errs
}
func (s *KubeSphereOptions) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.APIServer, "kubesphere-apiserver-host", s.APIServer, ""+
"KubeSphere apiserver host address.")
fs.StringVar(&s.AccountServer, "kubesphere-account-host", s.AccountServer, ""+
"KubeSphere account server host address.")
}