ALIYUN::ECI::ContainerGroup类型用于创建一个容器组。

语法

{
  "Type": "ALIYUN::ECI::ContainerGroup",
  "Properties": {
    "SecurityContextSysctl": List,
    "Memory": Number,
    "InitContainer": List,
    "Cpu": "Number",
    "EipInstanceId": String,
    "ContainerGroupName": String,
    "Container": List,
    "ImageSnapshotId": String,
    "DnsConfig": Map,
    "AutoMatchImageCache": Boolean,
    "Ipv6AddressCount": Integer,
    "ImageRegistryCredential": List,
    "SpotPriceLimit": Number,
    "InstanceType": String,
    "SpotStrategy": String,
    "ActiveDeadlineSeconds": Integer,
    "HostAliase": List,
    "ZoneId": String,
    "TerminationGracePeriodSeconds": Integer,
    "VSwitchId": String,
    "SecurityGroupId": String,
    "SlsEnable": Boolean,
    "RestartPolicy": String,
    "RamRoleName": String,
    "Volume": List,
    "Tag": List
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
EipInstanceId String 弹性IP ID。
Container List 容器组中包含的容器。 详情请参见Container属性
DnsConfig Map DNS配置。 详情请参见DnsConfig属性
InitContainer List 初始化容器列表。 详情请参见InitContainer属性
SecurityGroupId String 指定新创建实例所属于的安全组代码,同一个安全组内的实例之间可以互相访问。
ContainerGroupName String 容器组名称。
ZoneId String 实例所属的可用区编号。 默认值:空(表示由系统选择)。
Volume List 数据卷列表。 最多可以指定20个数据卷。

详情请参见Volume属性

HostAliase List 自定义pod内一个容器的hostname映射。 详情请参见HostAliase属性
RestartPolicy String 实例重启策略。 取值:
  • Always(默认值)
  • OnFailure
  • Never
Tag List 键值对形式的容器组标签列表。 每个容器组定义最多20个标记。键值均为字符串。

详情请参见Tag属性

VSwitchId String 指定虚拟交换机ID。当前ECI实例均为专有网络实例。 VSW网段内IP的个数决定了该VSW最大可创建的ECI实例数,请提前规划VSW网段设置。
ImageRegistryCredential List 登录容器映像仓库的信息,包括服务器地址、用户名和密码。 详情请参见ImageRegistryCredential属性
Memory Number 内存大小。
SlsEnable Boolean 开启用户日志收集。 默认值:false。
SecurityContextSysctl List 实例运行的安全上下文。 详情请参见SecurityContext属性
Cpu Number CPU大小。
ImageSnapshotId String 镜像缓存ID或快照ID。
SpotPriceLimit Number 实例的每小时最高价格。 最大支持3位小数。参数SpotStrategy 取值为SpotWithPriceLimit时生效。
AutoMatchImageCache Boolean 自动匹配镜像缓存。
SpotStrategy String 实例的抢占策略。 取值:
  • NoSpot(默认值):正常按量付费实例。
  • SpotWithPriceLimit:设置上限价格的抢占式实例。
  • SpotAsPriceGo:系统自动出价,跟随当前市场实际价格。
TerminationGracePeriodSeconds Integer 给程序预留的最后缓冲时间,用于处理关闭之前的操作。 单位:秒。
ActiveDeadlineSeconds Integer 有效期限。 单位:秒。
Ipv6AddressCount Integer Ipv6地址数量。
RamRoleName String 实例RAM角色名称,ECI与ECS共用实例RAM角色。
InstanceType String 实例规格。

Container语法

"Container": [
  {
    "EnvironmentVar": List,
    "Tty": Boolean,
    "SecurityContext": Map,
    "Name": String,
    "ImagePullPolicy": String,
    "Image": String,
    "Stdin": boolean,
    "WorkingDir": String,
    "LivenessProbe": Map,
    "Cpu": Number,
    "Command": List,
    "Memory": Number,
    "ReadinessProbe": Map,
    "VolumeMount": List,
    "Port": List,
    "Arg": List,
    "StdinOnce": Boolean
  }
]

Container属性

属性名称 类型 必须 允许更新 描述 约束
EnvironmentVar List 容器中的环境变量。每个环境变量都是键/值对,键和值都是字符串。 最多支持100个环境变量。键表示变量的名称,值表示变量的值。

详情请参见EnvironmentVar属性

Tty Boolean 是否为此容器分配TTY。 取值:
  • true
  • false
如果值为true,则stdin也为true。
SecurityContext Map 容器组的安全上下文。 取值:true。
Name String 容器名。
ImagePullPolicy String 镜像拉取策略。
Image String 镜像。
Stdin Boolean 是否在此容器运行时中分配标准输入的缓冲。 取值:
  • true
  • false
WorkingDir String 容器的工作目录。
LivenessProbe Map 容器存活探针。 详情请参见LivenessProbe属性
Cpu Number 分配给容器的vCPU数量。
Command List 要发送到容器以运行的命令列表。 最多可以指定一个命令。每个字符串的最大长度为256个字符。
Memory Number 分配给容器的内存。 单位:GiB。
ReadinessProbe Map 容器就绪探针。 详情请参见ReadinessProbe属性
VolumeMount List 挂载到容器上的Volume的数量。 最多支持16个。

详情请参见VolumeMount属性

Port List 开放端口和协议。 最多可以设置100个端口。取值:
  • TCP
  • UDP

详情请参见Port属性

Arg List 传递给命令的参数。 参数为String类型。最多支持10个参数。
StdinOnce Boolean 由单次attach打开标准输入通道后,断开连接后是否关闭该通道。 取值:
  • true
  • false

LivenessProbe语法

"LivenessProbe": {
  "TcpSocket.Port": Integer,
  "HttpGet.Scheme": String,
  "HttpGet.Port": Integer,
  "FailureThreshold": Integer,
  "InitialDelaySeconds": Integer,
  "TimeoutSeconds": Integer,
  "SuccessThreshold": Integer,
  "Exec.Command": List,
  "PeriodSeconds": Integer,
  "HttpGet.Path": String
}

LivenessProbe属性

属性名称 类型 必须 允许更新 描述 约束
TcpSocket.Port Integer 系统向其中发送TCP套接字请求以执行检查的端口。
HttpGet.Scheme String 用于连接主机的协议。 取值:
  • HTTP
  • HTTPS
HttpGet.Port Integer 系统向其中发送HTTP GET请求以执行检查的端口。
FailureThreshold Integer 探测器认定检查失败的检查次数阈值(必须是连续失败)。 默认值:3。
InitialDelaySeconds Integer 在启动探测之前容器启动后的时间。 单位:秒。
TimeoutSeconds Integer 探测器超时的秒数。 最小值:1。

默认值:1。

SuccessThreshold Integer 探测器检查失败后重新认定检查成功的检查次数阈值。 取值:1。

默认值:1。

Exec.Command List 探测命令。
PeriodSeconds Integer 探测周期。 单位:秒。

最小值:1。

默认值:10。

HttpGet.Path String 系统发送HTTP GET请求以执行检查的路径。

DnsConfig语法

"DnsConfig": {
  "NameServer": List,
  "Search": List,
  "Option": List
}

DnsConfig属性

属性名称 类型 必须 允许更新 描述 约束
NameServer List DNS服务器的IP地址列表。
Search List DNS搜索域的列表。
Option List 选项列表。每个选项都包含一个名称和一个值。 每个选项的值是可选的。

详情请参见Option属性

InitContainer语法

"InitContainer": [
  {
    "EnvironmentVar": List,
    "SecurityContext": Map,
    "Name": String,
    "Image": String,
    "Arg": List,
    "WorkingDir": String,
    "Port": List,
    "Command": List,
    "Memory": Number,
    "ImagePullPolicy": String,
    "VolumeMount": List,
    "Cpu": Number
  }
]

InitContainer属性

属性名称 类型 必须 允许更新 描述 约束
EnvironmentVar List 容器中的环境变量。每个环境变量都是键值对,键和值都是字符串。键表示变量的名称,值表示变量的值。 最多支持100个环境变量。取值:status.podIP。
SecurityContext Map 容器组的安全上下文。 取值:true。
Name String 容器名。
Image String 容器镜像。
Arg List 传递给命令的参数。 参数为String类型。最多支持10个参数。
WorkingDir String 容器的工作目录。
Port List 开放端口和协议。 最多可以设置100个端口。取值:
  • TCP
  • UDP
Command List 要发送到容器以运行的命令列表。 最多可以指定一个命令。每个字符串的最大长度为256个字符。
Memory Number 分配给容器的内存。 单位:GB。
ImagePullPolicy String 镜像拉取策略。您可以使用它从镜像仓库中提取镜像。
VolumeMount List 挂载到容器上的Volume的数量。 最多支持16个。
Cpu Number 分配给容器的vCPU数量。

Volume语法

"Volume": [
  {
    "NFSVolume.Path": String,
    "Name": String,
    "EmptyDirVolume.Medium": String,
    "NFSVolume.Server": String,
    "NFSVolume.ReadOnly": Boolean,
    "ConfigFileVolume.ConfigFileToPath": List,
    "Type": String
  }
]

Volume属性

属性名称 类型 必须 允许更新 描述 约束
NFSVolume.Path String NFSVolume的路径。
Name String Volume名。
EmptyDirVolume.Medium String 存储介质。 默认情况下,使用节点上的文件系统。取值:Memory。如果值为Memory,则EmptyDirVolume卷存储在内存中。
NFSVolume.Server String NFS服务器的IP地址。
NFSVolume.ReadOnly Boolean NFS卷只读属性。 默认值:false。
ConfigFileVolume.ConfigFileToPath List 配置文件路径。 详情请参见ConfigFileVolume.ConfigFileToPath属性
Type String Volume的类型。 取值:
  • EmptyDirVolume
  • NFSVolume
  • ConfigFileVolume

HostAliase语法

"HostAliase": [
  {
    "Ip": String,
    "Hostname": List
  }
]

HostAliase属性

属性名称 类型 必须 允许更新 描述 约束
Ip String IP地址
Hostname List 主机名

ImageRegistryCredential语法

"ImageRegistryCredential": [
  {
    "UserName": String,
    "Password": String,
    "Server": String
  }
]

ImageRegistryCredential属性

属性名称 类型 必须 允许更新 描述 约束
UserName String 用于登录镜像仓库的用户名。
Password String 用于登录镜像仓库的密码。
Server String 镜像仓库的IP地址。 此地址不包含协议前缀,例如http://https://

EnvironmentVar语法

"EnvironmentVar": {
  "Key": String,
  "Value": String,
  "FieldRef.FieldPath": String
}

EnvironmentVar属性

属性名称 类型 必须 允许更新 描述 约束
Key String 变量的名称。 长度为1~128个字符,不能以数字开头,可包含数字、英文字母和下划线(_)。
Value String 变量的值。 长度为0~256个字符。
FieldRef.FieldPath String 对另一个变量的引用。 目前只支持status.podIP。

SecurityContext语法

"SecurityContext": {
  "Capability.Add": List,
  "RunAsUser": Interger,
  "ReadOnlyRootFilesystem": Boolen
}

SecurityContext属性

属性名称 类型 必须 允许更新 描述 约束
Capability.Add List 可添加到容器的Capability。 取值:["NET_ADMIN"]。
RunAsUser Integer 用户ID。
ReadOnlyRootFilesystem Boolean 只读根文件系统。 取值:true。

VolumeMount语法

"VolumeMount": [
  {
    "Name": String,
    "ReadOnly": Boolen,
    "MountPath": String
  }
]

VolumeMount属性

属性名称 类型 必须 允许更新 描述 约束
Name String Volume的名称。名称与Volume部分中为name参数指定的值相同。
ReadOnly Boolean 只读属性。 默认值:false。
MountPath String 安装路径。目标目录中的数据被挂载卷中的数据覆盖。

Port语法

"Port": [
  {
    "Port": Interger,
    "Protocol": String
  }
]

Port属性

属性名称 类型 必须 允许更新 描述 约束
Port Integer 端口号。 取值范围:1~65,535。
Protocol String 端口使用的协议。 取值:
  • TCP
  • UDP

ConfigFileVolume.ConfigFileToPath语法

"onfigFileVolume.ConfigFileToPath": [
  {
    "Content": String,
    "Path": String
  }
]

ConfigFileVolume.ConfigFileToPath属性

属性名称 类型 必须 允许更新 描述 约束
Content String 配置文件的内容。 最大为32KB。
Path String 配置文件中的相对路径。您可以指定一个目录相对于另一个目录的位置。

SecurityContextSysctl语法

"SecurityContextSysctl": [
  {
    "Value": String,
    "Name": String
  }
] 

SecurityContextSysctl属性

属性名称 类型 必须 允许更新 描述 约束
Value String 实例运行的安全上下文的变量值。
Name String 实例运行的安全上下文系统名称。 取值:
  • kernel.msgmax
  • kernel.shm_rmid_forced

ReadinessProbe语法

"ReadinessProbe": {
  "TimeoutSeconds": Integer,
  "InitialDelaySeconds": Integer,
  "Exec.Command": List,
  "PeriodSeconds": Integer,
  "HttpGet.Port": Integer,
  "TcpSocket.Port": Integer,
  "FailureThreshold": Integer,
  "HttpGet.Scheme": String,
  "HttpGet.Path": String,
  "SuccessThreshold": Integer
} 

ReadinessProbe属性

属性名称 类型 必须 允许更新 描述 约束
FailureThreshold Integer 从上次检查成功后认定检查失败的检查次数阈值。 必须是连续失败。

默认值:3。

HttpGet.Scheme String GET请求协议。 取值:
  • HTTP
  • HTTPS
HttpGet.Path String HttpGet检测的路径。
Exec.Command List 容器内检测的命令。
TcpSocket.Port Integer TcpSocket检测的端口。
PeriodSeconds Integer 检查执行的周期。 默认值:10。

最小值:1。

单位:秒。

TimeoutSeconds Integer 检查超时的时间。 默认值:10。

最小值:1。

单位:秒。

InitialDelaySeconds Integer 检查开始执行的时间,以容器启动完成为起点计算。
SuccessThreshold Integer 从上次检查失败后重新认定检查成功的检查次数阈值。 必须是连续成功。

默认值:1。

HttpGet.Port Integer HttpGet检测的端口号。

Option语法

"Option": [
  {
    "Name": String,
    "Value": String
  }
] 

Option属性

属性名称 类型 必须 允许更新 描述 约束
Name String 对象名称
Value String 对象值

Tag语法

"Tag": [
  {
    "Key": String,
    "Value": String
  }
]

Tag属性

属性名称 类型 必须 允许更新 描述 约束
Key String 标签键
Value String 标签值

返回值

Fn::GetAtt

  • ContainerGroupId:容器组ID。
  • ContainerGroupName:容器组的名称。
  • SecurityGroupId:安全组ID。
  • Ipv6Address:Ipv6地址。
  • InternetIp:公网IP。
  • RegionId:实例所属地域。
  • IntranetIp:内网IP。
  • ZoneId:可用区。
  • VSwitchId:交换机ID。
  • EniInstanceId:弹性网卡ID。

示例

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "SecurityContextSysctl": {
      "Type": "Json",
      "Description": "ECI Sysctl is valid for every container in ECI.\nCurrently only two Sysctl keyNames are supported:\nKernel.shm_rmid_forced\nKernel.msgmax"
    },
    "Memory": {
      "Type": "Number",
      "Description": "memory size"
    },
    "InitContainer": {
      "Type": "Json",
      "Description": "The containers that constitute the container group for initializing."
    },
    "Cpu": {
      "Type": "Number",
      "Description": "CPU size"
    },
    "EipInstanceId": {
      "Type": "String",
      "Description": "Elastic IP ID"
    },
    "ContainerGroupName": {
      "Type": "String",
      "Description": "The name of the container group. \nThe length is [2,128] English lowercase letters, numbers or hyphens (-), cannot begin or end with a hyphens.",
      "MinLength": 2,
      "MaxLength": 128
    },
    "Container": {
      "Type": "Json",
      "Description": "The containers that constitute the container group."
    },
    "ImageSnapshotId": {
      "Type": "String",
      "Description": "Image cache ID or snapshot ID."
    },
    "DnsConfig": {
      "Type": "Json",
      "Description": "The information about DNS configurations."
    },
    "AutoMatchImageCache": {
      "Type": "Boolean",
      "Description": "Specifies whether to automatically match the image cache.",
      "AllowedValues": [
        true,
        false
      ]
    },
    "Ipv6AddressCount": {
      "Type": "Number",
      "Description": "The number of IPv6 addresses."
    },
    "ImageRegistryCredential": {
      "Type": "Json",
      "Description": "The information that you need to log on to the container image repository, including the server address, username, and password.",
      "MaxLength": 10
    },
    "SpotPriceLimit": {
      "Type": "Number",
      "Description": "Set the hourly maximum price of the instance. It supports a maximum of 3 decimal places. It takes effect when the value of the parameter SpotStrategy is SpotWithPriceLimit."
    },
    "InstanceType": {
      "Type": "String",
      "Description": "The type of the ECS instance."
    },
    "SpotStrategy": {
      "Type": "String",
      "Description": "Instance preemption strategy.\nRanges:\nNoSpot (default): normal pay-as-you-go instances.\nSpotWithPriceLimit: Preemptive instance that sets a cap price.\nSpotAsPriceGo: The system automatically bids, following the current market actual price.",
      "AllowedValues": [
        "NoSpot",
        "SpotWithPriceLimit",
        "SpotAsPriceGo"
      ]
    },
    "ActiveDeadlineSeconds": {
      "Type": "Number",
      "Description": "The validity period in seconds."
    },
    "HostAliase": {
      "Type": "Json",
      "Description": "Customize the hostname mapping of a container inside the pod"
    },
    "ZoneId": {
      "Type": "String",
      "Description": "The ID of the zone in which the instance resides. If you leave the parameter blank, the system assigns a zone for you. The default value is blank."
    },
    "TerminationGracePeriodSeconds": {
      "Type": "Number",
      "Description": "The buffer time for the program to handle operations before it is stopped."
    },
    "VSwitchId": {
      "Type": "String",
      "Description": "The ID of the specified VSwitch. Currently, ECI instances can only be deployed in VPCs."
    },
    "SecurityGroupId": {
      "Type": "String",
      "Description": "The ID of the security group to which the instance belongs. Instances in the same security group can access one another."
    },
    "SlsEnable": {
      "Type": "Boolean",
      "Description": "Enable user log collection. The default is False.",
      "AllowedValues": [
        true,
        false
      ]
    },
    "RestartPolicy": {
      "Type": "String",
      "Description": "The policy for restarting the instance. Default value: Always.",
      "AllowedValues": [
        "Always",
        "OnFailure",
        "Never"
      ]
    },
    "RamRoleName": {
      "Type": "String",
      "Description": "The RAM role that the container group assumes. ECI and ECS share the same RAM role."
    },
    "Volume": {
      "Type": "Json",
      "Description": "The data volume. You can specify a maximum of 20 data volumes.",
      "MaxLength": 20
    },
    "Tag": {
      "Type": "Json",
      "Description": "The list of container group tags in the form of key/value pairs. You can define a maximum of 20 tags for each container group.",
      "MaxLength": 20
    }
  },
  "Resources": {
    "ContainerGroup": {
      "Type": "ALIYUN::ECI::ContainerGroup",
      "Properties": {
        "SecurityContextSysctl": {
          "Ref": "SecurityContextSysctl"
        },
        "Memory": {
          "Ref": "Memory"
        },
        "InitContainer": {
          "Ref": "InitContainer"
        },
        "Cpu": {
          "Ref": "Cpu"
        },
        "EipInstanceId": {
          "Ref": "EipInstanceId"
        },
        "ContainerGroupName": {
          "Ref": "ContainerGroupName"
        },
        "Container": {
          "Ref": "Container"
        },
        "ImageSnapshotId": {
          "Ref": "ImageSnapshotId"
        },
        "DnsConfig": {
          "Ref": "DnsConfig"
        },
        "AutoMatchImageCache": {
          "Ref": "AutoMatchImageCache"
        },
        "Ipv6AddressCount": {
          "Ref": "Ipv6AddressCount"
        },
        "ImageRegistryCredential": {
          "Ref": "ImageRegistryCredential"
        },
        "SpotPriceLimit": {
          "Ref": "SpotPriceLimit"
        },
        "InstanceType": {
          "Ref": "InstanceType"
        },
        "SpotStrategy": {
          "Ref": "SpotStrategy"
        },
        "ActiveDeadlineSeconds": {
          "Ref": "ActiveDeadlineSeconds"
        },
        "HostAliase": {
          "Ref": "HostAliase"
        },
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "TerminationGracePeriodSeconds": {
          "Ref": "TerminationGracePeriodSeconds"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "SecurityGroupId": {
          "Ref": "SecurityGroupId"
        },
        "SlsEnable": {
          "Ref": "SlsEnable"
        },
        "RestartPolicy": {
          "Ref": "RestartPolicy"
        },
        "RamRoleName": {
          "Ref": "RamRoleName"
        },
        "Volume": {
          "Ref": "Volume"
        },
        "Tag": {
          "Ref": "Tag"
        }
      }
    }
  },
  "Outputs": {
    "InternetIp": {
      "Description": "Internet IP.",
      "Value": {
        "Fn::GetAtt": [
          "ContainerGroup",
          "InternetIp"
        ]
      }
    },
    "ZoneId": {
      "Description": "The ID of the zone in which the instance resides. If you leave the parameter blank, the system assigns a zone for you. The default value is blank.",
      "Value": {
        "Fn::GetAtt": [
          "ContainerGroup",
          "ZoneId"
        ]
      }
    },
    "SecurityGroupId": {
      "Description": "The ID of the security group to which the instance belongs. Instances in the same security group can access one another.",
      "Value": {
        "Fn::GetAtt": [
          "ContainerGroup",
          "SecurityGroupId"
        ]
      }
    },
    "VSwitchId": {
      "Description": "The ID of the VSwitch. Currently, ECI instances can only be deployed in VPCs.",
      "Value": {
        "Fn::GetAtt": [
          "ContainerGroup",
          "VSwitchId"
        ]
      }
    },
    "EniInstanceId": {
      "Description": "ENI instance ID.",
      "Value": {
        "Fn::GetAtt": [
          "ContainerGroup",
          "EniInstanceId"
        ]
      }
    },
    "ContainerGroupId": {
      "Description": "The ID of the container group.",
      "Value": {
        "Fn::GetAtt": [
          "ContainerGroup",
          "ContainerGroupId"
        ]
      }
    },
    "RegionId": {
      "Description": "The ID of the region in which the instance resides.",
      "Value": {
        "Fn::GetAtt": [
          "ContainerGroup",
          "RegionId"
        ]
      }
    },
    "ContainerGroupName": {
      "Description": "The name of the container group.",
      "Value": {
        "Fn::GetAtt": [
          "ContainerGroup",
          "ContainerGroupName"
        ]
      }
    },
    "IntranetIp": {
      "Description": "Intranet IP.",
      "Value": {
        "Fn::GetAtt": [
          "ContainerGroup",
          "IntranetIp"
        ]
      }
    },
    "Ipv6Address": {
      "Description": "Ipv6 address.",
      "Value": {
        "Fn::GetAtt": [
          "ContainerGroup",
          "Ipv6Address"
        ]
      }
    }
  }
}

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  SecurityContextSysctl:
    Type: Json
    Description: |-
      ECI Sysctl is valid for every container in ECI.
      Currently only two Sysctl keyNames are supported:
      Kernel.shm_rmid_forced
      Kernel.msgmax
  Memory:
    Type: Number
    Description: memory size
  InitContainer:
    Type: Json
    Description: The containers that constitute the container group for initializing.
  Cpu:
    Type: Number
    Description: CPU size
  EipInstanceId:
    Type: String
    Description: Elastic IP ID
  ContainerGroupName:
    Type: String
    Description: >-
      The name of the container group.

      The length is [2,128] English lowercase letters, numbers or hyphens (-),
      cannot begin or end with a hyphens.
    MinLength: 2
    MaxLength: 128
  Container:
    Type: Json
    Description: The containers that constitute the container group.
  ImageSnapshotId:
    Type: String
    Description: Image cache ID or snapshot ID.
  DnsConfig:
    Type: Json
    Description: The information about DNS configurations.
  AutoMatchImageCache:
    Type: Boolean
    Description: Specifies whether to automatically match the image cache.
    AllowedValues:
      - true
      - false
  Ipv6AddressCount:
    Type: Number
    Description: The number of IPv6 addresses.
  ImageRegistryCredential:
    Type: Json
    Description: >-
      The information that you need to log on to the container image repository,
      including the server address, username, and password.
    MaxLength: 10
  SpotPriceLimit:
    Type: Number
    Description: >-
      Set the hourly maximum price of the instance. It supports a maximum of 3
      decimal places. It takes effect when the value of the parameter
      SpotStrategy is SpotWithPriceLimit.
  InstanceType:
    Type: String
    Description: The type of the ECS instance.
  SpotStrategy:
    Type: String
    Description: >-
      Instance preemption strategy.

      Ranges:

      NoSpot (default): normal pay-as-you-go instances.

      SpotWithPriceLimit: Preemptive instance that sets a cap price.

      SpotAsPriceGo: The system automatically bids, following the current market
      actual price.
    AllowedValues:
      - NoSpot
      - SpotWithPriceLimit
      - SpotAsPriceGo
  ActiveDeadlineSeconds:
    Type: Number
    Description: The validity period in seconds.
  HostAliase:
    Type: Json
    Description: Customize the hostname mapping of a container inside the pod
  ZoneId:
    Type: String
    Description: >-
      The ID of the zone in which the instance resides. If you leave the
      parameter blank, the system assigns a zone for you. The default value is
      blank.
  TerminationGracePeriodSeconds:
    Type: Number
    Description: The buffer time for the program to handle operations before it is stopped.
  VSwitchId:
    Type: String
    Description: >-
      The ID of the specified VSwitch. Currently, ECI instances can only be
      deployed in VPCs.
  SecurityGroupId:
    Type: String
    Description: >-
      The ID of the security group to which the instance belongs. Instances in
      the same security group can access one another.
  SlsEnable:
    Type: Boolean
    Description: Enable user log collection. The default is False.
    AllowedValues:
      - true
      - false
  RestartPolicy:
    Type: String
    Description: 'The policy for restarting the instance. Default value: Always.'
    AllowedValues:
      - Always
      - OnFailure
      - Never
  RamRoleName:
    Type: String
    Description: >-
      The RAM role that the container group assumes. ECI and ECS share the same
      RAM role.
  Volume:
    Type: Json
    Description: The data volume. You can specify a maximum of 20 data volumes.
    MaxLength: 20
  Tag:
    Type: Json
    Description: >-
      The list of container group tags in the form of key/value pairs. You can
      define a maximum of 20 tags for each container group.
    MaxLength: 20
Resources:
  ContainerGroup:
    Type: 'ALIYUN::ECI::ContainerGroup'
    Properties:
      SecurityContextSysctl:
        Ref: SecurityContextSysctl
      Memory:
        Ref: Memory
      InitContainer:
        Ref: InitContainer
      Cpu:
        Ref: Cpu
      EipInstanceId:
        Ref: EipInstanceId
      ContainerGroupName:
        Ref: ContainerGroupName
      Container:
        Ref: Container
      ImageSnapshotId:
        Ref: ImageSnapshotId
      DnsConfig:
        Ref: DnsConfig
      AutoMatchImageCache:
        Ref: AutoMatchImageCache
      Ipv6AddressCount:
        Ref: Ipv6AddressCount
      ImageRegistryCredential:
        Ref: ImageRegistryCredential
      SpotPriceLimit:
        Ref: SpotPriceLimit
      InstanceType:
        Ref: InstanceType
      SpotStrategy:
        Ref: SpotStrategy
      ActiveDeadlineSeconds:
        Ref: ActiveDeadlineSeconds
      HostAliase:
        Ref: HostAliase
      ZoneId:
        Ref: ZoneId
      TerminationGracePeriodSeconds:
        Ref: TerminationGracePeriodSeconds
      VSwitchId:
        Ref: VSwitchId
      SecurityGroupId:
        Ref: SecurityGroupId
      SlsEnable:
        Ref: SlsEnable
      RestartPolicy:
        Ref: RestartPolicy
      RamRoleName:
        Ref: RamRoleName
      Volume:
        Ref: Volume
      Tag:
        Ref: Tag
Outputs:
  InternetIp:
    Description: Internet IP.
    Value:
      'Fn::GetAtt':
        - ContainerGroup
        - InternetIp
  ZoneId:
    Description: >-
      The ID of the zone in which the instance resides. If you leave the
      parameter blank, the system assigns a zone for you. The default value is
      blank.
    Value:
      'Fn::GetAtt':
        - ContainerGroup
        - ZoneId
  SecurityGroupId:
    Description: >-
      The ID of the security group to which the instance belongs. Instances in
      the same security group can access one another.
    Value:
      'Fn::GetAtt':
        - ContainerGroup
        - SecurityGroupId
  VSwitchId:
    Description: >-
      The ID of the VSwitch. Currently, ECI instances can only be deployed in
      VPCs.
    Value:
      'Fn::GetAtt':
        - ContainerGroup
        - VSwitchId
  EniInstanceId:
    Description: ENI instance ID.
    Value:
      'Fn::GetAtt':
        - ContainerGroup
        - EniInstanceId
  ContainerGroupId:
    Description: The ID of the container group.
    Value:
      'Fn::GetAtt':
        - ContainerGroup
        - ContainerGroupId
  RegionId:
    Description: The ID of the region in which the instance resides.
    Value:
      'Fn::GetAtt':
        - ContainerGroup
        - RegionId
  ContainerGroupName:
    Description: The name of the container group.
    Value:
      'Fn::GetAtt':
        - ContainerGroup
        - ContainerGroupName
  IntranetIp:
    Description: Intranet IP.
    Value:
      'Fn::GetAtt':
        - ContainerGroup
        - IntranetIp
  Ipv6Address:
    Description: Ipv6 address.
    Value:
      'Fn::GetAtt':
        - ContainerGroup
        - Ipv6Address