From 167ff78a27c5bfc1876b5f2708914263c19d2ca1 Mon Sep 17 00:00:00 2001 From: Jeremy McGee Date: Thu, 3 Oct 2024 17:48:52 -0600 Subject: [PATCH] Added HTTP Check for FIPS endpoint --- nodeadm/internal/aws/ecr/ecr.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nodeadm/internal/aws/ecr/ecr.go b/nodeadm/internal/aws/ecr/ecr.go index 3e317c314..9f4c23ec2 100644 --- a/nodeadm/internal/aws/ecr/ecr.go +++ b/nodeadm/internal/aws/ecr/ecr.go @@ -4,7 +4,7 @@ import ( "context" "fmt" "go.uber.org/zap" - "net" + "net/http" "strings" "github.com/aws/aws-sdk-go-v2/config" @@ -49,8 +49,8 @@ func GetEKSRegistry(region string) (ECRRegistry, error) { } if fipsInstalled && fipsEnabled { fipsRegistry := getRegistry(account, "ecr-fips", region, servicesDomain) - addresses, err := net.LookupHost(fipsRegistry) - if err == nil && len(addresses) > 0 { + resp, err := http.Get(fipsRegistry) + if err == nil && resp.StatusCode == 401 { return ECRRegistry(fipsRegistry), nil } else { zap.L().Info("Fail to look up Fips registry for requested region, fall back to default", zap.String("fipsRegistry", fipsRegistry))