// NewCommandStartMaster provides a CLI handler for 'start master' command func NewCommandStartDiscoveryServer(out, err io.Writer) *cobra.Command { o := &DiscoveryServerOptions{ Etcd: genericoptions.NewEtcdOptions(), SecureServing: genericoptions.NewSecureServingOptions(), Authentication: genericoptions.NewDelegatingAuthenticationOptions(), Authorization: genericoptions.NewDelegatingAuthorizationOptions(), StdOut: out, StdErr: err, } o.Etcd.StorageConfig.Type = storagebackend.StorageTypeETCD3 o.Etcd.StorageConfig.Prefix = defaultEtcdPathPrefix o.Etcd.StorageConfig.Codec = api.Codecs.LegacyCodec(v1alpha1.SchemeGroupVersion) o.SecureServing.ServingOptions.BindPort = 443 cmd := &cobra.Command{ Short: "Launch a discovery summarizer and proxy server", Long: "Launch a discovery summarizer and proxy server", Run: func(c *cobra.Command, args []string) { cmdutil.CheckErr(o.Complete()) cmdutil.CheckErr(o.Validate(args)) cmdutil.CheckErr(o.RunDiscoveryServer()) }, } flags := cmd.Flags() o.Etcd.AddFlags(flags) o.SecureServing.AddFlags(flags) o.Authentication.AddFlags(flags) o.Authorization.AddFlags(flags) return cmd }
// NewServerRunOptions creates a new ServerRunOptions object with default parameters func NewServerRunOptions() *ServerRunOptions { s := ServerRunOptions{ GenericServerRunOptions: genericoptions.NewServerRunOptions(), Etcd: genericoptions.NewEtcdOptions(), SecureServing: genericoptions.NewSecureServingOptions(), InsecureServing: genericoptions.NewInsecureServingOptions(), Authentication: genericoptions.NewBuiltInAuthenticationOptions().WithAll(), Authorization: genericoptions.NewBuiltInAuthorizationOptions(), EventTTL: 1 * time.Hour, MasterCount: 1, KubeletConfig: kubeletclient.KubeletClientConfig{ Port: ports.KubeletPort, PreferredAddressTypes: []string{ string(api.NodeHostName), string(api.NodeInternalIP), string(api.NodeExternalIP), string(api.NodeLegacyHostIP), }, EnableHttps: true, HTTPTimeout: time.Duration(5) * time.Second, }, ServiceNodePortRange: DefaultServiceNodePortRange, } return &s }
func NewServerRunOptions() *ServerRunOptions { s := ServerRunOptions{ GenericServerRunOptions: genericoptions.NewServerRunOptions(), Etcd: genericoptions.NewEtcdOptions(), SecureServing: genericoptions.NewSecureServingOptions(), InsecureServing: genericoptions.NewInsecureServingOptions(), Authentication: genericoptions.NewBuiltInAuthenticationOptions().WithAll(), } s.InsecureServing.BindPort = InsecurePort s.SecureServing.ServingOptions.BindPort = SecurePort return &s }
// NewServerRunOptions creates a new ServerRunOptions object with default values. func NewServerRunOptions() *ServerRunOptions { s := ServerRunOptions{ GenericServerRunOptions: genericoptions.NewServerRunOptions(), Etcd: genericoptions.NewEtcdOptions(), SecureServing: genericoptions.NewSecureServingOptions(), InsecureServing: genericoptions.NewInsecureServingOptions(), Authentication: genericoptions.NewBuiltInAuthenticationOptions().WithAll(), Authorization: genericoptions.NewBuiltInAuthorizationOptions(), EventTTL: 1 * time.Hour, } return &s }