diff --git a/api/v1alpha2/azuremachine_conversion.go b/api/v1alpha2/azuremachine_conversion.go index 8e1feadb5ac..313007a09fb 100644 --- a/api/v1alpha2/azuremachine_conversion.go +++ b/api/v1alpha2/azuremachine_conversion.go @@ -36,10 +36,17 @@ func (src *AzureMachine) ConvertTo(dstRaw conversion.Hub) error { // nolint if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { return err } + restoreAzureMachineSpec(&restored.Spec, &dst.Spec) return nil } +func restoreAzureMachineSpec(restored, dst *infrav1alpha3.AzureMachineSpec) { + if restored.SpotVMOptions != nil { + dst.SpotVMOptions = restored.SpotVMOptions.DeepCopy() + } +} + // ConvertFrom converts from the Hub version (v1alpha3) to this version. func (dst *AzureMachine) ConvertFrom(srcRaw conversion.Hub) error { // nolint src := srcRaw.(*infrav1alpha3.AzureMachine) diff --git a/api/v1alpha2/azuremachinetemplate_conversion.go b/api/v1alpha2/azuremachinetemplate_conversion.go index d1a5da3d3ba..db7915d95e8 100644 --- a/api/v1alpha2/azuremachinetemplate_conversion.go +++ b/api/v1alpha2/azuremachinetemplate_conversion.go @@ -34,6 +34,7 @@ func (src *AzureMachineTemplate) ConvertTo(dstRaw conversion.Hub) error { // nol if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { return err } + restoreAzureMachineSpec(&restored.Spec.Template.Spec, &dst.Spec.Template.Spec) return nil }