mirror of https://github.com/k3s-io/k3s
Rename master/options/{APIServer -> ServerRunOptions}
parent
d6dc0e561f
commit
b798527793
|
@ -24,7 +24,7 @@ import (
|
|||
// NewKubeAPIServer creates a new hyperkube Server object that includes the
|
||||
// description and flags.
|
||||
func NewKubeAPIServer() *Server {
|
||||
s := options.NewAPIServer()
|
||||
s := options.NewServerRunOptions()
|
||||
|
||||
hks := Server{
|
||||
SimpleUsage: "apiserver",
|
||||
|
|
|
@ -38,7 +38,7 @@ import (
|
|||
func main() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
|
||||
s := options.NewAPIServer()
|
||||
s := options.NewServerRunOptions()
|
||||
s.AddFlags(pflag.CommandLine)
|
||||
|
||||
flag.InitFlags()
|
||||
|
|
|
@ -28,8 +28,8 @@ import (
|
|||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
// APIServer runs a kubernetes api server.
|
||||
type APIServer struct {
|
||||
// ServerRunOptions runs a kubernetes api server.
|
||||
type ServerRunOptions struct {
|
||||
*genericoptions.ServerRunOptions
|
||||
AllowPrivileged bool
|
||||
EventTTL time.Duration
|
||||
|
@ -43,9 +43,9 @@ type APIServer struct {
|
|||
WebhookTokenAuthnCacheTTL time.Duration
|
||||
}
|
||||
|
||||
// NewAPIServer creates a new APIServer object with default parameters
|
||||
func NewAPIServer() *APIServer {
|
||||
s := APIServer{
|
||||
// NewServerRunOptions creates a new ServerRunOptions object with default parameters
|
||||
func NewServerRunOptions() *ServerRunOptions {
|
||||
s := ServerRunOptions{
|
||||
ServerRunOptions: genericoptions.NewServerRunOptions().WithEtcdOptions(),
|
||||
EventTTL: 1 * time.Hour,
|
||||
KubeletConfig: kubeletclient.KubeletClientConfig{
|
||||
|
@ -59,7 +59,7 @@ func NewAPIServer() *APIServer {
|
|||
}
|
||||
|
||||
// AddFlags adds flags for a specific APIServer to the specified FlagSet
|
||||
func (s *APIServer) AddFlags(fs *pflag.FlagSet) {
|
||||
func (s *ServerRunOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
// Add the generic flags.
|
||||
s.ServerRunOptions.AddUniversalFlags(fs)
|
||||
//Add etcd specific flags.
|
||||
|
|
|
@ -26,7 +26,7 @@ func TestAddFlagsFlag(t *testing.T) {
|
|||
// TODO: This only tests the enable-swagger-ui flag for now.
|
||||
// Expand the test to include other flags as well.
|
||||
f := pflag.NewFlagSet("addflagstest", pflag.ContinueOnError)
|
||||
s := NewAPIServer()
|
||||
s := NewServerRunOptions()
|
||||
s.AddFlags(f)
|
||||
if s.EnableSwaggerUI {
|
||||
t.Errorf("Expected s.EnableSwaggerUI to be false by default")
|
||||
|
|
|
@ -63,7 +63,7 @@ import (
|
|||
|
||||
// NewAPIServerCommand creates a *cobra.Command object with default parameters
|
||||
func NewAPIServerCommand() *cobra.Command {
|
||||
s := options.NewAPIServer()
|
||||
s := options.NewServerRunOptions()
|
||||
s.AddFlags(pflag.CommandLine)
|
||||
cmd := &cobra.Command{
|
||||
Use: "kube-apiserver",
|
||||
|
@ -79,7 +79,7 @@ cluster's shared state through which all other components interact.`,
|
|||
}
|
||||
|
||||
// Run runs the specified APIServer. This should never exit.
|
||||
func Run(s *options.APIServer) error {
|
||||
func Run(s *options.ServerRunOptions) error {
|
||||
genericvalidation.VerifyEtcdServersList(s.ServerRunOptions)
|
||||
genericapiserver.DefaultAndValidateRunOptions(s.ServerRunOptions)
|
||||
genericConfig := genericapiserver.NewConfig(). // create the new config
|
||||
|
|
|
@ -24,7 +24,7 @@ import (
|
|||
)
|
||||
|
||||
func TestLongRunningRequestRegexp(t *testing.T) {
|
||||
regexp := regexp.MustCompile(options.NewAPIServer().LongRunningRequestRE)
|
||||
regexp := regexp.MustCompile(options.NewServerRunOptions().LongRunningRequestRE)
|
||||
dontMatch := []string{
|
||||
"/api/v1/watch-namespace/",
|
||||
"/api/v1/namespace-proxy/",
|
||||
|
|
|
@ -40,7 +40,7 @@ func NewAPIServer() *APIServer {
|
|||
|
||||
// Start starts the apiserver, returns when apiserver is ready.
|
||||
func (a *APIServer) Start() error {
|
||||
config := options.NewAPIServer()
|
||||
config := options.NewServerRunOptions()
|
||||
config.StorageConfig.ServerList = []string{getEtcdClientURL()}
|
||||
_, ipnet, err := net.ParseCIDR(clusterIPRange)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue