Updated on 2023-12-13 GMT+08:00

CCE.Deployment

Element Description

The CCE.Deployment element is used to create a Deployment object in the Kubernetes cluster on Huawei CCE. Currently, the Kubernetes native YAML file can be used to create the object.

Element Properties

Table 1 Property Description

Property

Required

Descripiton

namespace

No

Namespace in a cluster where a resource is located

Type: string

Value Description: Must be a valid namespace in the cluster, for example, default.

Value Constraint: The value must start with a letter. Only lowercase letters, digits, and hyphens (-) are allowed.

Suggestion: Log in to the CCE console, choose Resource Management > Namespaces, and query information as required.

k8sManifest

Yes

Deployment object in the Kubernetes cluster created by the CCE service

Type: dict

Value Description: This field can be customized. You are advised to use a public image (uploading an image to SWR and setting the image type to public). When updating the image, do not change the name and labels under metadata. If replicas under spec is specified using a get_input function, set type to integer.

Suggestion: Enter the native YAML file content of the Kubernetes object.

clusterId

No

ID of the CCE cluster to which the resource belongs

Type: HuaweiCloud.CCE.Cluster.Id

Value Description: Indicates the ID of an existing or new container cluster.

Value Constraint: The value must satisfy the UUID rule and support a maximum of 64 characters.

Suggestion: Enter the cluster ID. Specifically, log in to the CCE console, and choose Resource Management > Clusters. Click the target cluster, and you can obtain its cluster ID. Connect to the cluster object and use the get_reference function to automatically obtain the value.

Relationships Between Elements

Table 2 Relationship description

Description

Target

DependsOn

AOS.Batch

DependsOn

DCS.Redis

DependsOn

RDS.MySQL

DependsOn

CCE.Storage.EVS

DependsOn

OBS.Bucket

DependsOn

CCE.Storage.SFS

DependsOn

CCE.ConfigMap

DependsOn

CCE.Job

DependsOn

CCE.Storage.OBS

DependsOn

CCE.DaemonSet

DependsOn

CCE.Secret

DependsOn

CCE.Service

DependsOn

CCE.Ingress

DependsOn

CCE.StatefulSet

DependsOn

CCE.NodePool

DependsOn

CCE.Deployment

DependsOn

CCE.Pod

DependsOn

RDS.PostgreSQL

ContainedIn

CCE.Cluster

Return Value

Property

Type

Description

chargeMode

No

Billing mode (billed by traffic or bandwidth)

Type: string

Value Description: Supports bandwidth and traffic. When this parameter is left blank or empty, the default value is bandwidth.

Default: bandwidth

Value Constraint: Supports bandwidth and traffic.

refName

string

Name of the created Deployment object

refLabelsApp

string

Name of label app

Blueprint Example

tosca_definitions_version: huaweicloud_tosca_version_1_0
inputs:
  containername:
    default: deployment-123
    type: string
  deploymentname:
    default: deploymenttest
    type: string
  image:
    default: nginx
    type: string
  imagePullPolicy:
    default: IfNotPresent
    type: string
  labels:
    default: mydeployment
    type: string
node_templates:
  my-deployment:
    type: HuaweiCloud.CCE.Deployment
    properties:
      k8sManifest:
        apiVersion: 'apps/v1'
        kind: Deployment
        metadata:
          labels:
            'cce/appgroup':
              get_input: labels
          name:
            get_input: deploymentname
        spec:
          'replicas:{get_input': 'deploymentname}'
          selector:
            matchLabels:
              'cce/appgroup':
                get_input: labels
          template:
            metadata:
              labels:
                'cce/appgroup':
                  get_input: labels
            spec:
              containers:
                - image:
                    get_input: image
                  name:
                    get_input: containername
              imagePullPolicy:
                get_input: imagePullPolicy