Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Adding Component Configuration

Updated on 2025-02-14 GMT+08:00

Function

This API is used to add component configuration.

URI

POST /v1/{project_id}/cae/applications/{application_id}/components/{component_id}/configurations

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. See Obtaining a Project ID.

application_id

Yes

String

Application ID.

component_id

Yes

String

Component ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

Maximum characters: 16,384

X-Enterprise-Project-ID

No

String

Enterprise project ID.

  • When an environment is created, it will be bound with an enterprise project ID.
  • Enter 0 or up to 36 characters in UUID format with hyphens (-).
  • If this parameter is not specified or set to 0, resources in the default enterprise project are queried.
NOTE:

For more information about enterprise projects and how to obtain enterprise project IDs, see Enterprise Management User Guide.

X-Environment-ID

Yes

String

Environment ID.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

api_version

Yes

String

API version. Fixed value: v1.

Enumerated value:

  • v1

kind

Yes

String

API type. Fixed value: ComponentConfiguration.

Enumerated value:

  • ComponentConfiguration

items

Yes

Array of ConfigurationItem objects

Configuration item list.

Table 4 ConfigurationItem

Parameter

Mandatory

Type

Description

type

Yes

String

Component configuration type.

Enumerated values:

  • rds
  • cse
  • env
  • access
  • scaling
  • volume
  • healthCheck
  • lifecycle
  • apm2
  • log
  • customMetric

data

Yes

ConfigurationData object

Component configuration data.

Table 5 ConfigurationData

Parameter

Mandatory

Type

Description

spec

No

ConfigurationRequestDataSpec object

Component configuration data specifications.

metadata

No

ConfigurationDataMetadata object

Component configuration metadata.

Table 6 ConfigurationRequestDataSpec

Parameter

Mandatory

Type

Description

rds_id

No

String

RDS DB instance ID.

This parameter is mandatory when type under ConfigurationItem is set to rds.

rds_db_name

No

String

RDS database name.

This parameter is mandatory when type under ConfigurationItem is set to rds.

rds_address

No

String

RDS database address.

This parameter is mandatory when type under ConfigurationItem is set to rds.

rds_username

No

String

RDS database username.

This parameter is mandatory when type under ConfigurationItem is set to rds.

rds_password

No

String

RDS database password.

This parameter is mandatory when type under ConfigurationItem is set to rds.

rds_port

No

String

RDS database port.

This parameter is mandatory when type under ConfigurationItem is set to rds.

config_center_addr

No

String

Address of the CSE configuration center.

This parameter is mandatory when type under ConfigurationItem is set to cse.

service_center_addr

No

String

Address for service registry and discovery.

This parameter is mandatory when type under ConfigurationItem is set to cse.

cse_id

No

String

CSE engine ID.

This parameter is mandatory when type under ConfigurationItem is set to cse.

envs

No

map<string, object>

Environment variable.

This parameter is mandatory when type under ConfigurationItem is set to env.

Common environment variables:

  • TZ: time zone. For example, set Asia/Shanghai for GMT+08:00.
  • LANG: language.

ip

No

String

EIP, which is returned when no domain name is configured.

items

No

Array of AccessConfigurationDataItems objects

Access configuration list.

This parameter is mandatory when type under ConfigurationItem is set to access.

scale_strategy

No

String

AS policy type.

This parameter is mandatory when type under ConfigurationItem is set to scaling.

Enumerated values:

  • metric
  • time
  • mix

max_replica_count

No

Integer

Maximum number of instances that can be scaled in an AS policy.

This parameter is mandatory when type under ConfigurationItem is set to scaling.

min_replica_count

No

Integer

Minimum number of instances that can be scaled in an AS policy.

This parameter is mandatory when type under ConfigurationItem is set to scaling.

advanced

No

ScaleConfigurationDataAdvanced object

Advanced settings of an AS policy.

This parameter is mandatory when type under ConfigurationItem is set to scaling.

triggers

No

Array of ScaleConfigurationDataTrigger objects

Trigger list of an AS policy.

This parameter is mandatory when type under ConfigurationItem is set to scaling.

volumes

No

Array of VolumeConfigurationDataVolume objects

Cloud storage configuration list.

This parameter is mandatory when type under ConfigurationItem is set to volume.

