mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
make v1 enabled by default
This commit is contained in:
parent
02f3142f41
commit
ef61b031f5
@ -164,7 +164,6 @@ func startComponents(firstManifestURL, secondManifestURL, apiVersion string) (st
|
|||||||
ReadWritePort: portNumber,
|
ReadWritePort: portNumber,
|
||||||
PublicAddress: publicAddress,
|
PublicAddress: publicAddress,
|
||||||
CacheTimeout: 2 * time.Second,
|
CacheTimeout: 2 * time.Second,
|
||||||
EnableV1: true,
|
|
||||||
})
|
})
|
||||||
handler.delegate = m.Handler
|
handler.delegate = m.Handler
|
||||||
|
|
||||||
|
@ -282,8 +282,10 @@ func (s *APIServer) Run(_ []string) error {
|
|||||||
disableV1beta3 := disableAllAPIs
|
disableV1beta3 := disableAllAPIs
|
||||||
disableV1beta3 = !s.getRuntimeConfigValue("api/v1beta3", !disableV1beta3)
|
disableV1beta3 = !s.getRuntimeConfigValue("api/v1beta3", !disableV1beta3)
|
||||||
|
|
||||||
// V1 is disabled by default. Users can enable it using "api/v1={true}".
|
// "api/v1={true|false} allows users to enable/disable v1 API.
|
||||||
_, enableV1 := s.RuntimeConfig["api/v1"]
|
// This takes preference over api/all and api/legacy, if specified.
|
||||||
|
disableV1 := disableAllAPIs
|
||||||
|
disableV1 = !s.getRuntimeConfigValue("api/v1", !disableV1)
|
||||||
|
|
||||||
// TODO: expose same flags as client.BindClientConfigFlags but for a server
|
// TODO: expose same flags as client.BindClientConfigFlags but for a server
|
||||||
clientConfig := &client.Config{
|
clientConfig := &client.Config{
|
||||||
@ -371,7 +373,7 @@ func (s *APIServer) Run(_ []string) error {
|
|||||||
Authorizer: authorizer,
|
Authorizer: authorizer,
|
||||||
AdmissionControl: admissionController,
|
AdmissionControl: admissionController,
|
||||||
DisableV1Beta3: disableV1beta3,
|
DisableV1Beta3: disableV1beta3,
|
||||||
EnableV1: enableV1,
|
DisableV1: disableV1,
|
||||||
MasterServiceNamespace: s.MasterServiceNamespace,
|
MasterServiceNamespace: s.MasterServiceNamespace,
|
||||||
ClusterName: s.ClusterName,
|
ClusterName: s.ClusterName,
|
||||||
ExternalHost: s.ExternalHost,
|
ExternalHost: s.ExternalHost,
|
||||||
|
@ -91,8 +91,8 @@ type Config struct {
|
|||||||
EnableSwaggerSupport bool
|
EnableSwaggerSupport bool
|
||||||
// allow v1beta3 to be conditionally disabled
|
// allow v1beta3 to be conditionally disabled
|
||||||
DisableV1Beta3 bool
|
DisableV1Beta3 bool
|
||||||
// allow v1 to be conditionally enabled
|
// allow v1 to be conditionally disabled
|
||||||
EnableV1 bool
|
DisableV1 bool
|
||||||
// allow downstream consumers to disable the index route
|
// allow downstream consumers to disable the index route
|
||||||
EnableIndex bool
|
EnableIndex bool
|
||||||
EnableProfiling bool
|
EnableProfiling bool
|
||||||
@ -313,7 +313,7 @@ func New(c *Config) *Master {
|
|||||||
authorizer: c.Authorizer,
|
authorizer: c.Authorizer,
|
||||||
admissionControl: c.AdmissionControl,
|
admissionControl: c.AdmissionControl,
|
||||||
v1beta3: !c.DisableV1Beta3,
|
v1beta3: !c.DisableV1Beta3,
|
||||||
v1: c.EnableV1,
|
v1: !c.DisableV1,
|
||||||
requestContextMapper: c.RequestContextMapper,
|
requestContextMapper: c.RequestContextMapper,
|
||||||
|
|
||||||
cacheTimeout: c.CacheTimeout,
|
cacheTimeout: c.CacheTimeout,
|
||||||
|
@ -397,7 +397,6 @@ func TestAuthModeAlwaysAllow(t *testing.T) {
|
|||||||
APIPrefix: "/api",
|
APIPrefix: "/api",
|
||||||
Authorizer: apiserver.NewAlwaysAllowAuthorizer(),
|
Authorizer: apiserver.NewAlwaysAllowAuthorizer(),
|
||||||
AdmissionControl: admit.NewAlwaysAdmit(),
|
AdmissionControl: admit.NewAlwaysAdmit(),
|
||||||
EnableV1: true,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport
|
||||||
@ -538,7 +537,6 @@ func TestAuthModeAlwaysDeny(t *testing.T) {
|
|||||||
APIPrefix: "/api",
|
APIPrefix: "/api",
|
||||||
Authorizer: apiserver.NewAlwaysDenyAuthorizer(),
|
Authorizer: apiserver.NewAlwaysDenyAuthorizer(),
|
||||||
AdmissionControl: admit.NewAlwaysAdmit(),
|
AdmissionControl: admit.NewAlwaysAdmit(),
|
||||||
EnableV1: true,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport
|
||||||
@ -607,7 +605,6 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
|
|||||||
Authenticator: getTestTokenAuth(),
|
Authenticator: getTestTokenAuth(),
|
||||||
Authorizer: allowAliceAuthorizer{},
|
Authorizer: allowAliceAuthorizer{},
|
||||||
AdmissionControl: admit.NewAlwaysAdmit(),
|
AdmissionControl: admit.NewAlwaysAdmit(),
|
||||||
EnableV1: true,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
previousResourceVersion := make(map[string]float64)
|
previousResourceVersion := make(map[string]float64)
|
||||||
@ -695,7 +692,6 @@ func TestBobIsForbidden(t *testing.T) {
|
|||||||
Authenticator: getTestTokenAuth(),
|
Authenticator: getTestTokenAuth(),
|
||||||
Authorizer: allowAliceAuthorizer{},
|
Authorizer: allowAliceAuthorizer{},
|
||||||
AdmissionControl: admit.NewAlwaysAdmit(),
|
AdmissionControl: admit.NewAlwaysAdmit(),
|
||||||
EnableV1: true,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport
|
||||||
@ -757,7 +753,6 @@ func TestUnknownUserIsUnauthorized(t *testing.T) {
|
|||||||
Authenticator: getTestTokenAuth(),
|
Authenticator: getTestTokenAuth(),
|
||||||
Authorizer: allowAliceAuthorizer{},
|
Authorizer: allowAliceAuthorizer{},
|
||||||
AdmissionControl: admit.NewAlwaysAdmit(),
|
AdmissionControl: admit.NewAlwaysAdmit(),
|
||||||
EnableV1: true,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport
|
||||||
@ -838,7 +833,6 @@ func TestNamespaceAuthorization(t *testing.T) {
|
|||||||
Authenticator: getTestTokenAuth(),
|
Authenticator: getTestTokenAuth(),
|
||||||
Authorizer: a,
|
Authorizer: a,
|
||||||
AdmissionControl: admit.NewAlwaysAdmit(),
|
AdmissionControl: admit.NewAlwaysAdmit(),
|
||||||
EnableV1: true,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
previousResourceVersion := make(map[string]float64)
|
previousResourceVersion := make(map[string]float64)
|
||||||
@ -954,7 +948,6 @@ func TestKindAuthorization(t *testing.T) {
|
|||||||
Authenticator: getTestTokenAuth(),
|
Authenticator: getTestTokenAuth(),
|
||||||
Authorizer: a,
|
Authorizer: a,
|
||||||
AdmissionControl: admit.NewAlwaysAdmit(),
|
AdmissionControl: admit.NewAlwaysAdmit(),
|
||||||
EnableV1: true,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
previousResourceVersion := make(map[string]float64)
|
previousResourceVersion := make(map[string]float64)
|
||||||
@ -1057,7 +1050,6 @@ func TestReadOnlyAuthorization(t *testing.T) {
|
|||||||
Authenticator: getTestTokenAuth(),
|
Authenticator: getTestTokenAuth(),
|
||||||
Authorizer: a,
|
Authorizer: a,
|
||||||
AdmissionControl: admit.NewAlwaysAdmit(),
|
AdmissionControl: admit.NewAlwaysAdmit(),
|
||||||
EnableV1: true,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport
|
||||||
|
@ -272,7 +272,6 @@ func RunAMaster(t *testing.T) (*master.Master, *httptest.Server) {
|
|||||||
APIPrefix: "/api",
|
APIPrefix: "/api",
|
||||||
Authorizer: apiserver.NewAlwaysAllowAuthorizer(),
|
Authorizer: apiserver.NewAlwaysAllowAuthorizer(),
|
||||||
AdmissionControl: admit.NewAlwaysAdmit(),
|
AdmissionControl: admit.NewAlwaysAdmit(),
|
||||||
EnableV1: true,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||||
|
@ -75,7 +75,6 @@ func TestUnschedulableNodes(t *testing.T) {
|
|||||||
APIPrefix: "/api",
|
APIPrefix: "/api",
|
||||||
Authorizer: apiserver.NewAlwaysAllowAuthorizer(),
|
Authorizer: apiserver.NewAlwaysAllowAuthorizer(),
|
||||||
AdmissionControl: admit.NewAlwaysAdmit(),
|
AdmissionControl: admit.NewAlwaysAdmit(),
|
||||||
EnableV1: true,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
restClient := client.NewOrDie(&client.Config{Host: s.URL, Version: testapi.Version()})
|
restClient := client.NewOrDie(&client.Config{Host: s.URL, Version: testapi.Version()})
|
||||||
|
@ -68,7 +68,6 @@ func TestSecrets(t *testing.T) {
|
|||||||
APIPrefix: "/api",
|
APIPrefix: "/api",
|
||||||
Authorizer: apiserver.NewAlwaysAllowAuthorizer(),
|
Authorizer: apiserver.NewAlwaysAllowAuthorizer(),
|
||||||
AdmissionControl: admit.NewAlwaysAdmit(),
|
AdmissionControl: admit.NewAlwaysAdmit(),
|
||||||
EnableV1: true,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
framework.DeleteAllEtcdKeys()
|
framework.DeleteAllEtcdKeys()
|
||||||
|
@ -419,7 +419,6 @@ func startServiceAccountTestServer(t *testing.T) (*client.Client, client.Config,
|
|||||||
Authenticator: authenticator,
|
Authenticator: authenticator,
|
||||||
Authorizer: authorizer,
|
Authorizer: authorizer,
|
||||||
AdmissionControl: serviceAccountAdmission,
|
AdmissionControl: serviceAccountAdmission,
|
||||||
EnableV1: true,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Start the service account and service account token controllers
|
// Start the service account and service account token controllers
|
||||||
|
@ -82,7 +82,6 @@ func runAMaster(t *testing.T) (*master.Master, *httptest.Server) {
|
|||||||
APIPrefix: "/api",
|
APIPrefix: "/api",
|
||||||
Authorizer: apiserver.NewAlwaysAllowAuthorizer(),
|
Authorizer: apiserver.NewAlwaysAllowAuthorizer(),
|
||||||
AdmissionControl: admit.NewAlwaysAdmit(),
|
AdmissionControl: admit.NewAlwaysAdmit(),
|
||||||
EnableV1: true,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||||
|
Loading…
Reference in New Issue
Block a user