-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS::CS::RunCommand.json
145 lines (145 loc) · 3.48 KB
/
ACS::CS::RunCommand.json
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
{
"FormatVersion": "OOS-2019-06-01",
"Description": {
"name-en": "ACS::CS::RunCommand",
"name-zh-cn": "在K8s集群节点上执行命令",
"en": "Run command on K8s cluser nodes",
"zh-cn": "在K8s集群节点上执行命令"
},
"Parameters": {
"clusterId": {
"Description": {
"en": "The ID of cluster",
"zh-cn": "集群ID"
},
"Type": "String"
},
"commandContent": {
"Description": {
"en": "The content of command",
"zh-cn": "命令内容"
},
"Type": "String",
"AssociationProperty": "Code"
}
},
"Tasks": [
{
"Name": "getClusterType",
"Action": "ACS::ExecuteAPI",
"Description": {
"en": "Queries cluster type",
"zh-cn": "获取集群类型"
},
"Properties": {
"Service": "CS",
"API": "DescribeClusters",
"Method": "GET",
"URI": "/clusters/{{clusterId}}"
},
"Outputs": {
"clusterType": {
"Type": "String",
"ValueSelector": ".cluster_type"
}
}
},
{
"Name": "chooseNextTask",
"Action": "ACS::Choice",
"Description": {
"en": "Choose next task by cluster type",
"zh-cn": "根据集群类型选择下一个任务"
},
"Properties": {
"DefaultTask": "runFC_Command",
"Choices": [
{
"When": {
"Fn::Equals": [
"Kubernetes",
"{{ getClusterType.clusterType }}"
]
},
"NextTask": "getClusterMaster"
}
]
}
},
{
"Name": "getClusterMaster",
"Action": "ACS::ExecuteAPI",
"Description": {
"en": "Queries cluster master nodes",
"zh-cn": "获取集群主节点"
},
"Properties": {
"Service": "CS",
"API": "DescribeClusterNodes",
"Method": "GET",
"URI": "/clusters/{{clusterId}}"
},
"Outputs": {
"instanceId": {
"Type": "String",
"ValueSelector": ".outputs[10].OutputValue[]"
}
}
},
{
"Name": "runCommand",
"Action": "ACS::ECS::RunCommand",
"Description": {
"en": "Runs cloud assistant command",
"zh-cn": "执行云助手命令"
},
"OnSuccess": "ACS::END",
"Properties": {
"commandContent": "{{ commandContent }}",
"instanceId": "{{ getClusterMaster.instanceId }}",
"commandType": "RunShellScript"
},
"Outputs": {
"commandOutput": {
"Type": "String",
"ValueSelector": "invocationOutput"
}
}
},
{
"Name": "runFC_Command",
"Description": {
"en": "Runs command on cluster nodes by FC",
"zh-cn": "通过函数计算在集群节点上执行命令"
},
"Action": "ACS::CS::FCRunCommand",
"Properties": {
"clusterId": "{{ clusterId }}",
"commandContent": "{{ commandContent }}"
},
"Outputs": {
"commandOutput": {
"Type": "String",
"ValueSelector": "invokeResult"
}
}
}
],
"Outputs": {
"commandOutput": {
"Type": "String",
"Value": {
"Fn::If": [
{
"Fn::Equals": [
"Kubernetes",
"{{ getClusterType.clusterType }}"
]
},
"{{ runCommand.commandOutput }}",
"{{ runFC_Command.commandOutput }}"
]
}
}
}
}