livenessProbe

No

HealthCheckConfigurationLivenessProbe object

Liveness probe configuration for health check.

This parameter is mandatory when type under ConfigurationItem is set to healthCheck.

startupProbe

No

HealthCheckConfigurationStartupProbe object

Startup probe configuration for health check.

This parameter is mandatory when type under ConfigurationItem is set to healthCheck.

readinessProbe

No

HealthCheckConfigurationReadinessProbe object

Readiness probe configuration for health check.

This parameter is mandatory when type under ConfigurationItem is set to healthCheck.

postStart

No

postStart object

Post-startup processing configured for lifecycle management.

This parameter is mandatory when type under ConfigurationItem is set to lifecycle.

preStop

No

preStop object

Pre-stop processing configured for lifecycle management.

This parameter is mandatory when type under ConfigurationItem is set to lifecycle.

log_paths

No

Array of strings

Custom log path array.

This parameter is mandatory when type under ConfigurationItem is set to log.

instrumentation

No

String

Agent injection mode.

This parameter is mandatory when type under ConfigurationItem is set to apm2.

path

No

String

Collection path for custom metric monitoring.

This parameter is mandatory when type under ConfigurationItem is set to customMetric.

port

No

String

Collection port for custom metric monitoring.

This parameter is mandatory when type under ConfigurationItem is set to customMetric.

metrics

No

Array of strings

Metric for custom monitoring.

This parameter is mandatory when type under ConfigurationItem is set to customMetric.

Table 7 AccessConfigurationDataItems

Parameter

Mandatory

Type

Description

type

No

String

Access mode.

Enumerated values:

  • ClusterIP
  • LoadBalancer
  • Ingress

domain_names

No

String

Domain name for private network access.

access_control

No

AccessControl object

Access control configuration. Blacklists and whitelists can be configured.

ports

No

Array of AccessConfigurationPort objects

Access information, such as the port, protocol, certificate, and URL.

Table 8 AccessControl

Parameter

Mandatory

Type

Description

black

No

Array of strings

Blacklist array.

  • Each line contains an IP address or a CIDR block and ends with a line break.
  • You can add a maximum of 300 IP addresses or CIDR blocks in each IP address group.

white

No

Array of strings

Whitelist array.

  • Each line contains an IP address or a CIDR block and ends with a line break.
  • You can add a maximum of 300 IP addresses or CIDR blocks in each IP address group.
Table 9 AccessConfigurationPort

Parameter

Mandatory

Type

Description

target_port

No

Integer

Listening port.

port

No

Integer

Access port.

protocol

No

String

Protocol. Load balancing supports TCP, HTTP, and HTTPS while route configuration supports HTTP and HTTPS.

Enumerated values:

  • TCP
  • HTTP
  • HTTPS

default_certificate

No

String

Default certificate, which is configured when the access mode is set to Ingress and protocol is set to HTTPS. It will be used if SNI is not configured.

certificate

No

String

Certificate.

policy

No

String

Security policy.

Enumerated values:

  • tls-1-2-strict
  • tls-1-2
  • tls-1-1
  • tls-1-0

paths

No

Array of AccessConfigurationHttpPath objects

Path and domain name for matching.

elb_id

No

String

Selected ELB ID.

Table 10 AccessConfigurationHttpPath

Parameter

Mandatory

Type

Description

hostname

No

String

Domain name. If it is left blank, the IP address is used.

path

No

String

URL.

url_match_mode

No

String

URL path matching mode. Options: STARTS_WITH, REGEX, and EQUAL_TO.

Enumerated values:

  • STARTS_WITH
  • REGEX
  • EQUAL_TO
Table 11 ScaleConfigurationDataAdvanced

Parameter

Mandatory

Type

Description

scaledown_stabilization_seconds

No

Integer

Cooling time window for scale-in.

scaledown_rate

No

Integer

Scale-in step.

scaleup_stabilization_seconds

No

Integer

Cooling time window for scale-out.

scaleup_rate

No

Integer

Scale-out step.

disable_scaledown

No

Boolean

Whether to disable automatic scale-in.

Table 12 ScaleConfigurationDataTrigger

Parameter

Mandatory

Type

Description

type

No

String

Metric type.

