Skip to content

Commit d153c62

Browse files
Merge pull request #2086 from honza/bootstrap-secret
🐛 bootstrap: add support for data secret
2 parents 2e3b5c1 + 85179ba commit d153c62

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

baremetal/metal3machine_manager.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,11 @@ func (m *MachineManager) IsProvisioned() bool {
171171

172172
// IsBootstrapReady checks if the machine is given Bootstrap data.
173173
func (m *MachineManager) IsBootstrapReady() bool {
174-
return m.Machine.Status.BootstrapReady
174+
if m.Machine.Spec.Bootstrap.ConfigRef != nil {
175+
return m.Machine.Status.BootstrapReady
176+
}
177+
178+
return m.Machine.Spec.Bootstrap.DataSecretName != nil
175179
}
176180

177181
// isControlPlane returns true if the machine is a control plane.

baremetal/metal3machine_manager_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ var _ = Describe("Metal3Machine manager", func() {
429429
ExpectTrue bool
430430
}
431431

432+
testCaseBootstrapReadySecretName := "secret"
433+
432434
DescribeTable("Test BootstrapReady",
433435
func(tc testCaseBootstrapReady) {
434436
machineMgr, err := NewMachineManager(nil, nil, nil, &tc.Machine, nil,
@@ -442,6 +444,11 @@ var _ = Describe("Metal3Machine manager", func() {
442444
},
443445
Entry("ready", testCaseBootstrapReady{
444446
Machine: clusterv1.Machine{
447+
Spec: clusterv1.MachineSpec{
448+
Bootstrap: clusterv1.Bootstrap{
449+
ConfigRef: &corev1.ObjectReference{},
450+
},
451+
},
445452
Status: clusterv1.MachineStatus{
446453
BootstrapReady: true,
447454
},
@@ -452,6 +459,16 @@ var _ = Describe("Metal3Machine manager", func() {
452459
Machine: clusterv1.Machine{},
453460
ExpectTrue: false,
454461
}),
462+
Entry("ready data secret", testCaseBootstrapReady{
463+
Machine: clusterv1.Machine{
464+
Spec: clusterv1.MachineSpec{
465+
Bootstrap: clusterv1.Bootstrap{
466+
DataSecretName: &testCaseBootstrapReadySecretName,
467+
},
468+
},
469+
},
470+
ExpectTrue: true,
471+
}),
455472
)
456473

457474
DescribeTable("Test setting errors",

0 commit comments

Comments
 (0)