Skip to content

Commit fefbb7d

Browse files
committed
remove controlplane load balancer reconciler for now
1 parent 8fc284c commit fefbb7d

File tree

6 files changed

+47
-34
lines changed

6 files changed

+47
-34
lines changed

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cloud/interfaces.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ type ClusterGetter interface {
3838
// FailureDomains() clusterv1.FailureDomains
3939
ControlPlaneEndpoint() clusterv1.APIEndpoint
4040
Storage() infrav1.Storage
41-
LoadBalancer() infrav1.LoadBalancer
4241
}
4342

4443
type ClusterSettter interface {

cloud/scope/cluster.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ func (s *ClusterScope) Storage() infrav1.Storage {
9797
return s.ProxmoxCluster.Spec.Storage
9898
}
9999

100-
func (s *ClusterScope) LoadBalancer() infrav1.LoadBalancer {
101-
return s.ProxmoxCluster.Spec.LoadBalancer
102-
}
103-
104100
func (s *ClusterScope) CloudClient() *service.Service {
105101
return s.ProxmoxServices.Compute
106102
}

cloud/services/compute/instance/reconcile.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,19 @@ func (s *Service) CreateInstance(ctx context.Context, bootstrap string) (*vm.Vir
127127
return nil, err
128128
}
129129

130-
if err := applyCICustom(vmid, s.scope.Name(), s.scope.GetStorage().Name, s.remote); err != nil {
130+
if err := ApplyCICustom(vmid, s.scope.Name(), s.scope.GetStorage().Name, s.remote); err != nil {
131131
return nil, err
132132
}
133133

134-
if err := setCloudImage(ctx, vmid, s.scope.GetStorage().Name, s.remote); err != nil {
134+
if err := SetCloudImage(ctx, vmid, s.scope.GetStorage().Name, s.remote); err != nil {
135135
return nil, err
136136
}
137137

138138
if err := vm.ResizeVolume("scsi0", "+30G"); err != nil {
139139
return nil, err
140140
}
141141

142-
if err := ensureRunning(*vm); err != nil {
142+
if err := EnsureRunning(*vm); err != nil {
143143
return nil, err
144144
}
145145
return vm, nil
@@ -184,7 +184,7 @@ func (s *Service) Delete(ctx context.Context) error {
184184
return instance.Delete()
185185
}
186186

187-
func setCloudImage(ctx context.Context, vmid int, storageName string, ssh scope.SSHClient) error {
187+
func SetCloudImage(ctx context.Context, vmid int, storageName string, ssh scope.SSHClient) error {
188188
log := log.FromContext(ctx)
189189
log.Info("setting cloud image")
190190

@@ -229,7 +229,7 @@ func setCloudConfig(ctx context.Context, vmName, storageName, bootstrap string,
229229
return nil
230230
}
231231

232-
func applyCICustom(vmid int, vmName, storageName string, ssh scope.SSHClient) error {
232+
func ApplyCICustom(vmid int, vmName, storageName string, ssh scope.SSHClient) error {
233233
cicustom := fmt.Sprintf("user=%s:snippets/%s.yml", storageName, vmName)
234234
out, err := ssh.RunCommand(fmt.Sprintf("qm set %d --cicustom '%s'", vmid, cicustom))
235235
if err != nil {
@@ -241,19 +241,19 @@ func applyCICustom(vmid int, vmName, storageName string, ssh scope.SSHClient) er
241241

242242
func generateVMOptions(vmName, storageName string) vm.VirtualMachineCreateOptions {
243243
vmoptions := vm.VirtualMachineCreateOptions{
244-
Agent: "enabled=1",
245-
Cores: 2,
246-
Memory: 1024 * 4,
247-
Name: vmName,
248-
Boot: "order=scsi0",
249-
Ide: vm.Ide{Ide2: fmt.Sprintf("file=%s:cloudinit,media=cdrom", storageName)},
250-
IPConfig: vm.IPConfig{IPConfig0: "ip=dhcp"},
251-
OSType: vm.L26,
252-
Net: vm.Net{Net0: "model=virtio,bridge=vmbr0,firewall=1"},
253-
Scsi: vm.Scsi{Scsi0: fmt.Sprintf("file=%s:16", storageName)},
254-
ScsiHw: vm.VirtioScsiPci,
255-
Serial: vm.Serial{Serial0: "socket"},
256-
VGA: "serial0",
244+
Agent: "enabled=1",
245+
Cores: 2,
246+
Memory: 1024 * 4,
247+
Name: vmName,
248+
Boot: "order=scsi0",
249+
Ide: vm.Ide{Ide2: fmt.Sprintf("file=%s:cloudinit,media=cdrom", storageName)},
250+
// IPConfig: vm.IPConfig{IPConfig0: "ip=dhcp"},
251+
OSType: vm.L26,
252+
Net: vm.Net{Net0: "model=virtio,bridge=vmbr0,firewall=1"},
253+
Scsi: vm.Scsi{Scsi0: fmt.Sprintf("file=%s:8", storageName)},
254+
ScsiHw: vm.VirtioScsiPci,
255+
Serial: vm.Serial{Serial0: "socket"},
256+
VGA: "serial0",
257257
}
258258
return vmoptions
259259
}
@@ -267,7 +267,7 @@ func sshKeyUrlEncode(keys string) (encodedKeys string) {
267267
return
268268
}
269269

270-
func ensureRunning(instance vm.VirtualMachine) error {
270+
func EnsureRunning(instance vm.VirtualMachine) error {
271271
// ensure instance is running
272272
switch instance.Status {
273273
case vm.ProcessStatusRunning:
@@ -286,6 +286,6 @@ func ensureRunning(instance vm.VirtualMachine) error {
286286
return nil
287287
}
288288

289-
// func ensureStopped(instance vm.VirtualMachine) error {
289+
// func EnsureStopped(instance vm.VirtualMachine) error {
290290
// return nil
291291
// }

config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxclusters.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,19 @@ spec:
6464
- name
6565
- namespace
6666
type: object
67-
foo:
68-
description: Foo is an example field of ProxmoxCluster. Edit proxmoxcluster_types.go
69-
to remove/update
70-
type: string
67+
storage:
68+
description: storage is for proxmox storage used by vm instances
69+
properties:
70+
name:
71+
type: string
72+
path:
73+
type: string
74+
required:
75+
- name
76+
type: object
7177
required:
7278
- credentialsRef
79+
- storage
7380
type: object
7481
status:
7582
description: ProxmoxClusterStatus defines the observed state of ProxmoxCluster

controllers/proxmoxcluster_controller.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535
infrav1 "github.com/sp-yduck/cluster-api-provider-proxmox/api/v1beta1"
3636
"github.com/sp-yduck/cluster-api-provider-proxmox/cloud"
3737
"github.com/sp-yduck/cluster-api-provider-proxmox/cloud/scope"
38-
"github.com/sp-yduck/cluster-api-provider-proxmox/cloud/services/compute/loadbalancer"
3938
"github.com/sp-yduck/cluster-api-provider-proxmox/cloud/services/compute/storage"
4039
)
4140

@@ -115,12 +114,8 @@ func (r *ProxmoxClusterReconciler) reconcile(ctx context.Context, clusterScope *
115114
return ctrl.Result{}, err
116115
}
117116

118-
// failure domains
119-
// to do
120-
121117
reconcilers := []cloud.Reconciler{
122118
storage.NewService(clusterScope),
123-
loadbalancer.NewService(clusterScope),
124119
}
125120

126121
for _, r := range reconcilers {

0 commit comments

Comments
 (0)