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