Skip to content

Commit

Permalink
add support for China and remove annotation from service account
Browse files Browse the repository at this point in the history
China doesn't use its local Route53 instance. Instead it uses
external credentials to auth against the global Route53.

Signed-off-by: Matias Charriere <[email protected]>
  • Loading branch information
mcharriere committed Sep 19, 2023
1 parent afd8ec3 commit 2794cee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 6 additions & 0 deletions service/controller/key/provider.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package key

import "strings"

func IsAWS(provider string) bool {
return provider == "aws"
}

func IsAWSChina(region string) bool {
return strings.HasPrefix(region, "cn-")
}
12 changes: 7 additions & 5 deletions service/controller/resource/clusterconfigmap/desired.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,16 @@ func (r *Resource) GetDesiredState(ctx context.Context, obj interface{}) ([]*cor
externalDnsValues["aws"] = map[string]interface{}{
"batchChangeInterval": nil,
}
externalDnsValues["serviceAccount"] = map[string]interface{}{
"annotations": map[string]interface{}{
"eks.amazonaws.com/role-arn": fmt.Sprintf("arn:aws:iam::%s:role/%s-Route53Manager-Role", accountID, key.ClusterID(&cr)),
},
}
externalDnsValues["domainFilters"] = []string{
key.TenantEndpoint(&cr, bd),
}
if !key.IsAWSChina(awsCluster.Spec.Provider.Region) {
externalDnsValues["serviceAccount"] = map[string]interface{}{
"annotations": map[string]interface{}{
"eks.amazonaws.com/role-arn": fmt.Sprintf("arn:aws:iam::%s:role/%s-Route53Manager-Role", accountID, key.ClusterID(&cr)),
},
}
}
}

ciliumValues := map[string]interface{}{
Expand Down

0 comments on commit 2794cee

Please sign in to comment.