From e74f2d41aabc2c27db6f2a2a005572c8dd332912 Mon Sep 17 00:00:00 2001 From: Maciej Szulik Date: Mon, 23 Oct 2023 11:40:41 +0200 Subject: [PATCH] Allow using upper and lower case true|false when setting kubectl feature flags --- staging/src/k8s.io/kubectl/pkg/cmd/util/helpers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/util/helpers.go b/staging/src/k8s.io/kubectl/pkg/cmd/util/helpers.go index 1f16632d9d9..bbb6e701bbe 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/util/helpers.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/util/helpers.go @@ -432,7 +432,7 @@ const ( // IsEnabled returns true iff environment variable is set to true. // All other cases, it returns false. 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. @@ -440,7 +440,7 @@ func (f FeatureGate) IsEnabled() bool { // 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. func (f FeatureGate) IsDisabled() bool { - return os.Getenv(string(f)) == "false" + return strings.ToLower(os.Getenv(string(f))) == "false" } func AddValidateFlags(cmd *cobra.Command) {