Skip to content

Commit 8552fea

Browse files
committed
fix: should set node name in machine spec automatically
1 parent c75ec8d commit 8552fea

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

cloud/interfaces.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ type MachineGetter interface {
6868
type MachineSetter interface {
6969
SetProviderID(instance *vm.VirtualMachine) error
7070
SetInstanceStatus(v infrav1.InstanceStatus)
71+
SetNodeName(name string)
7172
// SetFailureMessage(v error)
7273
// SetFailureReason(v capierrors.MachineStatusError)
7374
// SetAnnotation(key, value string)

cloud/scope/machine.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ func (m *MachineScope) NodeName() string {
103103
return m.ProxmoxMachine.Spec.Node
104104
}
105105

106+
func (m *MachineScope) SetNodeName(name string) {
107+
m.ProxmoxMachine.Spec.Node = name
108+
}
109+
106110
// func (m *MachineScope) Client() Compute {
107111
// return m.ClusterGetter.Client()
108112
// }

cloud/services/compute/instance/reconcile.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ func (s *Service) CreateInstance(ctx context.Context, bootstrap string) (*vm.Vir
116116
log.Error(err, "failed to get random node")
117117
return nil, err
118118
}
119+
s.scope.SetNodeName(node.Node)
119120
}
120121

121122
// (for multiple node proxmox cluster support)

0 commit comments

Comments
 (0)