Skip to content

Commit 6adb3eb

Browse files
authored
Merge pull request #7351 from gottwald/ig/mutable-disk-setup
🌱 Make KCP diskSetup field mutable
2 parents 1a71841 + d88875c commit 6adb3eb

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

controlplane/kubeadm/api/v1beta1/kubeadm_control_plane_webhook.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ const (
126126
scheduler = "scheduler"
127127
ntp = "ntp"
128128
ignition = "ignition"
129+
diskSetup = "diskSetup"
129130
)
130131

131132
const minimumCertificatesExpiryDays = 7
@@ -156,6 +157,7 @@ func (in *KubeadmControlPlane) ValidateUpdate(old runtime.Object) error {
156157
{spec, kubeadmConfigSpec, users},
157158
{spec, kubeadmConfigSpec, ntp, "*"},
158159
{spec, kubeadmConfigSpec, ignition, "*"},
160+
{spec, kubeadmConfigSpec, diskSetup, "*"},
159161
{spec, "machineTemplate", "metadata", "*"},
160162
{spec, "machineTemplate", "infrastructureRef", "apiVersion"},
161163
{spec, "machineTemplate", "infrastructureRef", "name"},

controlplane/kubeadm/api/v1beta1/kubeadm_control_plane_webhook_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,16 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
648648
Directory: "/tmp/patches",
649649
}
650650

651+
updateDiskSetup := before.DeepCopy()
652+
updateDiskSetup.Spec.KubeadmConfigSpec.DiskSetup = &bootstrapv1.DiskSetup{
653+
Filesystems: []bootstrapv1.Filesystem{
654+
{
655+
Device: "/dev/sda",
656+
Filesystem: "ext4",
657+
},
658+
},
659+
}
660+
651661
tests := []struct {
652662
name string
653663
enableIgnitionFeature bool
@@ -972,6 +982,12 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
972982
before: before,
973983
kcp: updateJoinConfigurationPatches,
974984
},
985+
{
986+
name: "should allow changes to diskSetup",
987+
expectErr: false,
988+
before: before,
989+
kcp: updateDiskSetup,
990+
},
975991
{
976992
name: "should return error when rolloutBefore.certificatesExpiryDays is invalid",
977993
expectErr: true,

0 commit comments

Comments
 (0)