Skip to content

Commit

Permalink
Fall back to non fips endpoint per availability (#1897)
Browse files Browse the repository at this point in the history
  • Loading branch information
Issacwww authored Jul 24, 2024
1 parent 8201081 commit 3f1f9c7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions nodeadm/internal/aws/ecr/ecr.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ecr
import (
"context"
"fmt"
"go.uber.org/zap"
"net"
"strings"
"time"
Expand Down Expand Up @@ -49,10 +50,11 @@ func GetEKSRegistry(region string) (ECRRegistry, error) {
}
if fipsInstalled && fipsEnabled {
fipsRegistry := getRegistry(account, "ecr-fips", region, servicesDomain)
if addresses, err := net.LookupHost(fipsRegistry); err != nil {
return "", err
} else if len(addresses) > 0 {
addresses, err := net.LookupHost(fipsRegistry)
if err == nil && len(addresses) > 0 {
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))
}
}
return ECRRegistry(getRegistry(account, "ecr", region, servicesDomain)), nil
Expand Down

0 comments on commit 3f1f9c7

Please sign in to comment.