Updated on 2023-08-11 GMT+08:00

CCI.Deployment

Element Description

The CCI.Deployment element is used to create a deployment.

Element Properties

Table 1 Property Description

Property

Required

Descripiton

k8sManifest

Yes

Deployment object in the Kubernetes cluster created by the CCI 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.

namespace

Yes

Namespace in a cluster where a workload is located

Type: HuaweiCloud.CCI.Namespace.Name

Value Description: Supports customization.

Value Constraint: The value must start with a letter. Only lowercase letters, digits, and hyphens (-) are allowed. The length of namespace can't be over 63.

Suggestion: Log in to the CCI console. In the navigation pane on the left, choose Namespaces. View and select the target namespace.

Relationships Between Elements

Table 2 Relationship description

Description

Target

DependsOn

RDS.MySQL

DependsOn

CCI.Secret

DependsOn

CCI.Job

DependsOn

CCI.StatefulSet

DependsOn

CCI.Storage.EVS

DependsOn

DCS.Redis

DependsOn

CCI.Service

DependsOn

CCI.Deployment

DependsOn

CCI.Storage.SFS

DependsOn

CCI.ConfigMap

DependsOn

RDS.PostgreSQL

DependsOn

CCI.Ingress

DependsOn

AOS.Batch

DependsOn

OBS.Bucket

ContainedIn

CCI.Namespace

Return Value

Property

Type

Description

refID

string

ID of CCI Deployment

refName

string

Name of CCI Deployment

Blueprint Example

tosca_definitions_version: huaweicloud_tosca_version_1_0
inputs:
  containername:
    default: deployment-123
    type: string
  cpu:
    default: 300m
    type: string
  deploymentname:
    default: deploymenttest
    type: string
  image:
    default: '*.*.*.*:20202/***/redis:V1'
    type: string
  imagePullPolicy:
    default: IfNotPresent
    type: string
  labels:
    default: mydeployment
    type: string
  memory:
    default: 1Gi
    type: string
  replicas:
    default: 1
    type: integer
  namespace:
    default: cci-ns
    description: Namespace in a cluster where a workload is located
node_templates:
  my-deployment:
    properties:
      k8sManifest:
        apiVersion: 'apps/v1'
        kind: Deployment
        metadata:
          labels:
            'cce/appgroup':
              get_input: labels
          name:
            get_input: deploymentname
        spec:
          replicas:
            get_input: replicas
          rollbackTo:
            revision: 0
          selector:
            matchLabels:
              'cce/appgroup':
                get_input: labels
          template:
            metadata:
              labels:
                'cce/appgroup':
                  get_input: labels
            spec:
              containers:
                - command:
                    - sh
                    - '-c'
                    - sleep 10000;
                  image:
                    get_input: image
                  name:
                    get_input: containername
                  resources:
                    limits:
                      cpu:
                        get_input: cpu
                      memory:
                        get_input: memory
                    requests:
                      cpu:
                        get_input: cpu
                      memory:
                        get_input: memory
              imagePullPolicy:
                get_input: imagePullPolicy
      namespace: 
        get_input: namespace
    type: HuaweiCloud.CCI.Deployment
outputs:
  deployment-name:
    description: Name of deployment
    value:
      get_attribute:
        - my-deployment
        - refName