Skip to content

Commit 8588f02

Browse files
committed
implement status.config
1 parent ad64157 commit 8588f02

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

cloud/interfaces.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cloud
33
import (
44
"context"
55

6+
"github.com/sp-yduck/proxmox-go/api"
67
"github.com/sp-yduck/proxmox-go/proxmox"
78
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
89

@@ -69,6 +70,7 @@ type MachineSetter interface {
6970
SetInstanceStatus(v infrav1.InstanceStatus)
7071
SetNodeName(name string)
7172
SetVMID(vmid int)
73+
SetConfigStatus(config api.VirtualMachineConfig)
7274
// SetFailureMessage(v error)
7375
// SetFailureReason(v capierrors.MachineStatusError)
7476
// SetAnnotation(key, value string)

cloud/scope/machine.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121

2222
"github.com/pkg/errors"
23+
"github.com/sp-yduck/proxmox-go/api"
2324
"github.com/sp-yduck/proxmox-go/proxmox"
2425
corev1 "k8s.io/api/core/v1"
2526
"k8s.io/apimachinery/pkg/types"
@@ -198,6 +199,10 @@ func (m *MachineScope) SetVMID(vmid int) {
198199
m.ProxmoxMachine.Spec.VMID = &vmid
199200
}
200201

202+
func (m *MachineScope) SetConfigStatus(config api.VirtualMachineConfig) {
203+
m.ProxmoxMachine.Status.Config = config
204+
}
205+
201206
func (m *MachineScope) SetReady() {
202207
m.ProxmoxMachine.Status.Ready = true
203208
}

cloud/services/compute/instance/reconcile.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ func (s *Service) Reconcile(ctx context.Context) error {
4040
s.scope.SetInstanceStatus(infrav1.InstanceStatus(instance.VM.Status))
4141
s.scope.SetNodeName(instance.Node)
4242
s.scope.SetVMID(instance.VM.VMID)
43-
// s.scope.SetAddresses()
43+
44+
config, err := instance.GetConfig(ctx)
45+
if err != nil {
46+
return err
47+
}
48+
s.scope.SetConfigStatus(*config)
4449
return nil
4550
}
4651

0 commit comments

Comments
 (0)