Skip to content

Commit 23a7c6f

Browse files
committed
Improve comments related to Health events and scheduled changes
1 parent acfa0bb commit 23a7c6f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pkg/monitor/sqsevent/scheduled-change-event.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ type ScheduledChangeEventDetail struct {
6767
AffectedEntities []AffectedEntity `json:"affectedEntities"`
6868
}
6969

70-
// func (m SQSMonitor) scheduledEventToInterruptionEvents(event EventBridgeEvent, message *sqs.Message) ([]InterruptionEventWrapper, error) {
7170
func (m SQSMonitor) scheduledEventToInterruptionEvents(event *EventBridgeEvent, message *sqs.Message) []InterruptionEventWrapper {
7271
scheduledChangeEventDetail := &ScheduledChangeEventDetail{}
7372
interruptionEventWrappers := []InterruptionEventWrapper{}
@@ -93,11 +92,13 @@ func (m SQSMonitor) scheduledEventToInterruptionEvents(event *EventBridgeEvent,
9392
interruptionEventWrappers = append(interruptionEventWrappers, InterruptionEventWrapper{nil, err})
9493
continue
9594
}
95+
96+
// Begin drain immediately for scheduled change events to avoid disruptions in cases such as degraded hardware
9697
interruptionEvent := monitor.InterruptionEvent{
9798
EventID: fmt.Sprintf("aws-health-scheduled-change-event-%x", event.ID),
9899
Kind: SQSTerminateKind,
99100
AutoScalingGroupName: nodeInfo.AsgName,
100-
StartTime: time.Now(), // begin draining immediately after the notification is processed
101+
StartTime: time.Now(),
101102
NodeName: nodeInfo.Name,
102103
InstanceID: nodeInfo.InstanceID,
103104
Description: fmt.Sprintf("AWS Health scheduled change event received. Instance %s will be interrupted at %s \n", nodeInfo.InstanceID, event.getTime()),

pkg/monitor/sqsevent/sqs-monitor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ type SQSMonitor struct {
5353
ManagedAsgTag string
5454
}
5555

56-
// Convenience wrapper for handling a pair of an interruption event and a related error
56+
// InterruptionEventWrapper is a convenience wrapper for associating an interruption event with its error, if any
5757
type InterruptionEventWrapper struct {
5858
InterruptionEvent *monitor.InterruptionEvent
5959
Err error
@@ -137,7 +137,7 @@ func (m SQSMonitor) processEventBridgeEvent(eventBridgeEvent *EventBridgeEvent,
137137
return append(interruptionEventWrappers, InterruptionEventWrapper{nil, err})
138138
}
139139

140-
// processInterruptionEvents takes interruption event wrappers and sends interruption events to the passed-in channel
140+
// processInterruptionEvents takes interruption event wrappers and sends events to the interruption channel
141141
func (m SQSMonitor) processInterruptionEvents(interruptionEventWrappers []InterruptionEventWrapper, message *sqs.Message) error {
142142
dropMessageSuggestionCount := 0
143143
failedInterruptionEventsCount := 0

0 commit comments

Comments
 (0)