Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing unwanted feature gate(KubeletCredentialProviders) option #1176

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions credentialproviderpackage/pkg/configurator/linux/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,6 @@ func (c *linuxOS) createConfig() (string, error) {

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

val, err := c.createConfig()
if err != nil {
Expand Down
30 changes: 5 additions & 25 deletions credentialproviderpackage/pkg/configurator/linux/linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ func Test_linuxOS_updateKubeletArguments(t *testing.T) {
args: args{line: ""},
outputConfigPath: dir + "/" + credProviderFile,
configWantPath: "testdata/expected-config.yaml",
want: fmt.Sprintf(" --feature-gates=KubeletCredentialProviders=true "+
"--image-credential-provider-config=%s%s", dir, credProviderFile),
want: fmt.Sprintf(" --image-credential-provider-config=%s%s", dir, credProviderFile),
},
{
name: "test multiple match patterns",
Expand All @@ -67,27 +66,10 @@ func Test_linuxOS_updateKubeletArguments(t *testing.T) {
args: args{line: ""},
outputConfigPath: dir + "/" + credProviderFile,
configWantPath: "testdata/expected-config-multiple-patterns.yaml",
want: fmt.Sprintf(" --feature-gates=KubeletCredentialProviders=true "+
"--image-credential-provider-config=%s%s", dir, credProviderFile),
},
{
name: "skip credential provider if already provided",
fields: fields{
profile: "eksa-packages",
extraArgsPath: dir,
basePath: dir,
config: constants.CredentialProviderConfigOptions{
ImagePatterns: []string{constants.DefaultImagePattern},
DefaultCacheDuration: constants.DefaultCacheDuration,
},
},
args: args{line: " --feature-gates=KubeletCredentialProviders=true"},
outputConfigPath: dir + "/" + credProviderFile,
configWantPath: "testdata/expected-config.yaml",
want: fmt.Sprintf(" --image-credential-provider-config=%s%s", dir, credProviderFile),
},
{
name: "skip both cred provider and feature gate if provided",
name: "skip credential provider if already provided",
fields: fields{
profile: "eksa-packages",
extraArgsPath: dir,
Expand All @@ -97,7 +79,7 @@ func Test_linuxOS_updateKubeletArguments(t *testing.T) {
DefaultCacheDuration: constants.DefaultCacheDuration,
},
},
args: args{line: " --feature-gates=KubeletCredentialProviders=false --image-credential-provider-config=blah"},
args: args{line: " --image-credential-provider-config=blah"},
outputConfigPath: dir + "/" + credProviderFile,
configWantPath: "",
want: "",
Expand All @@ -117,8 +99,7 @@ func Test_linuxOS_updateKubeletArguments(t *testing.T) {
outputConfigPath: dir + "/" + credProviderFile,
configWantPath: "testdata/expected-config-alpha.yaml",
k8sVersion: "v1.25",
want: fmt.Sprintf(" --feature-gates=KubeletCredentialProviders=true "+
"--image-credential-provider-config=%s%s", dir, credProviderFile),
want: fmt.Sprintf(" --image-credential-provider-config=%s%s", dir, credProviderFile),
},
{
name: "test v1 api 1.27",
Expand All @@ -135,8 +116,7 @@ func Test_linuxOS_updateKubeletArguments(t *testing.T) {
outputConfigPath: dir + "/" + credProviderFile,
configWantPath: "testdata/expected-config.yaml",
k8sVersion: "v1.27",
want: fmt.Sprintf(" --feature-gates=KubeletCredentialProviders=true "+
"--image-credential-provider-config=%s%s", dir, credProviderFile),
want: fmt.Sprintf(" --image-credential-provider-config=%s%s", dir, credProviderFile),
},
}
for _, tt := range tests {
Expand Down
Loading