Skip to content

Commit 2e7b8f8

Browse files
authored
Merge pull request #7646 from dntosas/feat/make-skip-phases-mutable-on-kcp
✨ [kcp] Make kcp.skipPhases field mutable
2 parents bae19a2 + 650b187 commit 2e7b8f8

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

controlplane/kubeadm/api/v1beta1/kubeadm_control_plane_webhook.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ const (
115115
initConfiguration = "initConfiguration"
116116
joinConfiguration = "joinConfiguration"
117117
nodeRegistration = "nodeRegistration"
118+
skipPhases = "skipPhases"
118119
patches = "patches"
119120
directory = "directory"
120121
preKubeadmCommands = "preKubeadmCommands"
@@ -148,8 +149,10 @@ func (in *KubeadmControlPlane) ValidateUpdate(old runtime.Object) error {
148149
{spec, kubeadmConfigSpec, clusterConfiguration, scheduler, "*"},
149150
{spec, kubeadmConfigSpec, initConfiguration, nodeRegistration, "*"},
150151
{spec, kubeadmConfigSpec, initConfiguration, patches, directory},
152+
{spec, kubeadmConfigSpec, initConfiguration, skipPhases},
151153
{spec, kubeadmConfigSpec, joinConfiguration, nodeRegistration, "*"},
152154
{spec, kubeadmConfigSpec, joinConfiguration, patches, directory},
155+
{spec, kubeadmConfigSpec, joinConfiguration, skipPhases},
153156
{spec, kubeadmConfigSpec, preKubeadmCommands},
154157
{spec, kubeadmConfigSpec, postKubeadmCommands},
155158
{spec, kubeadmConfigSpec, files},

controlplane/kubeadm/api/v1beta1/kubeadm_control_plane_webhook_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,12 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
651651
Directory: "/tmp/patches",
652652
}
653653

654+
updateInitConfigurationSkipPhases := before.DeepCopy()
655+
updateInitConfigurationSkipPhases.Spec.KubeadmConfigSpec.InitConfiguration.SkipPhases = []string{"addon/kube-proxy"}
656+
657+
updateJoinConfigurationSkipPhases := before.DeepCopy()
658+
updateJoinConfigurationSkipPhases.Spec.KubeadmConfigSpec.JoinConfiguration.SkipPhases = []string{"addon/kube-proxy"}
659+
654660
updateDiskSetup := before.DeepCopy()
655661
updateDiskSetup.Spec.KubeadmConfigSpec.DiskSetup = &bootstrapv1.DiskSetup{
656662
Filesystems: []bootstrapv1.Filesystem{
@@ -985,6 +991,18 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
985991
before: before,
986992
kcp: updateJoinConfigurationPatches,
987993
},
994+
{
995+
name: "should allow changes to initConfiguration.skipPhases",
996+
expectErr: false,
997+
before: before,
998+
kcp: updateInitConfigurationSkipPhases,
999+
},
1000+
{
1001+
name: "should allow changes to joinConfiguration.skipPhases",
1002+
expectErr: false,
1003+
before: before,
1004+
kcp: updateJoinConfigurationSkipPhases,
1005+
},
9881006
{
9891007
name: "should allow changes to diskSetup",
9901008
expectErr: false,

0 commit comments

Comments
 (0)