@@ -113,7 +113,7 @@ func main() {
113
113
nthConfig .Print ()
114
114
log .Fatal ().Err (err ).Msg ("Unable to instantiate probes service," )
115
115
}
116
- imdsDisabled := nthConfig .EnableSQSTerminationDraining
116
+ imdsDisabled := nthConfig .EnableSQSTerminationDraining
117
117
118
118
imds := ec2metadata .New (nthConfig .MetadataURL , nthConfig .MetadataTries )
119
119
@@ -139,7 +139,7 @@ func main() {
139
139
140
140
nthConfig .Print ()
141
141
142
- if nthConfig .EnableScheduledEventDraining {
142
+ if ! imdsDisabled && nthConfig .EnableScheduledEventDraining {
143
143
stopCh := make (chan struct {})
144
144
go func () {
145
145
time .Sleep (8 * time .Second )
@@ -164,19 +164,19 @@ func main() {
164
164
defer close (cancelChan )
165
165
166
166
monitoringFns := map [string ]monitor.Monitor {}
167
- if ! imdsDisabled {
168
- if nthConfig .EnableSpotInterruptionDraining {
169
- imdsSpotMonitor := spotitn .NewSpotInterruptionMonitor (imds , interruptionChan , cancelChan , nthConfig .NodeName )
170
- monitoringFns [spotITN ] = imdsSpotMonitor
171
- }
172
- if nthConfig .EnableScheduledEventDraining {
173
- imdsScheduledEventMonitor := scheduledevent .NewScheduledEventMonitor (imds , interruptionChan , cancelChan , nthConfig .NodeName )
174
- monitoringFns [scheduledMaintenance ] = imdsScheduledEventMonitor
175
- }
176
- if nthConfig .EnableRebalanceMonitoring || nthConfig .EnableRebalanceDraining {
177
- imdsRebalanceMonitor := rebalancerecommendation .NewRebalanceRecommendationMonitor (imds , interruptionChan , nthConfig .NodeName )
178
- monitoringFns [rebalanceRecommendation ] = imdsRebalanceMonitor
179
- }
167
+ if ! imdsDisabled {
168
+ if nthConfig .EnableSpotInterruptionDraining {
169
+ imdsSpotMonitor := spotitn .NewSpotInterruptionMonitor (imds , interruptionChan , cancelChan , nthConfig .NodeName )
170
+ monitoringFns [spotITN ] = imdsSpotMonitor
171
+ }
172
+ if nthConfig .EnableScheduledEventDraining {
173
+ imdsScheduledEventMonitor := scheduledevent .NewScheduledEventMonitor (imds , interruptionChan , cancelChan , nthConfig .NodeName )
174
+ monitoringFns [scheduledMaintenance ] = imdsScheduledEventMonitor
175
+ }
176
+ if nthConfig .EnableRebalanceMonitoring || nthConfig .EnableRebalanceDraining {
177
+ imdsRebalanceMonitor := rebalancerecommendation .NewRebalanceRecommendationMonitor (imds , interruptionChan , nthConfig .NodeName )
178
+ monitoringFns [rebalanceRecommendation ] = imdsRebalanceMonitor
179
+ }
180
180
}
181
181
if nthConfig .EnableSQSTerminationDraining {
182
182
cfg := aws .NewConfig ().WithRegion (nthConfig .AWSRegion ).WithEndpoint (nthConfig .AWSEndpoint ).WithSTSRegionalEndpoint (endpoints .RegionalSTSEndpoint )
0 commit comments