mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Add feature toggle for OpenAPI V3 apply in kubectl
This commit is contained in:
		@@ -288,7 +288,7 @@ func (flags *ApplyFlags) ToOptions(f cmdutil.Factory, cmd *cobra.Command, baseNa
 | 
			
		||||
	openAPISchema, _ := f.OpenAPISchema()
 | 
			
		||||
	var openAPIV3Root openapi3.Root
 | 
			
		||||
	openAPIV3Client, err := f.OpenAPIV3Client()
 | 
			
		||||
	if err == nil {
 | 
			
		||||
	if err == nil && !cmdutil.OpenAPIV3Apply.IsDisabled() {
 | 
			
		||||
		cachedOpenAPIV3Client := cachedopenapi.NewClient(openAPIV3Client)
 | 
			
		||||
		openAPIV3Root = openapi3.NewRoot(cachedOpenAPIV3Client)
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -195,3 +195,18 @@ func WithAlphaEnvs(features []cmdutil.FeatureGate, t *testing.T, f func(*testing
 | 
			
		||||
	}
 | 
			
		||||
	f(t)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// WithAlphaEnvs calls func f with the given env-var-based feature gates disabled,
 | 
			
		||||
// and then restores the original values of those variables.
 | 
			
		||||
func WithAlphaEnvsDisabled(features []cmdutil.FeatureGate, t *testing.T, f func(*testing.T)) {
 | 
			
		||||
	for _, feature := range features {
 | 
			
		||||
		key := string(feature)
 | 
			
		||||
		if key != "" {
 | 
			
		||||
			oldValue := os.Getenv(key)
 | 
			
		||||
			err := os.Setenv(key, "false")
 | 
			
		||||
			require.NoError(t, err, "unexpected error setting alpha env")
 | 
			
		||||
			defer os.Setenv(key, oldValue)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	f(t)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -428,6 +428,7 @@ const (
 | 
			
		||||
	ApplySet                FeatureGate = "KUBECTL_APPLYSET"
 | 
			
		||||
	CmdPluginAsSubcommand   FeatureGate = "KUBECTL_ENABLE_CMD_SHADOW"
 | 
			
		||||
	InteractiveDelete       FeatureGate = "KUBECTL_INTERACTIVE_DELETE"
 | 
			
		||||
	OpenAPIV3Apply          FeatureGate = "KUBECTL_OPENAPIV3_APPLY"
 | 
			
		||||
	RemoteCommandWebsockets FeatureGate = "KUBECTL_REMOTE_COMMAND_WEBSOCKETS"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user