Skip to content

Commit

Permalink
Merge pull request #455 from danehans/bz1866299_east_region
Browse files Browse the repository at this point in the history
Bug 1866299: Fixes AWS Tagging Client for GovCloud East Region
  • Loading branch information
openshift-merge-robot committed Sep 10, 2020
2 parents 58be26f + 0569e36 commit ff274fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 7 additions & 2 deletions pkg/dns/aws/dns.go
Expand Up @@ -40,6 +40,8 @@ const (
govCloudRoute53Region = "us-gov"
// govCloudRoute53Endpoint is the Route 53 service endpoint used for AWS GovCloud.
govCloudRoute53Endpoint = "https://route53.us-gov.amazonaws.com"
// govCloudTaggingEndpoint is the Group Tagging service endpoint used for AWS GovCloud.
govCloudTaggingEndpoint = "https://tagging.us-gov-west-1.amazonaws.com"
// chinaRoute53Endpoint is the Route 53 service endpoint used for AWS China regions.
chinaRoute53Endpoint = "https://route53.amazonaws.com.cn"
// standardRoute53Endpoint is the standard AWS Route 53 service endpoint.
Expand Down Expand Up @@ -148,7 +150,10 @@ func NewProvider(config Config, operatorReleaseVersion string) (*Provider, error
// Route53 for GovCloud uses the "us-gov-west-1" region id:
// https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/using-govcloud-endpoints.html
r53Config = r53Config.WithRegion(endpoints.UsGovWest1RegionID)
tagConfig = tagConfig.WithRegion(region)
// As with other AWS partitions, the GovCloud Tagging client must be
// in the same region as the Route53 client to find the hosted zone
// of managed records.
tagConfig = tagConfig.WithRegion(endpoints.UsGovWest1RegionID)
default:
// Since Route 53 is not a regionalized service, the Tagging API will
// only return hosted zone resources when the region is "us-east-1".
Expand Down Expand Up @@ -231,7 +236,7 @@ func urlContainsValidRegion(region, uri string) bool {
return true
}
case endpoints.UsGovEast1RegionID, endpoints.UsGovWest1RegionID:
if strings.Contains(uri, endpoints.UsGovWest1RegionID) || strings.Contains(uri, endpoints.UsGovEast1RegionID) {
if uri == govCloudTaggingEndpoint {
return true
}
default:
Expand Down
8 changes: 7 additions & 1 deletion pkg/dns/aws/dns_test.go
Expand Up @@ -80,10 +80,16 @@ func TestURLContainsValidRegion(t *testing.T) {
},
{
description: "tagging GovCloud uri for region us-gov-west-1",
uri: "https://tagging.us-gov-west-1.amazonaws.com",
uri: govCloudTaggingEndpoint,
region: endpoints.UsGovWest1RegionID,
expected: true,
},
{
description: "tagging GovCloud uri for region us-gov-east-1",
uri: govCloudTaggingEndpoint,
region: endpoints.UsGovEast1RegionID,
expected: true,
},
{
description: "tagging China uri for region cn-north-1",
uri: "https://tagging.cn-northwest-1.amazonaws.com.cn",
Expand Down

0 comments on commit ff274fa

Please sign in to comment.