Skip to content

Commit c12e976

Browse files
authored
Removing unwanted feature gate(KubeletCredentialProviders) option (#1176)
1 parent 3cb6452 commit c12e976

File tree

2 files changed

+5
-31
lines changed

2 files changed

+5
-31
lines changed

credentialproviderpackage/pkg/configurator/linux/linux.go

-6
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,6 @@ func (c *linuxOS) createConfig() (string, error) {
217217

218218
func (c *linuxOS) updateKubeletArguments(line string) string {
219219
args := ""
220-
k8sVersion := os.Getenv("K8S_VERSION")
221-
if semver.Compare(k8sVersion, "v1.26") < 0 {
222-
if !strings.Contains(line, "KubeletCredentialProviders") {
223-
args += " --feature-gates=KubeletCredentialProviders=true"
224-
}
225-
}
226220

227221
val, err := c.createConfig()
228222
if err != nil {

credentialproviderpackage/pkg/configurator/linux/linux_test.go

+5-25
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ func Test_linuxOS_updateKubeletArguments(t *testing.T) {
4747
args: args{line: ""},
4848
outputConfigPath: dir + "/" + credProviderFile,
4949
configWantPath: "testdata/expected-config.yaml",
50-
want: fmt.Sprintf(" --feature-gates=KubeletCredentialProviders=true "+
51-
"--image-credential-provider-config=%s%s", dir, credProviderFile),
50+
want: fmt.Sprintf(" --image-credential-provider-config=%s%s", dir, credProviderFile),
5251
},
5352
{
5453
name: "test multiple match patterns",
@@ -67,27 +66,10 @@ func Test_linuxOS_updateKubeletArguments(t *testing.T) {
6766
args: args{line: ""},
6867
outputConfigPath: dir + "/" + credProviderFile,
6968
configWantPath: "testdata/expected-config-multiple-patterns.yaml",
70-
want: fmt.Sprintf(" --feature-gates=KubeletCredentialProviders=true "+
71-
"--image-credential-provider-config=%s%s", dir, credProviderFile),
72-
},
73-
{
74-
name: "skip credential provider if already provided",
75-
fields: fields{
76-
profile: "eksa-packages",
77-
extraArgsPath: dir,
78-
basePath: dir,
79-
config: constants.CredentialProviderConfigOptions{
80-
ImagePatterns: []string{constants.DefaultImagePattern},
81-
DefaultCacheDuration: constants.DefaultCacheDuration,
82-
},
83-
},
84-
args: args{line: " --feature-gates=KubeletCredentialProviders=true"},
85-
outputConfigPath: dir + "/" + credProviderFile,
86-
configWantPath: "testdata/expected-config.yaml",
8769
want: fmt.Sprintf(" --image-credential-provider-config=%s%s", dir, credProviderFile),
8870
},
8971
{
90-
name: "skip both cred provider and feature gate if provided",
72+
name: "skip credential provider if already provided",
9173
fields: fields{
9274
profile: "eksa-packages",
9375
extraArgsPath: dir,
@@ -97,7 +79,7 @@ func Test_linuxOS_updateKubeletArguments(t *testing.T) {
9779
DefaultCacheDuration: constants.DefaultCacheDuration,
9880
},
9981
},
100-
args: args{line: " --feature-gates=KubeletCredentialProviders=false --image-credential-provider-config=blah"},
82+
args: args{line: " --image-credential-provider-config=blah"},
10183
outputConfigPath: dir + "/" + credProviderFile,
10284
configWantPath: "",
10385
want: "",
@@ -117,8 +99,7 @@ func Test_linuxOS_updateKubeletArguments(t *testing.T) {
11799
outputConfigPath: dir + "/" + credProviderFile,
118100
configWantPath: "testdata/expected-config-alpha.yaml",
119101
k8sVersion: "v1.25",
120-
want: fmt.Sprintf(" --feature-gates=KubeletCredentialProviders=true "+
121-
"--image-credential-provider-config=%s%s", dir, credProviderFile),
102+
want: fmt.Sprintf(" --image-credential-provider-config=%s%s", dir, credProviderFile),
122103
},
123104
{
124105
name: "test v1 api 1.27",
@@ -135,8 +116,7 @@ func Test_linuxOS_updateKubeletArguments(t *testing.T) {
135116
outputConfigPath: dir + "/" + credProviderFile,
136117
configWantPath: "testdata/expected-config.yaml",
137118
k8sVersion: "v1.27",
138-
want: fmt.Sprintf(" --feature-gates=KubeletCredentialProviders=true "+
139-
"--image-credential-provider-config=%s%s", dir, credProviderFile),
119+
want: fmt.Sprintf(" --image-credential-provider-config=%s%s", dir, credProviderFile),
140120
},
141121
}
142122
for _, tt := range tests {

0 commit comments

Comments
 (0)