-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS::ESS::UpdateContainerGroup.yml
163 lines (163 loc) · 4.69 KB
/
ACS::ESS::UpdateContainerGroup.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS::ESS::UpdateContainerGroup
name-zh-cn: 更新ESS容器组
en: Update ESS contain group
zh-cn: 更新ESS容器组
Parameters:
regionId:
Description:
en: The id of region
zh-cn: 地域ID
Type: String
Default: '{{ ACS::RegionId }}'
rollBack:
Description:
en: Whether to rollback
zh-cn: 是否回滚
Type: String
AllowedValues:
- 'true'
- 'false'
Default: 'false'
containerConfigure:
Description:
en: The container configure
zh-cn: 容器配置
Type: Json
instanceId:
Description:
en: The id of ECI instance
zh-cn: ECI实例ID
Type: String
scalingGroupId:
Description:
en: The id of scaling group
zh-cn: 伸缩组ID
Type: String
updateType:
Description:
en: The update type of containers
zh-cn: Containers参数更新方式
Type: String
Default: IncrementalUpdate
Tasks:
- Name: getInstanceLifecycleState
Action: ACS::ExecuteApi
Description:
en: Get ECI instance lifecycle status
zh-cn: 获取ECI实例生命周期挂钩的状态
Properties:
Service: ESS
API: DescribeScalingInstances
Parameters:
RegionId: '{{ regionId }}'
InstanceId:
- '{{ instanceId }}'
Outputs:
lifecycleState:
Type: String
ValueSelector: ScalingInstances.ScalingInstance[].LifecycleState
- Name: whetherLifecycleStateIsStandby
Action: ACS::Choice
Description:
en: Choose next task by lifecycle status
zh-cn: 根据生命周期挂钩的状态选择下一个任务
Properties:
DefaultTask: enterStandby
Choices:
- When:
'Fn::Equals':
- Standby
- '{{ getInstanceLifecycleState.lifecycleState }}'
NextTask: updateContainerGroup
- Name: enterStandby
Action: ACS::WaitFor
Description:
en: Waits for ECI instance enter to standby status
zh-cn: 等待ECI实例进入备用中状态
Retries: 30
Delay: 10
DelayType: Constant
Properties:
Service: ESS
API: EnterStandby
Parameters:
RegionId: '{{ regionId }}'
ScalingGroupId: '{{ scalingGroupId }}'
InstanceId:
- '{{ instanceId }}'
DesiredValues:
- CodeNotExists
StopRetryValues:
- OtherCodes
PropertySelector: .| if .Code==null then "CodeNotExists" else if .Code=="BackendServer.configuring" or .Code=="IncorrectScalingGroupStatus" then "RetryCodeExists" else "OtherCodes" end end
- Name: updateContainerGroup
Action: ACS::ExecuteAPI
Description:
en: Update container group
zh-cn: 更新容器组
Properties:
Service: ECI
API: UpdateContainerGroup
Parameters:
RegionId: '{{ regionId }}'
Container: '{{ containerConfigure }}'
ContainerGroupId: '{{ instanceId }}'
UpdateType: '{{ updateType }}'
- Name: getContainerGroups
Action: ACS::WaitFor
Description:
en: Get container groups status
zh-cn: 获取容器组状态
Retries: 20
Properties:
Service: ECI
API: DescribeContainerGroups
Parameters:
RegionId: '{{ regionId }}'
ContainerGroupIds:
- '{{ instanceId }}'
DesiredValues:
- Running
StopRetryValues:
- Failed
PropertySelector: .ContainerGroups[].Status
- Name: whetherToExitStandBy
Action: ACS::Choice
Description:
en: Choose next task by lifecycle status
zh-cn: 根据生命周期挂钩状态选择下一个任务
Properties:
DefaultTask: exitStandBy
Choices:
- When:
Fn::And:
- 'Fn::Equals':
- Standby
- '{{ getInstanceLifecycleState.lifecycleState }}'
- 'Fn::Equals':
- 'false'
- '{{ rollBack }}'
NextTask: ACS::END
- Name: exitStandBy
Action: ACS::WaitFor
Description:
en: Modifies the state of ECI instances in a scaling group from Standby to Running
zh-cn: 设置伸缩组内处于备用状态的ECI实例为运行中状态
Retries: 30
Delay: 10
DelayType: Constant
Properties:
Service: ESS
API: ExitStandBy
Parameters:
RegionId: '{{ regionId }}'
ScalingGroupId: '{{ scalingGroupId }}'
InstanceId:
- '{{ instanceId }}'
DesiredValues:
- CodeNotExists
StopRetryValues:
- OtherCodes
PropertySelector: .| if .Code==null then "CodeNotExists" else if .Code=="BackendServer.configuring" or .Code=="IncorrectScalingGroupStatus" then "RetryCodeExists" else "OtherCodes" end end