Add network configuration to apiserver/config

This commit is contained in:
Zhengyi Lai
2020-04-17 23:27:57 +08:00
parent 828f7726fd
commit 8ad17a4648
9 changed files with 84 additions and 24 deletions

View File

@@ -0,0 +1,32 @@
package network
import "github.com/spf13/pflag"
type Options struct {
// weave scope service host
WeaveScopeHost string `json:"weaveScopeHost,omitempty" yaml:"weaveScopeHost"`
}
// NewNetworkOptions returns a `zero` instance
func NewNetworkOptions() *Options {
return &Options{
WeaveScopeHost: "weave-scope-app.weave.svc",
}
}
func (s *Options) Validate() []error {
var errors []error
return errors
}
func (s *Options) ApplyTo(options *Options) {
if s.WeaveScopeHost != "" {
options.WeaveScopeHost = s.WeaveScopeHost
}
}
func (s *Options) AddFlags(fs *pflag.FlagSet, c *Options) {
fs.StringVar(&s.WeaveScopeHost, "weave-scope-host", c.WeaveScopeHost, ""+
"weave scope service host")
}