-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathinterfaces.go
93 lines (82 loc) · 2.34 KB
/
interfaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package cloud
import (
"context"
"github.com/sp-yduck/proxmox-go/api"
"github.com/sp-yduck/proxmox-go/proxmox"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
infrav1 "github.com/sp-yduck/cluster-api-provider-proxmox/api/v1beta1"
"github.com/sp-yduck/cluster-api-provider-proxmox/cloud/scheduler"
)
type Reconciler interface {
Reconcile(ctx context.Context) error
Delete(ctx context.Context) error
}
type Client interface {
CloudClient() *proxmox.Service
}
type Cluster interface {
ClusterGetter
ClusterSettter
}
// ClusterGetter is an interface which can get cluster information.
type ClusterGetter interface {
Client
Name() string
Namespace() string
// NetworkName() string
// Network() *infrav1.Network
// AdditionalLabels() infrav1.Labels
// FailureDomains() clusterv1.FailureDomains
ControlPlaneEndpoint() clusterv1.APIEndpoint
Storage() infrav1.Storage
ResourcePool() string
}
type ClusterSettter interface {
SetControlPlaneEndpoint(endpoint clusterv1.APIEndpoint)
SetStorage(storage infrav1.Storage)
}
// MachineGetter is an interface which can get machine information.
type MachineGetter interface {
Client
GetScheduler(client *proxmox.Service) *scheduler.Scheduler
Name() string
Namespace() string
Annotations() map[string]string
// Zone() string
// Role() string
// IsControlPlane() bool
// ControlPlaneGroupName() string
NodeName() string
GetBiosUUID() *string
GetImage() infrav1.Image
GetProviderID() string
GetBootstrapData() (string, error)
GetInstanceStatus() *infrav1.InstanceStatus
GetClusterStorage() infrav1.Storage
GetStorage() string
GetResourcePool() string
GetCloudInit() infrav1.CloudInit
GetNetwork() infrav1.Network
GetHardware() infrav1.Hardware
GetVMID() *int
GetOptions() infrav1.Options
}
// MachineSetter is an interface which can set machine information.
type MachineSetter interface {
SetProviderID(uuid string) error
SetInstanceStatus(v infrav1.InstanceStatus)
SetNodeName(name string)
SetVMID(vmid int)
SetConfigStatus(config api.VirtualMachineConfig)
SetStorage(name string)
// SetFailureMessage(v error)
// SetFailureReason(v capierrors.MachineStatusError)
// SetAnnotation(key, value string)
// SetAddresses(addressList []corev1.NodeAddress)
PatchObject() error
}
// Machine is an interface which can get and set machine information.
type Machine interface {
MachineGetter
MachineSetter
}