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

✨ Make KCP's patches option mutable #6586

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ const (
initConfiguration = "initConfiguration"
joinConfiguration = "joinConfiguration"
nodeRegistration = "nodeRegistration"
patches = "patches"
directory = "directory"
preKubeadmCommands = "preKubeadmCommands"
postKubeadmCommands = "postKubeadmCommands"
files = "files"
Expand Down Expand Up @@ -142,7 +144,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 @@ -608,6 +608,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 @@ -914,6 +924,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