All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::CS::ClusterApplication

Last Updated:Jul 25, 2024

ALIYUN::CS::ClusterApplication is used to deploy an application in a Container Service for Kubernetes (ACK) cluster.

Syntax

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

Properties

Property

Type

Required

Editable

Description

Constraint

ClusterId

String

Yes

No

The cluster ID.

None.

YamlContent

String

Yes

Yes

The YAML template content that you want to use to deploy the application.

None.

DefaultNamespace

String

No

No

The default namespace of the application.

None.

RolePolicy

String

No

Yes

The role policy.

Before you deploy the application, check the policies that are attached to the role of your account.

Valid values:

  • EnsureAdminRoleAndBinding (default): automatically creates a role named ros:application-admin:${user-id}\ that has administrator permissions and attaches the role to your account.

  • None: does not perform operations.  

Stage

String

No

No

The one or more running stages.  

Valid values:

  • All (default): all stages, including the creation, update, and deletion stages.  

  • Delete: deletion stage. This value indicates that the YAML content is applied to the cluster only during the deletion stage of the resource.  

ValidationMode

String

No

No

The validation mode.

Valid values:

  • Basic: basic validation. For example, the system validates whether the cluster exists.

  • Strict: strict validation. In addition to a basic validation, the system validates the validity of WaitUntil.  

WaitUntil

List

No

Yes

The system waits until all conditions are met after you start to create or update the application.  

For more information, see WaitUntil properties.

WaitUntil syntax

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

WaitUntil properties

Property

Type

Required

Editable

Description

Constraint

Kind

String

Yes

Yes

The type of the Kubernetes resource that you want to query.

None.

Name

String

Yes

Yes

The name of the Kubernetes resource that you want to query.

None.

Operator

String

Yes

Yes

The operator based on which you compare the value with the result of the JSONPath expression.  

None.

FirstMatch

Boolean

No

Yes

Specifies whether to return only the first matched result in the results that are filtered by using the JSONPath expression.  

Valid values:

  • true

  • false (default)

JsonPath

String

No

Yes

The JSONPath expression that you want to use to filter results.

None.

Namespace

String

No

Yes

The Kubernetes namespace of the resource.

Default value: DefaultNamespace.  

Stage

String

No

No

The one or more stages at which the system waits.   

Valid values:

  • Create/Update (default): creation and update stages

  • Delete: deletion stage  

Timeout

Integer

No

Yes

The timeout period for waiting for the conditions to be met.

Unit: seconds.

Value

String

No

Yes

The value to be compared with the result of the JSONPath expression.  

None.

ValueType

String

No

Yes

The value type.

Default value: String.

Return values

Fn::GetAtt

  • ClusterId: the cluster ID.

  • WaitUntilData: the JSONPath values in WaitUntil.  

Examples

YAML format

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 format

{
  "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"
        ]
      }
    }
  }
}