Skip to content

Commit

Permalink
Merge pull request #7180 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…6586-to-release-1.1

[release-1.1] ✨ Make KCP's patches option mutable
  • Loading branch information
k8s-ci-robot authored Sep 7, 2022
2 parents 46706c5 + 0836d77 commit be01874
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ const (
initConfiguration = "initConfiguration"
joinConfiguration = "joinConfiguration"
nodeRegistration = "nodeRegistration"
patches = "patches"
directory = "directory"
preKubeadmCommands = "preKubeadmCommands"
postKubeadmCommands = "postKubeadmCommands"
files = "files"
Expand Down Expand Up @@ -140,7 +142,9 @@ func (in *KubeadmControlPlane) ValidateUpdate(old runtime.Object) error {
{spec, kubeadmConfigSpec, clusterConfiguration, controllerManager, "*"},
{spec, kubeadmConfigSpec, clusterConfiguration, scheduler, "*"},
{spec, kubeadmConfigSpec, initConfiguration, nodeRegistration, "*"},
{spec, kubeadmConfigSpec, initConfiguration, patches, directory},
{spec, kubeadmConfigSpec, joinConfiguration, nodeRegistration, "*"},
{spec, kubeadmConfigSpec, joinConfiguration, patches, directory},
{spec, kubeadmConfigSpec, preKubeadmCommands},
{spec, kubeadmConfigSpec, postKubeadmCommands},
{spec, kubeadmConfigSpec, files},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,16 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
validIgnitionConfigurationAfter := validIgnitionConfigurationBefore.DeepCopy()
validIgnitionConfigurationAfter.Spec.KubeadmConfigSpec.Ignition.ContainerLinuxConfig.AdditionalConfig = "foo: bar"

updateInitConfigurationPatches := before.DeepCopy()
updateInitConfigurationPatches.Spec.KubeadmConfigSpec.InitConfiguration.Patches = &bootstrapv1.Patches{
Directory: "/tmp/patches",
}

updateJoinConfigurationPatches := before.DeepCopy()
updateJoinConfigurationPatches.Spec.KubeadmConfigSpec.InitConfiguration.Patches = &bootstrapv1.Patches{
Directory: "/tmp/patches",
}

tests := []struct {
name string
enableIgnitionFeature bool
Expand Down Expand Up @@ -900,6 +910,18 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
before: before,
kcp: disableNTPServers,
},
{
name: "should allow changes to initConfiguration.patches",
expectErr: false,
before: before,
kcp: updateInitConfigurationPatches,
},
{
name: "should allow changes to joinConfiguration.patches",
expectErr: false,
before: before,
kcp: updateJoinConfigurationPatches,
},
{
name: "should return error when Ignition configuration is invalid",
enableIgnitionFeature: true,
Expand Down

0 comments on commit be01874

Please sign in to comment.