Skip to content
Closed
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
22 changes: 20 additions & 2 deletions pkg/cloud/azure/actuators/machine/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ type Reconciler struct {
virtualMachinesSvc azure.Service
virtualMachinesExtSvc azure.Service
disksSvc azure.Service

// NOTE(jchaloup): openshift actuators manage node role machines only.
// Set to true outside of the fake reconciler.
alwaysFallbackToNodeRole bool
}

// NewReconciler populates all the services based on input scope
Expand All @@ -71,6 +75,10 @@ func NewReconciler(scope *actuators.MachineScope) *Reconciler {
virtualMachinesSvc: virtualmachines.NewService(scope.Scope),
virtualMachinesExtSvc: virtualmachineextensions.NewService(scope.Scope),
disksSvc: disks.NewService(scope.Scope),

// NOTE(jchaloup): openshift actuators manage node role machines only.
// Set to true outside of the fake reconciler.
alwaysFallbackToNodeRole: true,
}
}

Expand Down Expand Up @@ -249,7 +257,12 @@ func (s *Reconciler) isNodeJoin() (bool, error) {
return false, errors.Wrapf(err, "failed to retrieve machines in cluster")
}

switch set := s.scope.Machine.ObjectMeta.Labels[v1alpha1.MachineRoleLabel]; set {
// NOTE(jchaloup): openshift actuators manage node role machines only.
set := v1alpha1.Node
if !s.alwaysFallbackToNodeRole {
set = s.scope.Machine.ObjectMeta.Labels[v1alpha1.MachineRoleLabel]
}
switch set {
case v1alpha1.Node:
return true, nil
case v1alpha1.ControlPlane:
Expand Down Expand Up @@ -449,7 +462,12 @@ func (s *Reconciler) createNetworkInterface(ctx context.Context, nicName string)
Name: nicName,
VnetName: azure.GenerateVnetName(s.scope.Cluster.Name),
}
switch set := s.scope.Machine.ObjectMeta.Labels[v1alpha1.MachineRoleLabel]; set {
// NOTE(jchaloup): openshift actuators manage node role machines only.
set := v1alpha1.Node
if !s.alwaysFallbackToNodeRole {
set = s.scope.Machine.ObjectMeta.Labels[v1alpha1.MachineRoleLabel]
}
switch set {
case v1alpha1.Node:
networkInterfaceSpec.SubnetName = azure.GenerateNodeSubnetName(s.scope.Cluster.Name)
case v1alpha1.ControlPlane:
Expand Down
3 changes: 2 additions & 1 deletion pkg/cloud/azure/actuators/machine_scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ func (m *MachineScope) Namespace() string {

// Role returns the machine role from the labels.
func (m *MachineScope) Role() string {
return m.Machine.Labels[v1alpha1.MachineRoleLabel]
// NOTE(jchaloup): openshift actuators manage node role machines only.
return v1alpha1.Node
}

// Location returns the machine location.
Expand Down