Skip to content

Commit d3999fe

Browse files
Yao Xiaogyuho
authored andcommitted
Add support for validateAddOnNodeGroupsRoleServicePrincipals and validateAddOnManagedNodeGroupsRoleServicePrincipals
1 parent b0cd23f commit d3999fe

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

eksconfig/add-on-managed-node-groups.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,13 @@ func (cfg *Config) validateAddOnManagedNodeGroups() error {
301301
*/
302302
found := false
303303
for _, pv := range cfg.AddOnManagedNodeGroups.RoleServicePrincipals {
304-
if pv == "ec2.amazonaws.com" { // TODO: support China regions ec2.amazonaws.com.cn or eks.amazonaws.com.cn
304+
if pv == "ec2.amazonaws.com" || pv == "ec2.amazonaws.com.cn" {
305305
found = true
306306
break
307307
}
308308
}
309309
if !found {
310-
return fmt.Errorf("AddOnManagedNodeGroups.RoleServicePrincipals %q must include 'ec2.amazonaws.com'", cfg.AddOnManagedNodeGroups.RoleServicePrincipals)
310+
return fmt.Errorf("AddOnManagedNodeGroups.RoleServicePrincipals %q must include 'ec2.amazonaws.com' or 'ec2.amazonaws.com.cn'", cfg.AddOnManagedNodeGroups.RoleServicePrincipals)
311311
}
312312
}
313313

eksconfig/add-on-node-groups.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,13 @@ func (cfg *Config) validateAddOnNodeGroups() error {
209209
*/
210210
found := false
211211
for _, pv := range cfg.AddOnNodeGroups.RoleServicePrincipals {
212-
if pv == "ec2.amazonaws.com" { // TODO: support China regions ec2.amazonaws.com.cn or eks.amazonaws.com.cn
212+
if pv == "ec2.amazonaws.com" || pv == "ec2.amazonaws.com.cn" {
213213
found = true
214214
break
215215
}
216216
}
217217
if !found {
218-
return fmt.Errorf("AddOnNodeGroups.RoleServicePrincipals %q must include 'ec2.amazonaws.com'", cfg.AddOnNodeGroups.RoleServicePrincipals)
218+
return fmt.Errorf("AddOnNodeGroups.RoleServicePrincipals %q must include 'ec2.amazonaws.com' or 'ec2.amazonaws.com.cn'", cfg.AddOnNodeGroups.RoleServicePrincipals)
219219
}
220220
}
221221

0 commit comments

Comments
 (0)