@@ -20,6 +20,8 @@ type AutoModeConfig struct {
2020 Enabled * bool `json:"enabled,omitempty"`
2121 // NodeRoleARN is the node role to use for nodes launched by Auto Mode.
2222 NodeRoleARN ARN `json:"nodeRoleARN,omitempty"`
23+ // PermissionsBoundaryARN is the permissions boundary to use when creating the Auto Mode node role.
24+ PermissionsBoundaryARN ARN `json:"permissionsBoundaryARN,omitempty"`
2325 // NodePools is a list of node pools to create.
2426 NodePools * []string `json:"nodePools,omitempty"`
2527}
@@ -43,6 +45,12 @@ func ValidateAutoModeConfig(clusterConfig *ClusterConfig) error {
4345 if len (* autoModeConfig .NodePools ) == 0 && ! autoModeConfig .NodeRoleARN .IsZero () {
4446 return errors .New ("cannot specify autoModeConfig.nodeRoleARN when autoModeConfig.nodePools is empty" )
4547 }
48+ if len (* autoModeConfig .NodePools ) == 0 && ! autoModeConfig .PermissionsBoundaryARN .IsZero () {
49+ return errors .New ("cannot specify autoModeConfig.permissionBoundaryARN when autoModeConfig.nodePools is empty" )
50+ }
51+ if ! autoModeConfig .NodeRoleARN .IsZero () && ! autoModeConfig .PermissionsBoundaryARN .IsZero () {
52+ return errors .New ("cannot specify autoModeConfig.permissionBoundaryARN when autoModeConfig.nodeRoleARN is set" )
53+ }
4654 seenNodePools := map [string ]struct {}{}
4755 for _ , np := range * autoModeConfig .NodePools {
4856 if _ , ok := seenNodePools [np ]; ok {
@@ -54,8 +62,8 @@ func ValidateAutoModeConfig(clusterConfig *ClusterConfig) error {
5462 seenNodePools [np ] = struct {}{}
5563 }
5664 }
57- } else if ! autoModeConfig .NodeRoleARN .IsZero () || autoModeConfig .HasNodePools () {
58- return errors .New ("cannot set autoModeConfig.nodeRoleARN or autoModeConfig.nodePools when Auto Mode is disabled" )
65+ } else if ! autoModeConfig .PermissionsBoundaryARN . IsZero () || ! autoModeConfig . NodeRoleARN .IsZero () || autoModeConfig .HasNodePools () {
66+ return errors .New ("cannot set autoModeConfig.nodeRoleARN, autoModeConfig.permissionBoundaryARN, or autoModeConfig.nodePools when Auto Mode is disabled" )
5967 }
6068 return nil
6169}
0 commit comments