ROSTemplateFormatVersion: '2015-09-01'
Description:
en: 建立ack部署
zh-cn: new ack
Parameters:
PayType:
Type: String
Label:
en: ECS Instance Charge Type
zh-cn: 付費類型
Default: PostPaid
AllowedValues:
- PostPaid
- PrePaid
AssociationProperty: ChargeType
AssociationPropertyMetadata:
LocaleKey: InstanceChargeType
PayPeriodUnit:
Type: String
Label:
en: Pay Period Unit
zh-cn: 購買資源時間長度周期
Default: Month
AllowedValues:
- Month
- Year
AssociationProperty: PayPeriodUnit
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${PayType}
- PostPaid
PayPeriod:
Type: Number
Description:
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>
zh-cn: 當購買資源時間長度為Month時,Period取值:1~9 <br><b><font color='red'>當ECS執行個體類型為PrePaid有效</b></font>
Label:
en: Period
zh-cn: 購買資源時間長度
Default: 1
AllowedValues:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
AssociationProperty: PayPeriod
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${PayType}
- PostPaid
ZoneId:
Type: String
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Label:
en: Zone ID
zh-cn: 可用性區域
Default: cn-hangzhou-h
VpcCidrBlock:
Type: String
Label:
en: VPC CIDR IPv4 Block
zh-cn: 專用網路IPv4網段
Description:
zh-cn: VPC的ip位址區段範圍,<br>您可以使用以下的ip位址區段或其子網:<br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>
en: 'The ip address range of the VPC in the CidrBlock form; <br>You can use the following ip address ranges and their subnets: <br><font color=''green''>[10.0.0.0/8]</font><br><font color=''green''>[172.16.0.0/12]</font><br><font color=''green''>[192.168.0.0/16]</font>'
Default: 192.168.0.0/16
AssociationProperty: ALIYUN::VPC::VPC::CidrBlock
VSwitchCidrBlock:
Type: String
Label:
en: VSwitch CIDR Block
zh-cn: 交換器子網網段
Description:
zh-cn: 必須屬於VPC的子網段。
en: Must belong to the subnet segment of VPC.
Default: 192.168.1.0/24
AssociationProperty: ALIYUN::VPC::VSwitch::CidrBlock
AssociationPropertyMetadata:
VpcCidrBlock: VpcCidrBlock
LoginPassword:
NoEcho: true
Type: String
Description:
en: Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;<>,.?/ Special symbol in)
zh-cn: 伺服器登入密碼,長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;<>,.?/ 中的特殊符號)
Label:
en: Instance Password
zh-cn: 執行個體密碼
ConstraintDescription:
en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;<>,.?/ Special symbol in)
zh-cn: 長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;<>,.?/ 中的特殊符號)
AssociationProperty: ALIYUN::ECS::Instance::Password
AllowedPattern: ^[a-zA-Z0-9-\(\)\`\~\!\@\#\$\%\^\&\*\_\-\+\=\|\{\}\[\]\:\;\<\>\,\.\?\/]*$
MinLength: 8
MaxLength: 30
Default: computenest*12345
WorkerInstanceType:
Type: String
Label:
en: Worker Nodes Types
zh-cn: Worker節點規格
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ${ZoneId}
Default: ecs.g6.large
WorkerSystemDiskCategory:
Type: String
AllowedValues:
- cloud_efficiency
- cloud_ssd
- cloud_essd
AssociationPropertyMetadata:
LocaleKey: DiskCategory
InstanceType: ${WorkerInstanceType}
Label:
en: Worker System Disk Category
zh-cn: Worker 系統硬碟磁碟類型
Default: cloud_essd
WorkerSystemDiskSize:
Type: Number
Label:
en: Worker System Disk Size(GB)
zh-cn: Worker節點系統硬碟大小(GB)
MinValue: 1
Default: 120
PodCidr:
Type: String
Description:
zh-cn: 請填寫有效私人網段,即以下網段及其子網:10.0.0.0/8,172.16-31.0.0/12-16,192.168.0.0/16<br>不能與 VPC 及 VPC 內已有 Kubernetes 叢集使用的網段重複。<font color='blue'><b>建立成功後不能修改</b></font>
en: 'Please fill in a valid private segment, i.e. the following segments and their subnets: 10.0.0.0/8, 172.16-31.0.0/12-16, 192.168.0.0/16<br> which cannot duplicate the network segments already used by clusters in VPC and VPC Kunetberes. <font color=''blue''><b>Cannot be modified after successful creation</b></font>'
Label:
zh-cn: Pod 網路 CIDR
en: Pod Network CIDR
AssociationProperty: ALIYUN::CS::ManagedKubernetesCluster::PodCidr
Default: 10.0.0.0/16
ServiceCidr:
Type: String
Description:
zh-cn: 可選範圍:10.0.0.0/16-24,172.16-31.0.0/16-24,192.168.0.0/16-24<br>不能與 VPC 及 VPC 內已有 Kubernetes 叢集使用的網段重複。<font color='blue'><b>建立成功後不能修改</b></font>
en: 'Optional range: 10.0.0.0/16-24, 172.16-31.0.0/16-24, 192.168.0.0/16-24<br> cannot duplicate segments already used by existing Kubernetes clusters in VPC and VPC.<font color=''blue''><b>Cannot be modified after successful creation</b></font>'
Label:
zh-cn: Service CIDR
en: Service CIDR
AssociationProperty: ALIYUN::CS::ManagedKubernetesCluster::ServiceCidr
Default: 172.16.0.0/16
Resources:
EcsVpc:
Type: ALIYUN::ECS::VPC
Properties:
VpcName:
Ref: ALIYUN::StackName
CidrBlock:
Ref: VpcCidrBlock
EcsVSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
VSwitchName:
Ref: ALIYUN::StackName
VpcId:
Ref: EcsVpc
ZoneId:
Ref: ZoneId
CidrBlock:
Ref: VSwitchCidrBlock
EcsSecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
SecurityGroupName:
Ref: ALIYUN::StackName
VpcId:
Ref: EcsVpc
SecurityGroupEgress:
- PortRange: '-1/-1'
Priority: 1
IpProtocol: all
DestCidrIp: 0.0.0.0/0
NicType: intranet
SecurityGroupIngress:
- PortRange: '-1/-1'
Priority: 1
IpProtocol: all
SourceCidrIp:
Ref: PodCidr
Description: pod網路訪問開放
NicType: intranet
- PortRange: '-1/-1'
Priority: 1
IpProtocol: all
SourceCidrIp:
Ref: VpcCidrBlock
Description: vpc網路訪問開放
NicType: intranet
- PortRange: '-1/-1'
Priority: 1
IpProtocol: icmp
SourceCidrIp: 0.0.0.0/0
Description: icmp協議連接埠放開
NicType: intranet
ManagedKubernetesCluster:
Type: ALIYUN::CS::ManagedKubernetesCluster
Properties:
Name:
Ref: ALIYUN::StackName
ChargeType:
Ref: PayType
Period:
Ref: PayPeriod
PeriodUnit:
Ref: PayPeriodUnit
VSwitchIds:
- Ref: EcsVSwitch
VpcId:
Ref: EcsVpc
WorkerInstanceTypes:
- Ref: WorkerInstanceType
NumOfNodes: 3
ClusterSpec: ack.pro.small
ContainerCidr:
Ref: PodCidr
ServiceCidr:
Ref: ServiceCidr
ZoneIds:
- Ref: ZoneId
SecurityGroupId:
Ref: EcsSecurityGroup
WorkerSystemDiskCategory:
Ref: WorkerSystemDiskCategory
WorkerSystemDiskSize:
Ref: WorkerSystemDiskSize
LoginPassword:
Ref: LoginPassword
SnatEntry: true
Addons:
- Name: flannel
Config: ''
ComputenestHelmApplication:
Type: MODULE::SHARE::1563457855438522::HelmDeploy
Version: v5
DependsOn:
- ManagedKubernetesCluster
Properties:
ClusterId:
Fn::GetAtt:
- ManagedKubernetesCluster
- ClusterId
ChartIdentifier: '{{ computenest::helmpull::springBoot }}'
ChartValues:
image:
fullname: '{{ computenest::acrimage::springBootDemo }}'
dockerConfigJson: '{{ computenest::acr::dockerconfigjson }}'
service:
type: LoadBalancer
port: 8080
Namespace:
Ref: ALIYUN::StackName
ReleaseName: spring-boot-chart
# 睡眠1分鐘,以便於擷取資源時可以拿到
HelmSleep:
Type: ALIYUN::ROS::Sleep
DependsOn:
- ComputenestHelmApplication
Properties:
CreateDuration: 60
# 擷取service資訊,輸出到output中
ClusterApplicationResources:
Type: DATASOURCE::CS::ClusterApplicationResources
DependsOn:
- HelmSleep
Properties:
ClusterId:
Fn::GetAtt:
- ManagedKubernetesCluster
- ClusterId
Kind: Service
Name: spring-boot-chart
Namespace:
Ref: ALIYUN::StackName
JsonPath: $.status.loadBalancer.ingress[0].ip
FirstMatch: true
Outputs:
# 將公網ip做為http返回的地址顯示在控制台
Endpoint:
Description:
zh-cn: 對外暴露的公網IP地址
en: Public IP Addresses
Value:
Fn::Sub:
- "http://${ServerAddress}:8080"
- ServerAddress:
Fn::GetAtt:
- ClusterApplicationResources
- Response
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- PayType
- PayPeriodUnit
- PayPeriod
Label:
en: PayType Configuration
zh-cn: 付費類型配置
- Parameters:
- ZoneId
- VpcCidrBlock
- VSwitchCidrBlock
- LoginPassword
Label:
en: Basic Configuration
zh-cn: 基礎配置
- Parameters:
- WorkerInstanceType
- WorkerSystemDiskCategory
- WorkerSystemDiskSize
- ServiceCidr
- PodCidr
Label:
en: Kubernetes
zh-cn: Kubernetes配置