compute-nest-best-practice/ehpc-demo/template.yaml (410 lines of code) (raw):
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 该模版用于创建一个弹性高性能计算(EHPCC)集群,包含管理、登录和计算节点,支持Tiny、Simple、Standard三种部署模式,配置实例类型、数量、存储、网络及付费方式,同时自动化设置文件系统与安全组,确保集群运行在指定VPC环境,且提供Web访问入口。
en: 'This template is designed for establishing an Elastic High-Performance Computing
Cluster (EHPCC), encompassing management, login, and compute nodes. It accommodates
three deployment modes: Tiny, Simple, and Standard, allowing customization of
instance types, quantities, storage configurations, networking setups, and billing
methods. The process automates the configuration of file systems and security
groups, ensuring the cluster operates within a specified Virtual Private Cloud
(VPC) environment. Additionally, it provisions a web access portal for convenient
cluster management.'
Conditions:
TinyMode:
Fn::Equals:
- Ref: EhpcDeployMode
- Tiny
Parameters:
EhpcClusterName:
Type: String
Label:
zh-cn: 集群名称
en: Cluster Name
Description:
zh-cn: 创建集群名称,长度2-64字符.
en: Cluster Name. 2-64 characters in length.
InstancePassword:
Type: String
Label:
zh-cn: 集群登录密码
en: Cluster Login Password
Description:
zh-cn: 长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*-+=|{}[]:;'<>,.?/ 中的特殊符号)。
en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers,
()`~!@#$%^&*-+=|{}[]:;'<>,.?/ Special symbol in).
ConstraintDescription:
zh-cn: 长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*-+=|{}[]:;'<>,.?/ 中的特殊符号)。
en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers,
()`~!@#$%^&*-+=|{}[]:;'<>,.?/ Special symbol in).
AssociationProperty: ALIYUN::ECS::Instance::Password
AllowedPattern: '^[a-zA-Z0-9-\(\)\`\~\!\@\#\$\%\^\&\*\_\-\+\=\|\{\}\[\]\:\;\<\>\,\.\?\/]*$'
MinLength: 8
MaxLength: 30
NoEcho: true
EhpcDeployMode:
Type: String
Label:
zh-cn: Ehpc部署模式
en: ehpc deploy mode
Default: Tiny
AllowedValues:
- Tiny
- Simple
- Standard
EhpcComputeInstanceType:
Type: String
Label:
zh-cn: 计算节点实例类型
en: Login Instance Type
Description:
zh-cn: 填写可用区下可使用的规格;<br>规格详见:<a href='https://help.aliyun.com/document_detail/25378.html'
target='_blank'><b><font color='blue'>实例规格族</font></a></b>
en: 'Fill in specifications that can be used under the availability zone;<br>see
detail: <a href=''https://www.alibabacloud.com/help/en/doc-detail/25378.html''
target=''_blank''><b><font color=''blue''>Instance Specification Family</font></a></b>'
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
InstanceChargeType: ${InstanceChargeType}
EphcComputeCount:
Type: Number
Label:
zh-cn: 计算节点数量
en: Computing node number
Description:
zh-cn: '计算节点数量, 可选值: 1-99.'
en: 'Computing node number, which ranges from: 1-99.'
Default: 1
MinValue: 1
MaxValue: 99
EhpcLoginInstanceType:
Type: String
Label:
zh-cn: 登录节点实例类型
en: Login Instance Type
Description:
zh-cn: 填写可用区下可使用的规格;<br>规格详见:<a href='https://help.aliyun.com/document_detail/25378.html'
target='_blank'><b><font color='blue'>实例规格族</font></a></b>
en: 'Fill in specifications that can be used under the availability zone;<br>see
detail: <a href=''https://www.alibabacloud.com/help/en/doc-detail/25378.html''
target=''_blank''><b><font color=''blue''>Instance Specification Family</font></a></b>'
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${EhpcDeployMode}
- Tiny
Default: ecs.c6.large
EhpcLoginCount:
Type: Number
Label:
zh-cn: 登录节点数量
en: Login Node Number
Description:
zh-cn: '登录节点数量, 可选值: 1-8.'
en: 'Log node number, which ranges from: 1-8.'
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${EhpcDeployMode}
- Tiny
Default: 1
MinValue: 1
MaxValue: 8
EhpcManagerInstanceType:
Type: String
Label:
zh-cn: 管控节点实例类型
en: Login Instance Type
Description:
zh-cn: 填写可用区下可使用的规格;<br>规格详见:<a href='https://help.aliyun.com/document_detail/25378.html'
target='_blank'><b><font color='blue'>实例规格族</font></a></b>
en: 'Fill in specifications that can be used under the availability zone;<br>see
detail: <a href=''https://www.alibabacloud.com/help/en/doc-detail/25378.html''
target=''_blank''><b><font color=''blue''>Instance Specification Family</font></a></b>'
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
EhpcManagerCount:
Type: Number
Label:
zh-cn: 管控节点数量
en: Manager Node Number
Description:
zh-cn: '管控节点数量, 可选值: 1,2,4.'
en: 'Manager node number, which ranges from: 1,2,4.'
Default: 1
AllowedValues:
- 1
- 2
- 4
SystemDiskCategory:
Type: String
Label:
zh-cn: 系统盘类型
en: SystemDisk Category
Description:
zh-cn: 系统盘类型.
en: SystemDisk Category.
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
LocaleKey: DiskCategory
InstanceType: EhpcComputeInstanceType
SystemDiskSize:
Type: Number
Label:
zh-cn: 系统盘大小
en: SystemDisk Size
Description:
zh-cn: 系统盘大小.
en: SystemDisk Size.
Default: 40
SystemDiskPerformanceLevel:
Type: String
Label:
zh-cn: 系统盘性能等级.
en: SystemDisk PerformanceLevel.
Description:
zh-cn: 系统盘性能等级.
en: SystemDisk PerformanceLevel.
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${SystemDiskCategory}
- cloud_essd
Default: PL1
AllowedValues:
- PL0
- PL1
- PL2
- PL3
SchedulerType:
Type: String
Label:
zh-cn: 调度器类型
en: Scheduler Type
Description:
zh-cn: 调度器类型,当前支持pbs和slurm
en: The scheduler type, currently support pbs and slurm.
Default: pbs
AllowedValues:
- pbs
- slurm
- opengridscheduler
- deadline
AccountType:
Type: String
Label:
zh-cn: 域账户服务类型
en: Domain Service Account Type
Description:
zh-cn: 域账户服务类型, 当前支持nis和ldap
en: Domain service account types, currently supports nis and ldap.
Default: nis
AllowedValues:
- nis
- ldap
ZoneId:
Type: String
Label:
zh-cn: 可用区
en: Zone ID
Description:
zh-cn: 可用区配置决定了新建ECS实例的可用区。
en: ECS VSwitch Zone ID defines the Availability Zone for creating ECS instance.
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
VpcId:
Type: String
Label:
zh-cn: VPC ID
en: VPC ID
Description:
zh-cn: 请选择已有的VPC<br><b><font color='blue'>如找不到VPC,请切换地域。</font></b>
en: Please select the existing VPC. <br><b><font color='blue'>If you can't find
the VPC, please switch Regions.</font></b>
AssociationProperty: ALIYUN::ECS::VPC::VPCId
VSwitchId:
Type: String
Label:
zh-cn: 交换机ID
en: VSwitch ID
Description:
zh-cn: 现有网络交换机的实例ID
en: The instance ID of an existing network switch.
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${ZoneId}
PayType:
Type: String
Label:
zh-cn: 付费类型
en: ECS Instance Charge Type
AssociationProperty: ChargeType
AssociationPropertyMetadata:
LocaleKey: InstanceChargeType
Default: PostPaid
AllowedValues:
- PostPaid
- PrePaid
PayPeriodUnit:
Type: String
Label:
zh-cn: 购买资源时长周期
en: Pay Period Unit
Description:
zh-cn: 购买资源时长的周期。<br>Week为周,Month为月<br>默认值为月<br><b><font color='red'>当ECS实例类型为PrePaid有效</b></font>
en: The long cycle of purchasing resources. <br>Week is a Week and Month is
a Month. <br> The default value is month.<br><b><font color='red'> When ECS
instance types are PrePaid valid </b></font>
AssociationProperty: PayPeriodUnit
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${PayType}
- PostPaid
Default: Month
AllowedValues:
- Month
- Year
PayPeriod:
Type: Number
Label:
zh-cn: 购买资源时长
en: Period
Description:
zh-cn: 当购买资源时长为Month时,Period取值:1~9 <br><b><font
color='red'>当ECS实例类型为PrePaid有效</b></font>
en: When the resource purchase duration is Month, the value of Period
ranges from 1 to 9, 12, 24, 36, 48, or 60. <br><b><font color='red'> When
ECS instance types are PrePaid valid </b></font>
AssociationProperty: PayPeriod
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${PayType}
- PostPaid
Default: 1
AllowedValues:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
Resources:
# 创建权限组
AccessGroup:
Type: ALIYUN::NAS::AccessGroup
Properties:
AccessGroupName:
Fn::Join:
- '-'
- - Ref: ALIYUN::StackName
- '[1,4]'
AccessGroupType: Vpc
# 创建权限组规则
AccessRule:
DependsOn: AccessGroup
Type: ALIYUN::NAS::AccessRule
Properties:
AccessGroupName:
Fn::GetAtt:
- AccessGroup
- AccessGroupName
# 优先级
Priority: 1
# 读写权限类型
RWAccessType: RDWR
# 地址
SourceCidrIp: 0.0.0.0/0
# 用户权限类型
UserAccessType: no_squash
# 创建文件系统
FileSystem:
Type: ALIYUN::NAS::FileSystem
Properties:
# 协议类型
ProtocolType: NFS
# 存储类型
StorageType: Capacity
ZoneId:
Ref: ZoneId
VSwitchId:
Ref: VSwitchId
VpcId:
Ref: VpcId
# 创建挂载点
MountTarget:
DependsOn:
- FileSystem
- AccessRule
Type: ALIYUN::NAS::MountTarget
Properties:
# 权限组名称
AccessGroupName:
Fn::GetAtt:
- AccessGroup
- AccessGroupName
# 文件系统ID
FileSystemId:
Fn::GetAtt:
- FileSystem
- FileSystemId
# 网络类型
NetworkType: Vpc
VSwitchId:
Ref: VSwitchId
VpcId:
Ref: VpcId
# 安全组
EcsSecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
# 使用默认名称
SecurityGroupName:
Ref: ALIYUN::StackName
VpcId:
Ref: VpcId
# 出方向全开
SecurityGroupEgress:
- Priority: 1
PortRange: -1/-1
DestCidrIp: 0.0.0.0/0
NicType: intranet
IpProtocol: all
# 类型用于创建一个弹性高性能计算集群
Cluster:
Type: ALIYUN::EHPC::Cluster
Properties:
ZoneId:
Ref: ZoneId
VSwitchId:
Ref: VSwitchId
SecurityGroupId:
Ref: EcsSecurityGroup
ImageId: centos_7_6_x64_20G_alibase_20211130.vhd
OsTag: CentOS_7.6_64
EcsOrderComputeCount:
Ref: EphcComputeCount
VolumeType: 'nas'
VolumeId:
Fn::GetAtt:
- FileSystem
- FileSystemId
EcsOrderManagerInstanceType:
Ref: EhpcLoginInstanceType
EcsOrderComputeInstanceType:
Ref: EhpcComputeInstanceType
PeriodUnit:
Ref: PayPeriodUnit
AutoRenew: 'true'
Password:
Ref: InstancePassword
Name:
Ref: EhpcClusterName
SchedulerType:
Ref: SchedulerType
EcsChargeType:
Ref: PayType
EcsOrderLoginCount:
Ref: EhpcLoginCount
DeployMode:
Ref: EhpcDeployMode
Period:
Ref: PayPeriod
AccountType:
Ref: AccountType
VolumeMountpoint:
Fn::GetAtt:
- MountTarget
- MountTargetDomain
EcsOrderManagerCount:
Ref: EhpcManagerCount
EcsOrderLoginInstanceType:
Ref: EhpcLoginInstanceType
# 类型用于获取弹性高性能计算集群节点的列表
ClusterNodes:
Type: DATASOURCE::EHPC::Nodes
Properties:
# 节点类型
Role:
Fn::If:
- TinyMode
- Manager
- Login
# 待查询的集群ID。
ClusterId:
Fn::GetAtt:
- Cluster
- ClusterId
Outputs:
VisitUrl:
Value:
Fn::Sub:
- https://${Domain}:8081
- Domain:
Fn::Jq:
- First
- .[].PublicIpAddress
- Fn::GetAtt:
- ClusterNodes
- Nodes
Software:
Value: 1.0.0
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- EhpcClusterName
- InstancePassword
Label:
default:
zh-cn: EHPC集群配置
en: Environment Configuration
- Parameters:
- EhpcDeployMode
- EhpcComputeInstanceType
- EphcComputeCount
- EhpcLoginInstanceType
- EhpcLoginCount
- EhpcManagerInstanceType
- EhpcManagerCount
- SystemDiskCategory
- SystemDiskSize
- SystemDiskPerformanceLevel
- SchedulerType
- AccountType
Label:
default:
zh-cn: EHPC资源配置
en: Resource Configuration
- Parameters:
- ZoneId
- VpcId
- VSwitchId
Label:
default:
zh-cn: 网络配置
en: Network Configuration
- Parameters:
- PayType
- PayPeriodUnit
- PayPeriod
Label:
default:
zh-cn: 付费类型配置
en: PayType Configuration