Skip to content

Commit 7738bdf

Browse files
committed
Change Partition.Layout from bool to *bool
Signed-off-by: Stefan Büringer [email protected]
1 parent 910baba commit 7738bdf

File tree

13 files changed

+63
-9
lines changed

13 files changed

+63
-9
lines changed

api/bootstrap/kubeadm/v1beta1/conversion_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ func hubKubeadmConfigSpec(in *bootstrapv1.KubeadmConfigSpec, c randfill.Continue
161161
}
162162
in.JoinConfiguration.NodeRegistration.KubeletExtraArgs[i] = arg
163163
}
164+
165+
for i, p := range in.DiskSetup.Partitions {
166+
if p.Layout == nil {
167+
p.Layout = ptr.To(false) // Layout is a required field and nil does not round trip
168+
}
169+
in.DiskSetup.Partitions[i] = p
170+
}
164171
}
165172

166173
func hubNodeRegistrationOptions(in *bootstrapv1.NodeRegistrationOptions, c randfill.Continue) {

api/bootstrap/kubeadm/v1beta1/zz_generated.conversion.go

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/bootstrap/kubeadm/v1beta2/kubeadmconfig_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ type Partition struct {
829829
// If it is true, a single partition will be created for the entire device.
830830
// When layout is false, it means don't partition or ignore existing partitioning.
831831
// +required
832-
Layout bool `json:"layout"`
832+
Layout *bool `json:"layout,omitempty"`
833833

834834
// overwrite describes whether to skip checks and create the partition if a partition or filesystem is found on the device.
835835
// Use with caution. Default is 'false'.

api/bootstrap/kubeadm/v1beta2/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/controlplane/kubeadm/v1beta1/conversion_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ func hubKubeadmConfigSpec(in *bootstrapv1.KubeadmConfigSpec, c randfill.Continue
164164
}
165165
in.JoinConfiguration.NodeRegistration.KubeletExtraArgs[i] = arg
166166
}
167+
for i, p := range in.DiskSetup.Partitions {
168+
if p.Layout == nil {
169+
p.Layout = ptr.To(false) // Layout is a required field and nil does not round trip
170+
}
171+
in.DiskSetup.Partitions[i] = p
172+
}
167173
}
168174

169175
func hubNodeRegistrationOptions(in *bootstrapv1.NodeRegistrationOptions, c randfill.Continue) {

bootstrap/kubeadm/internal/cloudinit/cloudinit_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func TestNewInitControlPlaneDiskMounts(t *testing.T) {
148148
Partitions: []bootstrapv1.Partition{
149149
{
150150
Device: "test-device",
151-
Layout: true,
151+
Layout: ptr.To(true),
152152
Overwrite: ptr.To(false),
153153
TableType: "gpt",
154154
},

bootstrap/kubeadm/internal/ignition/clc/clc_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func TestRender(t *testing.T) {
102102
Partitions: []bootstrapv1.Partition{
103103
{
104104
Device: "/dev/disk/azure/scsi1/lun0",
105-
Layout: true,
105+
Layout: ptr.To(true),
106106
Overwrite: ptr.To(true),
107107
TableType: "gpt",
108108
},

internal/api/bootstrap/kubeadm/v1alpha3/conversion_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ func hubKubeadmConfigSpec(in *bootstrapv1.KubeadmConfigSpec, c randfill.Continue
143143
}
144144
in.JoinConfiguration.NodeRegistration.KubeletExtraArgs[i] = arg
145145
}
146+
for i, p := range in.DiskSetup.Partitions {
147+
if p.Layout == nil {
148+
p.Layout = ptr.To(false) // Layout is a required field and nil does not round trip
149+
}
150+
in.DiskSetup.Partitions[i] = p
151+
}
146152
}
147153

148154
func hubNodeRegistrationOptions(in *bootstrapv1.NodeRegistrationOptions, c randfill.Continue) {

internal/api/bootstrap/kubeadm/v1alpha3/zz_generated.conversion.go

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/api/bootstrap/kubeadm/v1alpha4/conversion_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ func hubKubeadmConfigSpec(in *bootstrapv1.KubeadmConfigSpec, c randfill.Continue
141141
}
142142
in.JoinConfiguration.NodeRegistration.KubeletExtraArgs[i] = arg
143143
}
144+
for i, p := range in.DiskSetup.Partitions {
145+
if p.Layout == nil {
146+
p.Layout = ptr.To(false) // Layout is a required field and nil does not round trip
147+
}
148+
in.DiskSetup.Partitions[i] = p
149+
}
144150
}
145151

146152
func hubNodeRegistrationOptions(in *bootstrapv1.NodeRegistrationOptions, c randfill.Continue) {

0 commit comments

Comments
 (0)