From 6bf917577b2a5ebf3e3cce037d6e70c5de6bcc3c Mon Sep 17 00:00:00 2001 From: John Gardiner Myers Date: Thu, 22 Dec 2022 11:27:16 -0800 Subject: [PATCH] Don't try to uncordon on startup in Queue Processor mode (#743) --- cmd/node-termination-handler.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/cmd/node-termination-handler.go b/cmd/node-termination-handler.go index aaa25ac2..c22a9d8d 100644 --- a/cmd/node-termination-handler.go +++ b/cmd/node-termination-handler.go @@ -113,7 +113,7 @@ func main() { nthConfig.Print() log.Fatal().Err(err).Msg("Unable to instantiate probes service,") } - imdsDisabled := nthConfig.EnableSQSTerminationDraining + imdsDisabled := nthConfig.EnableSQSTerminationDraining imds := ec2metadata.New(nthConfig.MetadataURL, nthConfig.MetadataTries) @@ -139,7 +139,7 @@ func main() { nthConfig.Print() - if nthConfig.EnableScheduledEventDraining { + if !imdsDisabled && nthConfig.EnableScheduledEventDraining { stopCh := make(chan struct{}) go func() { time.Sleep(8 * time.Second) @@ -164,19 +164,19 @@ func main() { defer close(cancelChan) monitoringFns := map[string]monitor.Monitor{} - if !imdsDisabled { - if nthConfig.EnableSpotInterruptionDraining { - imdsSpotMonitor := spotitn.NewSpotInterruptionMonitor(imds, interruptionChan, cancelChan, nthConfig.NodeName) - monitoringFns[spotITN] = imdsSpotMonitor - } - if nthConfig.EnableScheduledEventDraining { - imdsScheduledEventMonitor := scheduledevent.NewScheduledEventMonitor(imds, interruptionChan, cancelChan, nthConfig.NodeName) - monitoringFns[scheduledMaintenance] = imdsScheduledEventMonitor - } - if nthConfig.EnableRebalanceMonitoring || nthConfig.EnableRebalanceDraining { - imdsRebalanceMonitor := rebalancerecommendation.NewRebalanceRecommendationMonitor(imds, interruptionChan, nthConfig.NodeName) - monitoringFns[rebalanceRecommendation] = imdsRebalanceMonitor - } + if !imdsDisabled { + if nthConfig.EnableSpotInterruptionDraining { + imdsSpotMonitor := spotitn.NewSpotInterruptionMonitor(imds, interruptionChan, cancelChan, nthConfig.NodeName) + monitoringFns[spotITN] = imdsSpotMonitor + } + if nthConfig.EnableScheduledEventDraining { + imdsScheduledEventMonitor := scheduledevent.NewScheduledEventMonitor(imds, interruptionChan, cancelChan, nthConfig.NodeName) + monitoringFns[scheduledMaintenance] = imdsScheduledEventMonitor + } + if nthConfig.EnableRebalanceMonitoring || nthConfig.EnableRebalanceDraining { + imdsRebalanceMonitor := rebalancerecommendation.NewRebalanceRecommendationMonitor(imds, interruptionChan, nthConfig.NodeName) + monitoringFns[rebalanceRecommendation] = imdsRebalanceMonitor + } } if nthConfig.EnableSQSTerminationDraining { cfg := aws.NewConfig().WithRegion(nthConfig.AWSRegion).WithEndpoint(nthConfig.AWSEndpoint).WithSTSRegionalEndpoint(endpoints.RegionalSTSEndpoint)