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:
@@ -17,7 +17,11 @@
|
||||
*/
|
||||
package options
|
||||
|
||||
import "github.com/spf13/pflag"
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spf13/pflag"
|
||||
"kubesphere.io/kubesphere/pkg/utils/net"
|
||||
)
|
||||
|
||||
type ServerRunOptions struct {
|
||||
// server bind address
|
||||
@@ -49,6 +53,26 @@ func NewServerRunOptions() *ServerRunOptions {
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s *ServerRunOptions) Validate() []error {
|
||||
errs := []error{}
|
||||
|
||||
if s.SecurePort == 0 && s.InsecurePort == 0 {
|
||||
errs = append(errs, fmt.Errorf("insecure and secure port can not be disabled at the same time"))
|
||||
}
|
||||
|
||||
if net.IsValidPort(s.SecurePort) {
|
||||
if s.TlsCertFile == "" {
|
||||
errs = append(errs, fmt.Errorf("tls cert file is empty while secure serving"))
|
||||
}
|
||||
|
||||
if s.TlsPrivateKey == "" {
|
||||
errs = append(errs, fmt.Errorf("tls private key file is empty while secure serving"))
|
||||
}
|
||||
}
|
||||
|
||||
return errs
|
||||
}
|
||||
|
||||
func (s *ServerRunOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
|
||||
fs.StringVar(&s.BindAddress, "bind-address", "0.0.0.0", "server bind address")
|
||||
|
||||
Reference in New Issue
Block a user