Enumerated values:

  • cpu
  • memory
  • cron

metadata

No

ScalingTriggerMeta object

Metadata.

Table 13 ScalingTriggerMeta

Parameter

Mandatory

Type

Description

type

No

String

Data type, which can only be Utilization.

This parameter is mandatory when type under ScaleConfigurationDataTrigger is set to cpu or memory.

value

No

String

Threshold for triggering scaling.

This parameter is mandatory when type under ScaleConfigurationDataTrigger is set to cpu or memory.

period_type

No

String

Validity period.

This parameter is mandatory when type under ScaleConfigurationDataTrigger is set to cron.

Enumerated values:

  • day
  • week
  • month

schedulers

No

Array of CronTriggerScheduler objects

Time when the scaling is triggered and number of instances triggered in each period.

This parameter is mandatory when type under ScaleConfigurationDataTrigger is set to cron.

Table 14 CronTriggerScheduler

Parameter

Mandatory

Type

Description

cron

No

String

Trigger time, which is a cron expression consisting of five fields.

target_replica

No

Integer

Number of required instances.

Table 15 VolumeConfigurationDataVolume

Parameter

Mandatory

Type

Description

volume_id

No

String

Cloud storage ID.

resource_name

No

String

Cloud storage name.

resource_type

No

String

Resource type.

Enumerated values:

  • obs

resource_sub_type

No

String

Resource sub-type.

Enumerated values:

  • object_bucket
  • parallel_file_system

umask

No

String

Default permission on a directory or file. SFS 3.0 cloud storage does not support this parameter. Default value: 0027.

mount_info

No

Array of VolumeConfigurationMountInfo objects

Cloud storage mounting information.

Table 16 VolumeConfigurationMountInfo

Parameter

Mandatory

Type

Description

path

No

String

Container mount path.

sub_path

No

String

Sub-path.

access_mode

No

String

Read or write permission.

Enumerated values:

  • ReadWriteMany
  • ReadOnlyMany
Table 17 HealthCheckConfigurationLivenessProbe

Parameter

Mandatory

Type

Description

periodSeconds

No

Integer

Detection period. Unit: second.

initialDelaySeconds

No

Integer

Latency. Unit: second.

timeoutSeconds

No

Integer

Timeout. Unit: second.

successThreshold

No

Integer

Success threshold.

failureThreshold

No

Integer

Failure threshold.

httpGet

No

HealthCheckConfigurationHttpGet object

HTTP request check information in the health check configuration.

tcpSocket

No

HealthCheckConfigurationTcpSocket object

TCP port check information in the health check configuration.

exec

No

HealthCheckConfigurationExec object

Command check information in the health check configuration.

Table 18 HealthCheckConfigurationStartupProbe

Parameter

Mandatory

Type

Description

periodSeconds

No

Integer

Detection period. Unit: second.

initialDelaySeconds

No

Integer

Latency. Unit: second.

timeoutSeconds

No

Integer

Timeout. Unit: second.

successThreshold

No

Integer

Success threshold.

failureThreshold

No

Integer

Failure threshold.

httpGet

No

HealthCheckConfigurationHttpGet object

HTTP request check information in the health check configuration.

tcpSocket

No

HealthCheckConfigurationTcpSocket object

TCP port check information in the health check configuration.

exec

No

HealthCheckConfigurationExec object

Command check information in the health check configuration.

Table 19 HealthCheckConfigurationReadinessProbe

Parameter

Mandatory

Type

Description

periodSeconds

No

Integer

Detection period. Unit: second.

initialDelaySeconds

No

Integer

Latency. Unit: second.

timeoutSeconds

No

Integer

Timeout. Unit: second.

successThreshold

No

Integer

Success threshold.

failureThreshold

No

Integer

Failure threshold.

httpGet

No

HealthCheckConfigurationHttpGet object

HTTP request check information in the health check configuration.

tcpSocket

No

HealthCheckConfigurationTcpSocket object

TCP port check information in the health check configuration.

exec

No

HealthCheckConfigurationExec object

Command check information in the health check configuration.

Table 20 HealthCheckConfigurationHttpGet

Parameter

Mandatory

Type

Description

path

No

String

URL.

port

No

String

Port.

scheme

No

String

Protocol.

