Skip to content

Commit

Permalink
Adapt to the removal of the PersistentVolumeLabel admission plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ialidzhikov committed Oct 14, 2024
1 parent 249a153 commit 8cf0fda
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions pkg/webhook/controlplane/ensurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,12 @@ func ensureKubeAPIServerCommandLineArgs(c *corev1.Container, k8sVersion *semver.

c.Command = extensionswebhook.EnsureNoStringWithPrefix(c.Command, "--cloud-provider=")
c.Command = extensionswebhook.EnsureNoStringWithPrefix(c.Command, "--cloud-config=")
c.Command = extensionswebhook.EnsureNoStringWithPrefixContains(c.Command, "--enable-admission-plugins=",
"PersistentVolumeLabel", ",")
c.Command = extensionswebhook.EnsureStringWithPrefixContains(c.Command, "--disable-admission-plugins=",
"PersistentVolumeLabel", ",")
if constraintK8sLess131.Check(k8sVersion) {
c.Command = extensionswebhook.EnsureNoStringWithPrefixContains(c.Command, "--enable-admission-plugins=",
"PersistentVolumeLabel", ",")
c.Command = extensionswebhook.EnsureStringWithPrefixContains(c.Command, "--disable-admission-plugins=",
"PersistentVolumeLabel", ",")
}
}

func ensureKubeControllerManagerCommandLineArgs(c *corev1.Container, k8sVersion *semver.Version) {
Expand Down
6 changes: 4 additions & 2 deletions pkg/webhook/controlplane/ensurer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,8 +858,10 @@ func checkKubeAPIServerDeployment(dep *appsv1.Deployment, k8sVersion string) {
}
Expect(c.Command).NotTo(ContainElement("--cloud-provider=aws"))
Expect(c.Command).NotTo(ContainElement("--cloud-config=/etc/kubernetes/cloudprovider/cloudprovider.conf"))
Expect(c.Command).NotTo(test.ContainElementWithPrefixContaining("--enable-admission-plugins=", "PersistentVolumeLabel", ","))
Expect(c.Command).To(test.ContainElementWithPrefixContaining("--disable-admission-plugins=", "PersistentVolumeLabel", ","))
if !k8sVersionAtLeast131 {
Expect(c.Command).NotTo(test.ContainElementWithPrefixContaining("--enable-admission-plugins=", "PersistentVolumeLabel", ","))
Expect(c.Command).To(test.ContainElementWithPrefixContaining("--disable-admission-plugins=", "PersistentVolumeLabel", ","))
}
Expect(c.Env).NotTo(ContainElement(accessKeyIDEnvVar))
Expect(c.Env).NotTo(ContainElement(secretAccessKeyEnvVar))
Expect(dep.Spec.Template.Annotations).To(BeNil())
Expand Down

0 comments on commit 8cf0fda

Please sign in to comment.