Allow using upper and lower case true|false when setting kubectl feature flags

Kubernetes-commit: e74f2d41aabc2c27db6f2a2a005572c8dd332912
This commit is contained in:
Maciej Szulik 2023-10-23 11:40:41 +02:00 committed by Kubernetes Publisher
parent c2f0957625
commit bdf68c0441
1 changed files with 2 additions and 2 deletions

View File

@ -432,7 +432,7 @@ const (
// IsEnabled returns true iff environment variable is set to true. // IsEnabled returns true iff environment variable is set to true.
// All other cases, it returns false. // All other cases, it returns false.
func (f FeatureGate) IsEnabled() bool { func (f FeatureGate) IsEnabled() bool {
return os.Getenv(string(f)) == "true" return strings.ToLower(os.Getenv(string(f))) == "true"
} }
// IsDisabled returns true iff environment variable is set to false. // IsDisabled returns true iff environment variable is set to false.
@ -440,7 +440,7 @@ func (f FeatureGate) IsEnabled() bool {
// This function is used for the cases where feature is enabled by default, // This function is used for the cases where feature is enabled by default,
// but it may be needed to provide a way to ability to disable this feature. // but it may be needed to provide a way to ability to disable this feature.
func (f FeatureGate) IsDisabled() bool { func (f FeatureGate) IsDisabled() bool {
return os.Getenv(string(f)) == "false" return strings.ToLower(os.Getenv(string(f))) == "false"
} }
func AddValidateFlags(cmd *cobra.Command) { func AddValidateFlags(cmd *cobra.Command) {