diff --git a/pkg/curatedpackages/packagecontrollerclient.go b/pkg/curatedpackages/packagecontrollerclient.go index 493b6ed107eb1..b85db09b6a931 100644 --- a/pkg/curatedpackages/packagecontrollerclient.go +++ b/pkg/curatedpackages/packagecontrollerclient.go @@ -243,24 +243,24 @@ func (pc *PackageControllerClient) Enable(ctx context.Context) error { func (pc *PackageControllerClient) GetCuratedPackagesRegistries(ctx context.Context) (sourceRegistry, defaultRegistry, defaultImageRegistry string) { sourceRegistry = publicProdECR defaultImageRegistry = packageProdDomain - accountName := prodAccount - if strings.Contains(pc.chart.Image(), devAccount) { - accountName = devAccount + registry := prodRegistry + if strings.Contains(pc.chart.Image(), devRegistry) { + registry = devRegistry defaultImageRegistry = packageDevDomain sourceRegistry = publicDevECR } - if strings.Contains(pc.chart.Image(), stagingAccount) { - accountName = stagingAccount + if strings.Contains(pc.chart.Image(), stagingRegistry) { + registry = stagingRegistry defaultImageRegistry = packageProdDomain sourceRegistry = publicStagingECR } defaultRegistry = sourceRegistry if pc.registryMirror != nil { - // account is added as part of registry name in package controller helm chart + // registry name is added as part of sourceRegistry field in package controller helm chart // https://github.com/aws/eks-anywhere-packages/blob/main/charts/eks-anywhere-packages/values.yaml#L15-L18 - sourceRegistry = fmt.Sprintf("%s/%s", pc.registryMirror.CoreEKSAMirror(), accountName) - defaultRegistry = fmt.Sprintf("%s/%s", pc.registryMirror.CoreEKSAMirror(), accountName) + sourceRegistry = fmt.Sprintf("%s/%s", pc.registryMirror.CoreEKSAMirror(), registry) + defaultRegistry = fmt.Sprintf("%s/%s", pc.registryMirror.CoreEKSAMirror(), registry) if gatedOCINamespace := pc.registryMirror.CuratedPackagesMirror(); gatedOCINamespace != "" { defaultImageRegistry = gatedOCINamespace } diff --git a/pkg/curatedpackages/reader.go b/pkg/curatedpackages/reader.go index 69cc68dc8839c..0d1e1ea26320c 100644 --- a/pkg/curatedpackages/reader.go +++ b/pkg/curatedpackages/reader.go @@ -17,14 +17,14 @@ import ( // Temporary: Curated packages dev and prod accounts are currently hard coded // This is because there is no mechanism to extract these values as of now. const ( - prodAccount = "eks-anywhere" - devAccount = "l0g8r8j6" - stagingAccount = "w9m0f3l5" - publicProdECR = "public.ecr.aws/" + prodAccount - publicDevECR = "public.ecr.aws/" + devAccount - publicStagingECR = "public.ecr.aws/" + stagingAccount + prodRegistry = "eks-anywhere" + devRegistry = "x3k6m8v0" + stagingRegistry = "w9m0f3l5" + publicProdECR = "public.ecr.aws/" + prodRegistry + publicDevECR = "public.ecr.aws/" + devRegistry + publicStagingECR = "public.ecr.aws/" + stagingRegistry packageProdDomain = "783794618700.dkr.ecr.us-west-2.amazonaws.com" - packageDevDomain = "857151390494.dkr.ecr.us-west-2.amazonaws.com" + packageDevDomain = "067575901363.dkr.ecr.us-west-2.amazonaws.com" ) type PackageReader struct { @@ -149,6 +149,9 @@ func getChartRegistry(uri string) string { if strings.Contains(uri, publicProdECR) { return publicProdECR } + if strings.Contains(uri, publicStagingECR) { + return publicStagingECR + } return publicDevECR } @@ -156,5 +159,8 @@ func getImageRegistry(uri, awsRegion string) string { if strings.Contains(uri, publicProdECR) { return strings.ReplaceAll(packageProdDomain, eksaDefaultRegion, awsRegion) } + if strings.Contains(uri, publicStagingECR) { + return strings.ReplaceAll(packageProdDomain, eksaDefaultRegion, awsRegion) + } return strings.ReplaceAll(packageDevDomain, eksaDefaultRegion, awsRegion) } diff --git a/pkg/curatedpackages/regional_registry.go b/pkg/curatedpackages/regional_registry.go index c977282102ab9..ea4ae15bc25dc 100644 --- a/pkg/curatedpackages/regional_registry.go +++ b/pkg/curatedpackages/regional_registry.go @@ -17,7 +17,7 @@ import ( const ( devRegionalECR string = "067575901363.dkr.ecr.us-west-2.amazonaws.com" devRegionalPublicECR string = "public.ecr.aws/x3k6m8v0" - stagingRegionalECR string = "067575901363.dkr.ecr.us-west-2.amazonaws.com" + stagingRegionalECR string = "724423470321.dkr.ecr.us-west-2.amazonaws.com" ) var prodRegionalECRMap = map[string]string{ @@ -101,10 +101,10 @@ func TestRegistryWithAuthToken(authToken, registry string, do Do) error { // GetRegionalRegistry get the regional registry corresponding to defaultRegistry in a specific region. func GetRegionalRegistry(defaultRegistry, region string) string { - if strings.Contains(defaultRegistry, devAccount) { + if strings.Contains(defaultRegistry, devRegistry) { return devRegionalECR } - if strings.Contains(defaultRegistry, stagingAccount) { + if strings.Contains(defaultRegistry, stagingRegistry) { return stagingRegionalECR } return prodRegionalECRMap[region]