@@ -113,7 +113,7 @@ func main() {
113113 nthConfig .Print ()
114114 log .Fatal ().Err (err ).Msg ("Unable to instantiate probes service," )
115115 }
116- imdsDisabled := nthConfig .EnableSQSTerminationDraining
116+ imdsDisabled := nthConfig .EnableSQSTerminationDraining
117117
118118 imds := ec2metadata .New (nthConfig .MetadataURL , nthConfig .MetadataTries )
119119
@@ -139,7 +139,7 @@ func main() {
139139
140140 nthConfig .Print ()
141141
142- if nthConfig .EnableScheduledEventDraining {
142+ if ! imdsDisabled && nthConfig .EnableScheduledEventDraining {
143143 stopCh := make (chan struct {})
144144 go func () {
145145 time .Sleep (8 * time .Second )
@@ -164,19 +164,19 @@ func main() {
164164 defer close (cancelChan )
165165
166166 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+ }
180180 }
181181 if nthConfig .EnableSQSTerminationDraining {
182182 cfg := aws .NewConfig ().WithRegion (nthConfig .AWSRegion ).WithEndpoint (nthConfig .AWSEndpoint ).WithSTSRegionalEndpoint (endpoints .RegionalSTSEndpoint )
0 commit comments