Skip to content

Commit

Permalink
Fix conversion of SpotVMOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelSpeed committed Apr 28, 2020
1 parent a16d843 commit e089c6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/v1alpha2/azuremachine_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha2/azuremachinetemplate_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit e089c6f

Please sign in to comment.