Skip to content

Commit

Permalink
Keep kubelet's --cloud-provider flag even for 1.23+ (#417)
Browse files Browse the repository at this point in the history
Co-authored-by: Rafael Franzke <[email protected]>
  • Loading branch information
ialidzhikov and rfranzke authored Mar 11, 2022
1 parent 2de7056 commit 94f517f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/webhook/controlplane/ensurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,9 @@ func (e *ensurer) EnsureKubeletServiceUnitOptions(ctx context.Context, gctx gcon

func ensureKubeletCommandLineArgs(command []string, csiEnabled bool, kubeletVersion *semver.Version) []string {
if csiEnabled {
command = extensionswebhook.EnsureStringWithPrefix(command, "--cloud-provider=", "external")

if !versionutils.ConstraintK8sGreaterEqual123.Check(kubeletVersion) {
command = extensionswebhook.EnsureStringWithPrefix(command, "--cloud-provider=", "external")
command = extensionswebhook.EnsureStringWithPrefix(command, "--enable-controller-attach-detach=", "true")
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/webhook/controlplane/ensurer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ var _ = Describe("Ensurer", func() {

Entry("kubelet version < 1.19", eContextK8s116, semver.MustParse("1.16.0"), "openstack", false),
Entry("1.19 <= kubelet version < 1.23", eContextK8s119, semver.MustParse("1.19.0"), "external", true),
Entry("kubelet version >= 1.23", eContextK8s119, semver.MustParse("1.23.0"), "", false),
Entry("kubelet version >= 1.23", eContextK8s119, semver.MustParse("1.23.0"), "external", false),
)
})

Expand Down

0 comments on commit 94f517f

Please sign in to comment.