ACS-CS-DedicatedMigration

更新时间:
复制 MD 格式

Template name

ACS-CS-DedicatedMigration: Hibernates the control plane of an ACK dedicated cluster and uploads an etcd snapshot

Execute Now

Description

This template hibernates the control plane of an ACK dedicated cluster, creates an etcd snapshot, and uploads the snapshot to an Object Storage Service (OSS) bucket.

Template type

Automation

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default

Constraints

targets

The target instances.

Json

Yes

BucketName

The name of the Object Storage Service (OSS) bucket to store the etcd snapshot.

String

Yes

OSSEndpoint

The endpoint of the OSS bucket.

String

Yes

ClusterID

The ID of the cluster.

String

Yes

regionId

The ID of the region.

String

No

{{ ACS::RegionId }}

workingDir

The working directory on the ECS instance where the command runs.

String

No

/root

rateControl

Settings for task execution, such as concurrency and error thresholds.

Json

No

{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 5}

action

The action to perform. Valid values: migrate and rollback.

String

No

rollback

OOSAssumeRole

The RAM role that OOS assumes to execute the task.

String

No

""

Output parameters

Parameter

Description

Type

sleepOrWakeupControlPlaneOutputs

List

etcdCheckoutOutputs

List

findLeaderOutputs

List

readSignOutputs

List

Required permissions

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:DescribeInstances",
                "ecs:DescribeInvocationResults",
                "ecs:DescribeInvocations",
                "ecs:RunCommand"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "oos:GetApplicationGroup"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Details

ACS-CS-DedicatedMigration

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: Hibernates the control plane, creates an etcd snapshot, and uploads it to an OSS bucket.
  zh-cn: ACK专属版master休眠&etcd备份上传
  name-en: ACS-CS-DedicatedMigration
  name-zh-cn: ACK专属版master休眠&etcd备份上传
  categories:
    - others
Parameters:
  regionId:
    Type: String
    Label:
      en: Region ID
      zh-cn: 地域ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  workingDir:
    Label:
      en: Working Directory
      zh-cn: ECS实例中运行命令的目录
    Type: String
    Default: /root
  rateControl:
    Label:
      en: Rate Control
      zh-cn: 任务执行的并发比率
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 5
  targets:
    Label:
      en: Target Instance
      zh-cn: 目标实例
    Type: Json
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  action:
    Type: String
    Label:
      en: Action
      zh-cn: 配置方式
    Default: rollback
    AllowedValues:
      - migrate
      - rollback
  OOSAssumeRole:
    Label:
      en: OOS Assume Role
      zh-cn: OOS扮演的RAM角色
    Type: String
    Default: ''
  BucketName:
    Label:
      en: Bucket Name
      zh-cn: 需要上传snapshot的OSS路径
    Type: String
  OSSEndpoint:
    Label:
      en: OSS Endpoint
      zh-cn: 需要上传snapshot的OSS对应的endpoint
    Type: String
  ClusterID:
    Label:
      en: Cluster ID
      zh-cn: 集群的ID
    Type: String
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: getInstance
    Description:
      en: Selects the target ECS instances.
      zh-cn: 获取ECS实例
    Action: ACS::SelectTargets
    Properties:
      ResourceType: ALIYUN::ECS::Instance
      RegionId: '{{ regionId }}'
      Filters:
        - '{{ targets }}'
    Outputs:
      instanceIds:
        Type: List
        ValueSelector: Instances.Instance[].InstanceId
  - Action: ACS::ECS::RunCommand
    OnError: rollback
    Description:
      en: Hibernates or starts the control plane components on the master nodes.
      zh-cn: 休眠或启动Master节点管控组件
    Properties:
      regionId: '{{ regionId }}'
      commandContent: |-