File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -835,8 +835,8 @@ func (r *AWSMachineReconciler) reconcileLBAttachment(machineScope *scope.Machine
835
835
elbsvc := r .getELBService (elbScope )
836
836
837
837
// In order to prevent sending request to a "not-ready" control plane machines, it is required to remove the machine
838
- // from the ELB as soon as the machine gets deleted or when the machine is in a not running state.
839
- if ! machineScope .AWSMachine . DeletionTimestamp . IsZero () || ! machineScope .InstanceIsRunning () {
838
+ // from the ELB as soon as the machine or infra machine gets deleted or when the machine is in a not running state.
839
+ if machineScope .AWSMachineIsDeleted () || machineScope . MachineIsDeleted () || ! machineScope .InstanceIsRunning () {
840
840
if elbScope .ControlPlaneLoadBalancer ().LoadBalancerType == infrav1 .LoadBalancerTypeClassic {
841
841
machineScope .Debug ("deregistering from classic load balancer" )
842
842
return r .deregisterInstanceFromClassicLB (machineScope , elbsvc , i )
Original file line number Diff line number Diff line change @@ -360,11 +360,16 @@ func (m *MachineScope) InstanceIsInKnownState() bool {
360
360
return state != nil && infrav1 .InstanceKnownStates .Has (string (* state ))
361
361
}
362
362
363
- // AWSMachineIsDeleted checks if the machine was deleted.
363
+ // AWSMachineIsDeleted checks if the AWS machine was deleted.
364
364
func (m * MachineScope ) AWSMachineIsDeleted () bool {
365
365
return ! m .AWSMachine .ObjectMeta .DeletionTimestamp .IsZero ()
366
366
}
367
367
368
+ // MachineIsDeleted checks if the machine was deleted.
369
+ func (m * MachineScope ) MachineIsDeleted () bool {
370
+ return ! m .Machine .ObjectMeta .DeletionTimestamp .IsZero ()
371
+ }
372
+
368
373
// IsEKSManaged checks if the machine is EKS managed.
369
374
func (m * MachineScope ) IsEKSManaged () bool {
370
375
return m .InfraCluster .InfraCluster ().GetObjectKind ().GroupVersionKind ().Kind == ekscontrolplanev1 .AWSManagedControlPlaneKind
You can’t perform that action at this time.
0 commit comments