Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cloud/scope/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ func CreateVultrClient() (*govultr.Client, error) {

return vultrClient, nil
}

func MachineOnly() bool {
return os.Getenv("VULTR_MACHINE_ONLY") == "true"
}
2 changes: 1 addition & 1 deletion cloud/services/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (s *Service) CreateInstance(scope *scope.MachineScope) (*govultr.Instance,
instanceReq := &govultr.InstanceCreateReq{
Label: instanceName,
Hostname: instanceName,
Region: s.scope.Region(),
Region: scope.VultrMachine.Spec.Region,
Plan: scope.VultrMachine.Spec.PlanID,
SSHKeys: sshKeyIDs,
SnapshotID: scope.VultrMachine.Spec.Snapshot,
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/vultrmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ func (r *VultrMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request
Namespace: vultrMachine.Namespace,
Name: cluster.Spec.InfrastructureRef.Name,
}
if err := r.Get(ctx, vultrClusterName, vultrCluster); err != nil {
if err := r.Get(ctx, vultrClusterName, vultrCluster); err != nil && !scope.MachineOnly() {
log.Info("VultrCluster is not available yet.")
return ctrl.Result{}, nil
}

// Return early if the object or Cluster is paused.
if annotations.IsPaused(cluster, vultrCluster) {
if annotations.IsPaused(cluster, vultrCluster) && !scope.MachineOnly() {
log.Info("VultrMachine or linked Cluster is marked as paused. Won't reconcile")
return ctrl.Result{}, nil
}
Expand Down