文档

ALIYUN::CS::ClusterApplication

更新时间:

ALIYUN::CS::ClusterApplication类型用于容器应用部署。

语法

 "ValidationMode": String  {
  "Type": "ALIYUN::CS::ClusterApplication",
  "Properties": {
    "YamlContent": String,
    "ClusterId": String,
    "DefaultNamespace": String,
    "RolePolicy": String,
    "Stage": String,
    "WaitUntil": List,
    "ValidationMode": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

YamlContent

String

部署应用的YAML模板内容。

ClusterId

String

集群ID。

DefaultNamespace

String

应用程序的默认命名空间。

RolePolicy

String

角色策略。

在部署应用程序之前,请检查与当前用户角色关联的策略。

取值:

  • EnsureAdminRoleAndBinding(默认值):自动创建一个名为ros:application-admin:${user-id}\的角色,具有管理员权限,并将其绑定到当前用户。

  • None:不执行任何操作。 

Stage

String

运行阶段。 

取值:

  • All(默认值):所有阶段,包括创建、更新和删除。 

  • Delete:删除阶段。这意味着只有在该资源的删除阶段才会将YAML应用到集群。 

WaitUntil

List

开始创建或更新后,等待直到满足所有条件。 

更多信息,请参见WaitUntil属性

ValidationMode

String

验证模式。

取值:

  • BasicL:基本验证,例如验证集群是否存在。

  • Strict:除了基本验证外,还验证WaitUntil的合法性。 

WaitUntil语法

"WaitUntil": [
  {
   "FirstMatch": Boolean,
   "Timeout": Integer,
   "JsonPath": String,
   "Namespace": String,
   "Stage": String,
   "Name": String,
   "ValueType": String,
   "Kind": String,
   "Value": String,
   "Operator": String
  }
]

WaitUntil属性

属性名称

类型

必须

允许更新

描述

约束

FirstMatch

Boolean

只返回JsonPath过滤结果中的第一个匹配结果。 

取值:

  • true

  • false(默认值)

Timeout

Integer

等待满足条件的超时时间。

单位为秒。

JsonPath

String

Json路径表达式来过滤输出。

Namespace

String

资源所在的kubernetes的命名空间。

默认值为DefaultNamespace。 

Stage

String

在什么阶段等待。  

取值:

  • Create/Update(默认值):创建和更新阶段。

  • Delete:删除阶段。 

Name

String

要查询的Kubernetes资源名称。

ValueType

String

值的类型。

默认值为String。

Kind

String

要查询的Kubernetes资源类型。

Value

String

要与JsonPath表达式的结果进行比较的值。 

Operator

String

将值与JsonPath表达式的结果进行比较的操作符。 

返回值

Fn::GetAtt

  • ClusterId:集群ID。

  • WaitUntilData:WaitUntil中每个JsonPath的值列表。 

示例

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  ClusterId:
    Type: String
    Description: The ID of the kubernetes cluster.
Resources:
  ClusterApplication:
    Type: ALIYUN::CS::ClusterApplication
    Properties:
      YamlContent: |-
        apiVersion: storage.k8s.io/v1
        kind: StorageClass
        metadata:
          name: test-ut-storage
          annotations:
            storageclass.beta.kubernetes.io/is-default-class: "true"
            storageclass.kubernetes.io/is-default-class: "true"
        mountOptions:
        - nolock,tcp,noresvport
        - vers=3
        parameters:
          server:  1.1.1.1
          driver: flexvolume
        provisioner: alicloud/nas
        reclaimPolicy: Delete

        ---

        apiVersion: v1
        kind: ConfigMap
        metadata:
          name: test-ut-configmap
        data:
          k1: v1
          k2: v2
      ClusterId:
        Ref: ClusterId
Outputs:
  ClusterId:
    Description: The ID of the cluster.
    Value:
      Fn::GetAtt:
        - ClusterApplication
        - ClusterId

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "ClusterId": {
      "Type": "String",
      "Description": "The ID of the kubernetes cluster."
    }
  },
  "Resources": {
    "ClusterApplication": {
      "Type": "ALIYUN::CS::ClusterApplication",
      "Properties": {
        "YamlContent": "apiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: test-ut-storage\n  annotations:\n    storageclass.beta.kubernetes.io/is-default-class: \"true\"\n    storageclass.kubernetes.io/is-default-class: \"true\"\nmountOptions:\n- nolock,tcp,noresvport\n- vers=3\nparameters:\n  server:  1.1.1.1\n  driver: flexvolume\nprovisioner: alicloud/nas\nreclaimPolicy: Delete\n\n---\n\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: test-ut-configmap\ndata:\n  k1: v1\n  k2: v2",
        "ClusterId": {
          "Ref": "ClusterId"
        }
      }
    }
  },
  "Outputs": {
    "ClusterId": {
      "Description": "The ID of the cluster.",
      "Value": {
        "Fn::GetAtt": [
          "ClusterApplication",
          "ClusterId"
        ]
      }
    }
  }
}
  • 本页导读 (1)
文档反馈