mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Stop exposing v1beta3 by default
This commit is contained in:
		@@ -152,6 +152,8 @@ func startComponents(firstManifestURL, secondManifestURL, apiVersion string) (st
 | 
			
		||||
		glog.Fatalf("no public address for %s", host)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Enable v1beta3 in master only if we are starting the components for that api version.
 | 
			
		||||
	enableV1Beta3 := apiVersion == "v1beta3"
 | 
			
		||||
	// Create a master and install handlers into mux.
 | 
			
		||||
	m := master.New(&master.Config{
 | 
			
		||||
		EtcdHelper:            helper,
 | 
			
		||||
@@ -160,6 +162,7 @@ func startComponents(firstManifestURL, secondManifestURL, apiVersion string) (st
 | 
			
		||||
		EnableLogsSupport:     false,
 | 
			
		||||
		EnableProfiling:       true,
 | 
			
		||||
		APIPrefix:             "/api",
 | 
			
		||||
		EnableV1Beta3:         enableV1Beta3,
 | 
			
		||||
		Authorizer:            apiserver.NewAlwaysAllowAuthorizer(),
 | 
			
		||||
		AdmissionControl:      admit.NewAlwaysAdmit(),
 | 
			
		||||
		ReadWritePort:         portNumber,
 | 
			
		||||
 
 | 
			
		||||
@@ -275,7 +275,6 @@ func (s *APIServer) Run(_ []string) error {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// "api/legacy=false" allows users to disable legacy api versions.
 | 
			
		||||
	// Right now, v1beta1 and v1beta2 are considered legacy.
 | 
			
		||||
	disableLegacyAPIs := false
 | 
			
		||||
	legacyAPIFlagValue, ok := s.RuntimeConfig["api/legacy"]
 | 
			
		||||
	if ok && legacyAPIFlagValue == "false" {
 | 
			
		||||
@@ -283,10 +282,8 @@ func (s *APIServer) Run(_ []string) error {
 | 
			
		||||
	}
 | 
			
		||||
	_ = disableLegacyAPIs // hush the compiler while we don't have legacy APIs to disable.
 | 
			
		||||
 | 
			
		||||
	// "api/v1beta3={true|false} allows users to enable/disable v1beta3 API.
 | 
			
		||||
	// This takes preference over api/all and api/legacy, if specified.
 | 
			
		||||
	disableV1beta3 := disableAllAPIs
 | 
			
		||||
	disableV1beta3 = !s.getRuntimeConfigValue("api/v1beta3", !disableV1beta3)
 | 
			
		||||
	// v1beta3 is disabled by default. Users can enable it using "api/v1beta3=true"
 | 
			
		||||
	enableV1beta3 := s.getRuntimeConfigValue("api/v1beta3", false)
 | 
			
		||||
 | 
			
		||||
	// "api/v1={true|false} allows users to enable/disable v1 API.
 | 
			
		||||
	// This takes preference over api/all and api/legacy, if specified.
 | 
			
		||||
@@ -387,7 +384,7 @@ func (s *APIServer) Run(_ []string) error {
 | 
			
		||||
		SupportsBasicAuth:      len(s.BasicAuthFile) > 0,
 | 
			
		||||
		Authorizer:             authorizer,
 | 
			
		||||
		AdmissionControl:       admissionController,
 | 
			
		||||
		DisableV1Beta3:         disableV1beta3,
 | 
			
		||||
		EnableV1Beta3:          enableV1beta3,
 | 
			
		||||
		DisableV1:              disableV1,
 | 
			
		||||
		MasterServiceNamespace: s.MasterServiceNamespace,
 | 
			
		||||
		ClusterName:            s.ClusterName,
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@ func init() {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// The default list of supported api versions, in order of most preferred to the least.
 | 
			
		||||
	defaultSupportedVersions := "v1,v1beta3"
 | 
			
		||||
	defaultSupportedVersions := "v1"
 | 
			
		||||
	// Env var KUBE_API_VERSIONS is a comma separated list of API versions that should be registered in the scheme.
 | 
			
		||||
	// The versions should be in the order of most preferred to the least.
 | 
			
		||||
	supportedVersions := os.Getenv("KUBE_API_VERSIONS")
 | 
			
		||||
 
 | 
			
		||||
@@ -95,8 +95,8 @@ type Config struct {
 | 
			
		||||
	EnableUISupport       bool
 | 
			
		||||
	// allow downstream consumers to disable swagger
 | 
			
		||||
	EnableSwaggerSupport bool
 | 
			
		||||
	// allow v1beta3 to be conditionally disabled
 | 
			
		||||
	DisableV1Beta3 bool
 | 
			
		||||
	// allow v1beta3 to be conditionally enabled
 | 
			
		||||
	EnableV1Beta3 bool
 | 
			
		||||
	// allow v1 to be conditionally disabled
 | 
			
		||||
	DisableV1 bool
 | 
			
		||||
	// allow downstream consumers to disable the index route
 | 
			
		||||
@@ -337,7 +337,7 @@ func New(c *Config) *Master {
 | 
			
		||||
		authenticator:         c.Authenticator,
 | 
			
		||||
		authorizer:            c.Authorizer,
 | 
			
		||||
		admissionControl:      c.AdmissionControl,
 | 
			
		||||
		v1beta3:               !c.DisableV1Beta3,
 | 
			
		||||
		v1beta3:               c.EnableV1Beta3,
 | 
			
		||||
		v1:                    !c.DisableV1,
 | 
			
		||||
		requestContextMapper:  c.RequestContextMapper,
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -393,6 +393,8 @@ func TestAuthModeAlwaysAllow(t *testing.T) {
 | 
			
		||||
		EnableUISupport:       false,
 | 
			
		||||
		EnableIndex:           true,
 | 
			
		||||
		APIPrefix:             "/api",
 | 
			
		||||
		// enable v1beta3 if we are testing that api version.
 | 
			
		||||
		EnableV1Beta3:    testapi.Version() == "v1beta3",
 | 
			
		||||
		Authorizer:       apiserver.NewAlwaysAllowAuthorizer(),
 | 
			
		||||
		AdmissionControl: admit.NewAlwaysAdmit(),
 | 
			
		||||
	})
 | 
			
		||||
@@ -509,6 +511,8 @@ func TestAuthModeAlwaysDeny(t *testing.T) {
 | 
			
		||||
		EnableUISupport:       false,
 | 
			
		||||
		EnableIndex:           true,
 | 
			
		||||
		APIPrefix:             "/api",
 | 
			
		||||
		// enable v1beta3 if we are testing that api version.
 | 
			
		||||
		EnableV1Beta3:    testapi.Version() == "v1beta3",
 | 
			
		||||
		Authorizer:       apiserver.NewAlwaysDenyAuthorizer(),
 | 
			
		||||
		AdmissionControl: admit.NewAlwaysAdmit(),
 | 
			
		||||
	})
 | 
			
		||||
@@ -576,6 +580,8 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
 | 
			
		||||
		EnableUISupport:       false,
 | 
			
		||||
		EnableIndex:           true,
 | 
			
		||||
		APIPrefix:             "/api",
 | 
			
		||||
		// enable v1beta3 if we are testing that api version.
 | 
			
		||||
		EnableV1Beta3:    testapi.Version() == "v1beta3",
 | 
			
		||||
		Authenticator:    getTestTokenAuth(),
 | 
			
		||||
		Authorizer:       allowAliceAuthorizer{},
 | 
			
		||||
		AdmissionControl: admit.NewAlwaysAdmit(),
 | 
			
		||||
@@ -663,6 +669,8 @@ func TestBobIsForbidden(t *testing.T) {
 | 
			
		||||
		EnableUISupport:       false,
 | 
			
		||||
		EnableIndex:           true,
 | 
			
		||||
		APIPrefix:             "/api",
 | 
			
		||||
		// enable v1beta3 if we are testing that api version.
 | 
			
		||||
		EnableV1Beta3:    testapi.Version() == "v1beta3",
 | 
			
		||||
		Authenticator:    getTestTokenAuth(),
 | 
			
		||||
		Authorizer:       allowAliceAuthorizer{},
 | 
			
		||||
		AdmissionControl: admit.NewAlwaysAdmit(),
 | 
			
		||||
@@ -724,6 +732,8 @@ func TestUnknownUserIsUnauthorized(t *testing.T) {
 | 
			
		||||
		EnableUISupport:       false,
 | 
			
		||||
		EnableIndex:           true,
 | 
			
		||||
		APIPrefix:             "/api",
 | 
			
		||||
		// enable v1beta3 if we are testing that api version.
 | 
			
		||||
		EnableV1Beta3:    testapi.Version() == "v1beta3",
 | 
			
		||||
		Authenticator:    getTestTokenAuth(),
 | 
			
		||||
		Authorizer:       allowAliceAuthorizer{},
 | 
			
		||||
		AdmissionControl: admit.NewAlwaysAdmit(),
 | 
			
		||||
@@ -804,6 +814,8 @@ func TestNamespaceAuthorization(t *testing.T) {
 | 
			
		||||
		EnableUISupport:       false,
 | 
			
		||||
		EnableIndex:           true,
 | 
			
		||||
		APIPrefix:             "/api",
 | 
			
		||||
		// enable v1beta3 if we are testing that api version.
 | 
			
		||||
		EnableV1Beta3:    testapi.Version() == "v1beta3",
 | 
			
		||||
		Authenticator:    getTestTokenAuth(),
 | 
			
		||||
		Authorizer:       a,
 | 
			
		||||
		AdmissionControl: admit.NewAlwaysAdmit(),
 | 
			
		||||
@@ -919,6 +931,8 @@ func TestKindAuthorization(t *testing.T) {
 | 
			
		||||
		EnableUISupport:       false,
 | 
			
		||||
		EnableIndex:           true,
 | 
			
		||||
		APIPrefix:             "/api",
 | 
			
		||||
		// enable v1beta3 if we are testing that api version.
 | 
			
		||||
		EnableV1Beta3:    testapi.Version() == "v1beta3",
 | 
			
		||||
		Authenticator:    getTestTokenAuth(),
 | 
			
		||||
		Authorizer:       a,
 | 
			
		||||
		AdmissionControl: admit.NewAlwaysAdmit(),
 | 
			
		||||
@@ -1021,6 +1035,8 @@ func TestReadOnlyAuthorization(t *testing.T) {
 | 
			
		||||
		EnableUISupport:       false,
 | 
			
		||||
		EnableIndex:           true,
 | 
			
		||||
		APIPrefix:             "/api",
 | 
			
		||||
		// enable v1beta3 if we are testing that api version.
 | 
			
		||||
		EnableV1Beta3:    testapi.Version() == "v1beta3",
 | 
			
		||||
		Authenticator:    getTestTokenAuth(),
 | 
			
		||||
		Authorizer:       a,
 | 
			
		||||
		AdmissionControl: admit.NewAlwaysAdmit(),
 | 
			
		||||
 
 | 
			
		||||
@@ -139,6 +139,8 @@ func startMasterOrDie(masterConfig *master.Config) (*master.Master, *httptest.Se
 | 
			
		||||
			EnableProfiling:   true,
 | 
			
		||||
			EnableUISupport:   false,
 | 
			
		||||
			APIPrefix:         "/api",
 | 
			
		||||
			// Enable v1bewta3 if we are testing that version
 | 
			
		||||
			EnableV1Beta3:    testapi.Version() == "v1beta3",
 | 
			
		||||
			Authorizer:       apiserver.NewAlwaysAllowAuthorizer(),
 | 
			
		||||
			AdmissionControl: admit.NewAlwaysAdmit(),
 | 
			
		||||
		}
 | 
			
		||||
@@ -270,6 +272,8 @@ func RunAMaster(t *testing.T) (*master.Master, *httptest.Server) {
 | 
			
		||||
		EnableProfiling:   true,
 | 
			
		||||
		EnableUISupport:   false,
 | 
			
		||||
		APIPrefix:         "/api",
 | 
			
		||||
		// Enable v1bewta3 if we are testing that version
 | 
			
		||||
		EnableV1Beta3:    testapi.Version() == "v1beta3",
 | 
			
		||||
		Authorizer:       apiserver.NewAlwaysAllowAuthorizer(),
 | 
			
		||||
		AdmissionControl: admit.NewAlwaysAdmit(),
 | 
			
		||||
	})
 | 
			
		||||
 
 | 
			
		||||
@@ -73,6 +73,8 @@ func TestUnschedulableNodes(t *testing.T) {
 | 
			
		||||
		EnableUISupport:       false,
 | 
			
		||||
		EnableIndex:           true,
 | 
			
		||||
		APIPrefix:             "/api",
 | 
			
		||||
		// Enable v1beta3 if we are testing that version.
 | 
			
		||||
		EnableV1Beta3:    testapi.Version() == "v1beta3",
 | 
			
		||||
		Authorizer:       apiserver.NewAlwaysAllowAuthorizer(),
 | 
			
		||||
		AdmissionControl: admit.NewAlwaysAdmit(),
 | 
			
		||||
	})
 | 
			
		||||
 
 | 
			
		||||
@@ -66,6 +66,8 @@ func TestSecrets(t *testing.T) {
 | 
			
		||||
		EnableUISupport:       false,
 | 
			
		||||
		EnableIndex:           true,
 | 
			
		||||
		APIPrefix:             "/api",
 | 
			
		||||
		// Enable v1beta3 if we are testing that version.
 | 
			
		||||
		EnableV1Beta3:    testapi.Version() == "v1beta3",
 | 
			
		||||
		Authorizer:       apiserver.NewAlwaysAllowAuthorizer(),
 | 
			
		||||
		AdmissionControl: admit.NewAlwaysAdmit(),
 | 
			
		||||
	})
 | 
			
		||||
 
 | 
			
		||||
@@ -416,6 +416,8 @@ func startServiceAccountTestServer(t *testing.T) (*client.Client, client.Config,
 | 
			
		||||
		EnableUISupport:   false,
 | 
			
		||||
		EnableIndex:       true,
 | 
			
		||||
		APIPrefix:         "/api",
 | 
			
		||||
		// Enable v1beta3 if we are testing that version.
 | 
			
		||||
		EnableV1Beta3:    testapi.Version() == "v1beta3",
 | 
			
		||||
		Authenticator:    authenticator,
 | 
			
		||||
		Authorizer:       authorizer,
 | 
			
		||||
		AdmissionControl: serviceAccountAdmission,
 | 
			
		||||
 
 | 
			
		||||
@@ -80,6 +80,8 @@ func runAMaster(t *testing.T) (*master.Master, *httptest.Server) {
 | 
			
		||||
		EnableProfiling:       true,
 | 
			
		||||
		EnableUISupport:       false,
 | 
			
		||||
		APIPrefix:             "/api",
 | 
			
		||||
		// Enable v1beta3 if we are testing that version.
 | 
			
		||||
		EnableV1Beta3:    testapi.Version() == "v1beta3",
 | 
			
		||||
		Authorizer:       apiserver.NewAlwaysAllowAuthorizer(),
 | 
			
		||||
		AdmissionControl: admit.NewAlwaysAdmit(),
 | 
			
		||||
	})
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user