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

CCE.StatefulSet

Element Description

The CCE.StatefulSet element is used to create stateful services for a Huawei CCE cluster.

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, and choose Resource Management > Namespaces. View and select the target namespace.

k8sManifest

Yes

Native manifest of the StatefulSet object of the Kubernetes

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.

Value Constraint: This field cannot be empty.

Suggestion: Customize the value. For details, visit https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/.

clusterId

No

ID of the CCE cluster to which the resource belongs (the cluster version must be 1.7 or later)

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 then obtain its cluster ID. Connect to the cluster object and use the get_reference function to obtain the cluster ID.

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

refName

string

Name of a stateful service

refLabelsApp

string

Name of label app

Blueprint Example

tosca_definitions_version: huaweicloud_tosca_version_1_0
inputs:
  statefulset-image-addr:
    default: "*.*.*.*:20202/***/redis:V1"
    description: "StatefulSet used image address."
node_templates:
  ccess2u6:
    type: HuaweiCloud.CCE.StatefulSet
    properties:
      k8sManifest:
        kind: StatefulSet
        spec:
          replicas: 1
          serviceName: statefulsettest
          template:
            spec:
              imagePullSecrets:
                - name: default-secret
              containers:
                - image: 
                    get_input: statefulset-image-addr
                  terminationMessagePath: '/dev/termination-log'
                  ports:
                    - containerPort: 80
                      protocal: TCP
                  name: mystatefulset-123
                  imagePullPolicy: IfNotPresent
            metadata:
              labels:
                app: statefulsettest
              name: mystatefulset
          selector:
            matchLabels:
              app: statefulsettest
        apiVersion: 'apps/v1'
        metadata:
          labels:
            'cce/appgroup': mystatefulset
          name: statefulsettest