Enumerated values:

  • HTTP
  • HTTPS
Table 21 HealthCheckConfigurationTcpSocket

Parameter

Mandatory

Type

Description

port

No

String

Port.

Table 22 HealthCheckConfigurationExec

Parameter

Mandatory

Type

Description

command

No

Array of strings

Shell statement.

Table 23 postStart

Parameter

Mandatory

Type

Description

exec

No

LifeCycleConfigurationExec object

Command to execute.

Table 24 preStop

Parameter

Mandatory

Type

Description

exec

No

LifeCycleConfigurationExec object

Command to execute.

Table 25 LifeCycleConfigurationExec

Parameter

Mandatory

Type

Description

command

No

Array of strings

Shell statement.

Table 26 ConfigurationDataMetadata

Parameter

Mandatory

Type

Description

annotations

No

Map<String,String>

Additional parameters.

Assume that you need to use the weighted round robin algorithm for load balancing and disable health check. Configuration example:

  • "kubernetes.io/elb.health-check-flag": "off"
  • "kubernetes.io/elb.lb-algorithm": "ROUND_ROBIN"

Response Parameters

None

Example Request

  • Configure an RDS database: Set the database name to cae, address to 100.xx.xx.xxx, and port number to 3306.
    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/configurations
    
    {
      "api_version" : "v1",
      "kind" : "ComponentConfiguration",
      "items" : [ {
        "type" : "rds",
        "data" : {
          "spec" : {
            "rds_id" : "a5fdee4cf88c4277a68688a014f444bdin01",
            "rds_db_name" : "cae",
            "rds_address" : "100.xx.xx.xxx",
            "rds_username" : "cae",
            "rds_password" : "xxx",
            "rds_port" : "3306"
          }
        }
      } ]
    }
  • Configure CSE addresses: Set the configuration center addresses to https://192.168.1.xxx:30103,https://192.168.1.xxx:30103, and the service registration and discovery addresses to https://192.168.1.xxx:30100,https://192.168.1.xxx:30100.
    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/configurations
    
    {
      "api_version" : "v1",
      "kind" : "ComponentConfiguration",
      "items" : [ {
        "type" : "cse",
        "data" : {
          "spec" : {
            "config_center_addr" : "https://192.168.1.xxx:30103,https://192.168.1.xxx:30103",
            "service_center_addr" : "https://192.168.1.xxx:30100,https://192.168.1.xxx:30100",
            "cse_id" : "25779525-1aac-44be-abda-f9164f1b41b8"
          }
        }
      } ]
    }
  • Create an environment variable component configuration: Set the time zone to Asia/Shanghai, and inject a secret named password as the environment variable.
    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/configurations
    
    {
      "api_version" : "v1",
      "kind" : "ComponentConfiguration",
      "items" : [ {
        "type" : "env",
        "data" : {
          "spec" : {
            "envs" : {
              "TZ" : "Asia/Shanghai"
            },
            "env_references" : {
              "env_name" : "db_password",
              "value_from" : {
                "name" : "password",
                "reference_type" : "dewSecret"
              }
            }
          }
        }
      } ]
    }
  • Configure private and public network access:
    • Set the private network access mode to ClusterIP, listening port number to 80, access port number to 8080, and protocol to TCP.
    • Set the public network access mode to LoadBalancer, listening port number to 80, access port number to 9090, and protocol to TCP. Configure a whitelist to allow access from 170.126.0.0/16.
    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/configurations
    
    {
      "api_version" : "v1",
      "kind" : "ComponentConfiguration",
      "items" : [ {
        "type" : "access",
        "data" : {
          "spec" : {
            "items" : [ {
              "type" : "ClusterIP",
              "ports" : [ {
                "target_port" : 80,
                "port" : 8080,
                "protocol" : "TCP"
              } ]
            }, {
              "type" : "LoadBalancer",
              "access_control" : {
                "type" : "white",
                "ip_list" : [ "170.126.0.0/16" ]
              },
              "elb_id" : "xxx",
              "ports" : [ {
                "target_port" : 80,
                "port" : 9090,
                "protocol" : "TCP"
              } ]
            } ]
          }
        }
      } ]
    }
  • Configure two forwarding policies for public network access: Set the protocol to HTTPS, retain the default load balancing policy (weighted round robin algorithm), set the access port number to 8443, configure a blacklist to deny access from 10.120.1.1 and 10.120.1.2, set the security policy to tls-1-2-strict, and retain the default server certificate test.
    • For the first forwarding policy, set the domain name to test.example.com, URL match mode to STARTS_WITH, path to /test1, and listening port number to 80, and use the default certificate test.
    • For the second forwarding policy, set the domain name to test.example.cn, URL match mode to STARTS_WITH, path to /test2, listening port number to 80, and certificate to test1.
    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/configurations
    
    {
      "api_version" : "v1",
      "kind" : "ComponentConfiguration",
      "items" : [ {
        "type" : "access",
        "data" : {
          "spec" : {
            "items" : [ {
              "type" : "Ingress",
              "access_control" : {
                "type" : "black",
                "ip_list" : [ "10.120.1.1", "10.120.1.2" ]
              },
              "ports" : [ {
                "port" : 8443,
                "protocol" : "HTTPS",
                "default_certificate" : "test",
                "policy" : "tls-1-2-strict",
                "target_port" : 80,
                "paths" : [ {
                  "path" : "/test1",
                  "url_match_mode" : "STARTS_WITH",
                  "hostname" : "test.example.com"
                } ]
              }, {
                "port" : 8443,
                "protocol" : "HTTPS",
                "default_certificate" : "test",
                "certificate" : "test1",
                "policy" : "tls-1-2-strict",
                "target_port" : 80,
                "paths" : [ {
                  "path" : "/test2",
                  "url_match_mode" : "STARTS_WITH",
                  "hostname" : "test.example.cn"
                } ]
              } ]
            } ]
          },
          "metadata" : {
            "annotations" : {
              "kubernetes.io/elb.health-check-flag" : "off",
              "kubernetes.io/elb.lb-algorithm" : "ROUND_ROBIN"
            }
          }
        }
      } ]
    }
  • Create an AS policy: Set max_replica_count to 3, min_replica_count to 1, CPU usage to 30%, memory usage to 30%, and scaledown_stabilization_seconds to 300 (5 minutes), scaledown_rate to 99, scaleup_rate to 4, and disable_scaledown to false.
    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/configurations
    
    {
      "api_version" : "v1",
      "kind" : "ComponentConfiguration",
      "items" : [ {
        "type" : "scaling",
        "data" : {
          "spec" : {
            "scale_strategy" : "metric",
            "max_replica_count" : 3,
            "min_replica_count" : 1,
            "advanced" : {
              "scaledown_stabilization_seconds" : 300,
              "scaledown_rate" : 99,
              "scaleup_stabilization_seconds" : 0,
              "scaleup_rate" : 4,
              "disable_scaledown" : false
            },
            "triggers" : [ {
              "metadata" : {
                "type" : "Utilization",
                "value" : "30"
              },
              "type" : "cpu"
            }, {
              "metadata" : {
                "type" : "Utilization",
                "value" : "30"
              },
              "type" : "memory"
            } ]
          }
        }
      } ]
    }
  • Configure cloud storage (OBS bucket or OBS parallel file system): For an object bucket, set the mount path to /tmp and permission to ReadWriteMany. For a parallel file system, set the mount path to /temp and permission to ReadWriteMany.
    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/configurations
    
    {
      "api_version" : "v1",
      "kind" : "ComponentConfiguration",
      "items" : [ {
        "type" : "volume",
        "data" : {
          "spec" : {
            "volumes" : [ {
              "volume_id" : "bef119d0-c7d1-4b58-9794-8b74faf80a59",
              "resource_name" : "test-nacos",
              "resource_type" : "obs",
              "resource_sub_type" : "object_bucket",
              "umask" : "0027",
              "mount_info" : [ {
                "path" : "/tmp",
                "access_mode" : "ReadWriteMany"
              } ]
            }, {
              "mount_info" : [ {
                "path" : "/temp",
                "access_mode" : "ReadWriteMany"
              } ],
              "volume_id" : "a061934d-52e3-4b36-aea7-6c51879f84c9",
              "resource_name" : "test",
              "resource_type" : "obs",
              "resource_sub_type" : "parallel_file_system",
              "umask" : "0027"
            } ]
          }
        }
      } ]
    }
  • Configure health check, including configuring a liveness probe, readiness probe, and startup probe.
    • Configure a liveness probe: Set the type to livenessProbe, detection period to 10s, latency to 1s, timeout to 1s, success threshold to 1, failure threshold to 3, port number to 80, and protocol to HTTP. Leave the path and request header blank.
    • Configure a readiness probe: Set the type to readinessProbe, detection period to 10s, latency to 0s (if the value is 0, it is optional to transfer this parameter), timeout to 1s, success threshold to 1, failure threshold to 3, port number to 80, and protocol to HTTP. Leave the path and request header blank.
    • Configure a startup probe: Set the type to startupProbe, detection period to 10s, latency to 0s (if the value is 0, it is optional to transfer this parameter), timeout to 1s, success threshold to 1, failure threshold to 3, port number to 80, protocol to HTTP, and request header to x-auth-token. Leave the path blank.
    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/configurations
    
    {
      "api_version" : "v1",
      "kind" : "ComponentConfiguration",
      "items" : [ {
        "type" : "healthCheck",
        "data" : {
          "spec" : {
            "livenessProbe" : {
              "periodSeconds" : 10,
              "initialDelaySeconds" : 1,
              "timeoutSeconds" : 1,
              "successThreshold" : 1,
              "failureThreshold" : 3,
              "httpGet" : {
                "path" : "",
                "port" : 80,
                "httpHeaders" : [ ],
                "scheme" : "HTTP"
              }
            },
            "startupProbe" : {
              "periodSeconds" : 10,
              "timeoutSeconds" : 1,
              "successThreshold" : 1,
              "failureThreshold" : 3,
              "httpGet" : {
                "path" : "",
                "port" : 80,
                "httpHeaders" : [ {
                  "name" : "x-auth-token",
                  "value" : "xxx"
                } ],
                "scheme" : "HTTP"
              }
            },
            "readinessProbe" : {
              "periodSeconds" : 10,
              "timeoutSeconds" : 1,
              "successThreshold" : 1,
              "failureThreshold" : 3,
              "httpGet" : {
                "path" : "",
                "port" : 80,
                "httpHeaders" : [ ],
                "scheme" : "HTTP"
              }
            }
          }
        }
      } ]
    }
  • Configure lifecycle management (such as post-startup and pre-stop processing). Configure the post-startup command /bin/sh -c "echo service start" and the pre-stop command /bin/sh -c "echo service end".
    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/configurations
    
    {
      "api_version" : "v1",
      "kind" : "ComponentConfiguration",
      "items" : [ {
        "type" : "lifecycle",
        "data" : {
          "spec" : {
            "postStart" : {
              "exec" : {
                "command" : [ "/bin/sh", "-c", "echo service start" ]
              }
            },
            "preStop" : {
              "exec" : {
                "command" : [ "/bin/sh", "-c", "echo service end" ]
              }
            }
          }
        }
      } ]
    }
  • Configure custom log collection: Specify path /var/log/error.log to collect logs.
    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/configurations
    
    {
      "api_version" : "v1",
      "kind" : "ComponentConfiguration",
      "items" : [ {
        "type" : "log",
        "data" : {
          "spec" : {
            "log_paths" : [ "/var/log/error.log" ]
          }
        }
      } ]
    }
  • Configure performance management: Set instrumentation to automatic.
    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/configurations
    
    {
      "api_version" : "v1",
      "kind" : "ComponentConfiguration",
      "items" : [ {
        "type" : "apm2",
        "data" : {
          "spec" : {
            "instrumentation" : "automatic"
          }
        }
      } ]
    }
  • Configure custom metric monitoring: Set the collection path to /metrics and port to 2112, and specify custom metric myapp_processed_ops_total.
    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/configurations
    
    {
      "api_version" : "v1",
      "kind" : "ComponentConfiguration",
      "items" : [ {
        "type" : "customMetric",
        "data" : {
          "spec" : {
            "path" : "/metrics",
            "port" : 2112,
            "metrics" : [ "myapp_processed_ops_total" ]
          }
        }
      } ]
    }

Example Response

None

Status Code

Status Code

Description

200

The request is successful.

Error Code

For details, see Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback