Example #1
0
func NewServerRunOptions() *ServerRunOptions {
	return &ServerRunOptions{
		AdmissionControl:                         "AlwaysAdmit",
		AnonymousAuth:                            true,
		AuthorizationMode:                        "AlwaysAllow",
		AuthorizationWebhookCacheAuthorizedTTL:   5 * time.Minute,
		AuthorizationWebhookCacheUnauthorizedTTL: 30 * time.Second,
		BindAddress:                              net.ParseIP("0.0.0.0"),
		CertDirectory:                            "/var/run/kubernetes",
		DefaultStorageMediaType:                  "application/json",
		DefaultStorageVersions:                   registered.AllPreferredGroupVersions(),
		DeleteCollectionWorkers:                  1,
		EnableGarbageCollection:                  true,
		EnableProfiling:                          true,
		EnableContentionProfiling:                false,
		EnableWatchCache:                         true,
		InsecureBindAddress:                      net.ParseIP("127.0.0.1"),
		InsecurePort:                             8080,
		LongRunningRequestRE:                     DefaultLongRunningRequestRE,
		MasterCount:                              1,
		MasterServiceNamespace:                   api.NamespaceDefault,
		MaxRequestsInFlight:                      400,
		MinRequestTimeout:                        1800,
		RuntimeConfig:                            make(config.ConfigurationMap),
		SecurePort:                               6443,
		ServiceNodePortRange:                     DefaultServiceNodePortRange,
		StorageVersions:                          registered.AllPreferredGroupVersions(),
	}
}
Example #2
0
// NewAPIServer creates a new APIServer object with default parameters
func NewAPIServer() *APIServer {
	s := APIServer{
		ServerRunOptions:        genericapiserver.NewServerRunOptions(),
		APIGroupPrefix:          "/apis",
		APIPrefix:               "/api",
		AdmissionControl:        "AlwaysAdmit",
		AuthorizationMode:       "AlwaysAllow",
		DeleteCollectionWorkers: 1,
		EnableLogsSupport:       true,
		StorageConfig: storagebackend.Config{
			Prefix: genericapiserver.DefaultEtcdPathPrefix,
		},
		EventTTL:               1 * time.Hour,
		MasterCount:            1,
		MasterServiceNamespace: api.NamespaceDefault,
		RuntimeConfig:          make(config.ConfigurationMap),
		StorageVersions:        registered.AllPreferredGroupVersions(),
		DefaultStorageVersions: registered.AllPreferredGroupVersions(),
		KubeletConfig: kubeletclient.KubeletClientConfig{
			Port:        ports.KubeletPort,
			EnableHttps: true,
			HTTPTimeout: time.Duration(5) * time.Second,
		},
	}

	return &s
}
Example #3
0
func NewServerRunOptions() *ServerRunOptions {
	return &ServerRunOptions{
		APIGroupPrefix:         "/apis",
		APIPrefix:              "/api",
		BindAddress:            net.ParseIP("0.0.0.0"),
		CertDirectory:          "/var/run/kubernetes",
		DefaultStorageVersions: registered.AllPreferredGroupVersions(),
		StorageConfig: storagebackend.Config{
			Prefix: DefaultEtcdPathPrefix,
			DeserializationCacheSize: DefaultDeserializationCacheSize,
		},
		EnableLogsSupport:    true,
		EnableProfiling:      true,
		EnableWatchCache:     true,
		InsecureBindAddress:  net.ParseIP("127.0.0.1"),
		InsecurePort:         8080,
		LongRunningRequestRE: defaultLongRunningRequestRE,
		MasterCount:          1,
		MaxRequestsInFlight:  400,
		MinRequestTimeout:    1800,
		RuntimeConfig:        make(config.ConfigurationMap),
		SecurePort:           6443,
		StorageVersions:      registered.AllPreferredGroupVersions(),
	}
}
func NewServerRunOptions() *ServerRunOptions {
	return &ServerRunOptions{
		APIGroupPrefix:          "/apis",
		APIPrefix:               "/api",
		AdmissionControl:        "AlwaysAdmit",
		AuthorizationMode:       "AlwaysAllow",
		BindAddress:             net.ParseIP("0.0.0.0"),
		CertDirectory:           "/var/run/kubernetes",
		DefaultStorageMediaType: "application/json",
		DefaultStorageVersions:  registered.AllPreferredGroupVersions(),
		StorageConfig: storagebackend.Config{
			Prefix: DefaultEtcdPathPrefix,
			DeserializationCacheSize: DefaultDeserializationCacheSize,
		},
		DeleteCollectionWorkers: 1,
		EnableLogsSupport:       true,
		EnableProfiling:         true,
		EnableWatchCache:        true,
		InsecureBindAddress:     net.ParseIP("127.0.0.1"),
		InsecurePort:            8080,
		LongRunningRequestRE:    defaultLongRunningRequestRE,
		MasterCount:             1,
		MasterServiceNamespace:  api.NamespaceDefault,
		MaxRequestsInFlight:     400,
		MinRequestTimeout:       1800,
		RuntimeConfig:           make(config.ConfigurationMap),
		SecurePort:              6443,
		StorageVersions:         registered.AllPreferredGroupVersions(),
	}
}
Example #5
0
func TestAPIServerDefaults(t *testing.T) {
	defaults := apiserveroptions.NewServerRunOptions()

	// This is a snapshot of the default config
	// If the default changes (new fields are added, or default values change), we want to know
	// Once we've reacted to the changes appropriately in BuildKubernetesMasterConfig(), update this expected default to match the new upstream defaults
	expectedDefaults := &apiserveroptions.ServerRunOptions{
		GenericServerRunOptions: &genericapiserveroptions.ServerRunOptions{
			AnonymousAuth:           true,
			BindAddress:             net.ParseIP("0.0.0.0"),
			CertDirectory:           "/var/run/kubernetes",
			InsecureBindAddress:     net.ParseIP("127.0.0.1"),
			InsecurePort:            8080,
			LongRunningRequestRE:    "(/|^)((watch|proxy)(/|$)|(logs?|portforward|exec|attach)/?$)",
			MaxRequestsInFlight:     400,
			SecurePort:              6443,
			EnableProfiling:         true,
			EnableGarbageCollection: true,
			EnableWatchCache:        true,
			MinRequestTimeout:       1800,
			ServiceNodePortRange:    genericapiserveroptions.DefaultServiceNodePortRange,
			RuntimeConfig:           utilconfig.ConfigurationMap{},
			StorageVersions:         registered.AllPreferredGroupVersions(),
			MasterCount:             1,
			DefaultStorageVersions:  registered.AllPreferredGroupVersions(),
			StorageConfig: storagebackend.Config{
				ServerList: nil,
				Prefix:     "/registry",
				DeserializationCacheSize: 0,
			},
			DefaultStorageMediaType:                  "application/json",
			AdmissionControl:                         "AlwaysAdmit",
			AuthorizationMode:                        "AlwaysAllow",
			DeleteCollectionWorkers:                  1,
			MasterServiceNamespace:                   "default",
			AuthorizationWebhookCacheAuthorizedTTL:   5 * time.Minute,
			AuthorizationWebhookCacheUnauthorizedTTL: 30 * time.Second,
		},
		EventTTL: 1 * time.Hour,
		KubeletConfig: kubeletclient.KubeletClientConfig{
			Port: 10250,
			PreferredAddressTypes: []string{
				string(apiv1.NodeHostName),
				string(apiv1.NodeInternalIP),
				string(apiv1.NodeExternalIP),
				string(apiv1.NodeLegacyHostIP),
			},
			EnableHttps: true,
			HTTPTimeout: time.Duration(5) * time.Second,
		},
		WebhookTokenAuthnCacheTTL: 2 * time.Minute,
	}

	if !reflect.DeepEqual(defaults, expectedDefaults) {
		t.Logf("expected defaults, actual defaults: \n%s", diff.ObjectReflectDiff(expectedDefaults, defaults))
		t.Errorf("Got different defaults than expected, adjust in BuildKubernetesMasterConfig and update expectedDefaults")
	}
}
Example #6
0
func TestAPIServerDefaults(t *testing.T) {
	defaults := apiserveroptions.NewAPIServer()

	// This is a snapshot of the default config
	// If the default changes (new fields are added, or default values change), we want to know
	// Once we've reacted to the changes appropriately in BuildKubernetesMasterConfig(), update this expected default to match the new upstream defaults
	expectedDefaults := &apiserveroptions.APIServer{
		ServerRunOptions: &genericapiserver.ServerRunOptions{
			BindAddress:          net.ParseIP("0.0.0.0"),
			CertDirectory:        "/var/run/kubernetes",
			InsecureBindAddress:  net.ParseIP("127.0.0.1"),
			InsecurePort:         8080,
			LongRunningRequestRE: "(/|^)((watch|proxy)(/|$)|(logs?|portforward|exec|attach)/?$)",
			MaxRequestsInFlight:  400,
			SecurePort:           6443,
		},
		APIGroupPrefix:          "/apis",
		APIPrefix:               "/api",
		AdmissionControl:        "AlwaysAdmit",
		AuthorizationMode:       "AlwaysAllow",
		DeleteCollectionWorkers: 1,
		EnableLogsSupport:       true,
		EnableProfiling:         true,
		EnableWatchCache:        true,
		EtcdConfig: etcdstorage.EtcdConfig{
			Prefix: "/registry",
		},
		EventTTL:               1 * time.Hour,
		MasterCount:            1,
		MasterServiceNamespace: "default",
		MinRequestTimeout:      1800,
		RuntimeConfig:          util.ConfigurationMap{},
		StorageVersions:        registered.AllPreferredGroupVersions(),
		DefaultStorageVersions: registered.AllPreferredGroupVersions(),
		KubeletConfig: kubeletclient.KubeletClientConfig{
			Port:        10250,
			EnableHttps: true,
			HTTPTimeout: time.Duration(5) * time.Second,
		},
	}

	if !reflect.DeepEqual(defaults, expectedDefaults) {
		t.Logf("expected defaults, actual defaults: \n%s", util.ObjectGoPrintDiff(expectedDefaults, defaults))
		t.Errorf("Got different defaults than expected, adjust in BuildKubernetesMasterConfig and update expectedDefaults")
	}
}
func NewServerRunOptions() *ServerRunOptions {
	return &ServerRunOptions{
		AdmissionControl:            "AlwaysAdmit",
		DefaultStorageMediaType:     "application/json",
		DefaultStorageVersions:      registered.AllPreferredGroupVersions(),
		DeleteCollectionWorkers:     1,
		EnableGarbageCollection:     true,
		EnableProfiling:             true,
		EnableContentionProfiling:   false,
		EnableWatchCache:            true,
		MaxRequestsInFlight:         400,
		MaxMutatingRequestsInFlight: 200,
		MinRequestTimeout:           1800,
		RuntimeConfig:               make(config.ConfigurationMap),
		StorageVersions:             registered.AllPreferredGroupVersions(),
	}
}
Example #8
0
// NewAPIServer creates a new APIServer object with default parameters
func NewAPIServer() *APIServer {
	s := APIServer{
		ServerRunOptions:        genericapiserver.NewServerRunOptions(),
		AdmissionControl:        "AlwaysAdmit",
		AuthorizationMode:       "AlwaysAllow",
		DefaultStorageMediaType: "application/json",
		DeleteCollectionWorkers: 1,
		EventTTL:                1 * time.Hour,
		MasterServiceNamespace:  api.NamespaceDefault,
		StorageVersions:         registered.AllPreferredGroupVersions(),
		DefaultStorageVersions:  registered.AllPreferredGroupVersions(),
		KubeletConfig: kubeletclient.KubeletClientConfig{
			Port:        ports.KubeletPort,
			EnableHttps: true,
			HTTPTimeout: time.Duration(5) * time.Second,
		},
	}
	return &s
}
Example #9
0
func NewServerRunOptions() *ServerRunOptions {
	return &ServerRunOptions{
		AdmissionControl:          "AlwaysAdmit",
		DefaultStorageMediaType:   "application/json",
		DefaultStorageVersions:    registered.AllPreferredGroupVersions(),
		DeleteCollectionWorkers:   1,
		EnableGarbageCollection:   true,
		EnableProfiling:           true,
		EnableContentionProfiling: false,
		EnableWatchCache:          true,
		LongRunningRequestRE:      DefaultLongRunningRequestRE,
		MasterCount:               1,
		MasterServiceNamespace:    api.NamespaceDefault,
		MaxRequestsInFlight:       400,
		MinRequestTimeout:         1800,
		RuntimeConfig:             make(config.ConfigurationMap),
		ServiceNodePortRange:      DefaultServiceNodePortRange,
		StorageVersions:           registered.AllPreferredGroupVersions(),
	}
}