Updated on 2025-10-22 GMT+08:00

Adding a Component Configuration

Function

This API is used to add a 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.

  • Obtain the token. For details, see "Obtaining a User Token" in Identity and Access Management API Reference (https://support.huaweicloud.com/intl/en-us/api-iam/iam_30_0001.html).

  • The value of X-Subject-Token in the response header is the token value.

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 details about how to obtain enterprise project IDs and enterprise project features, 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.

kind

Yes

String

API type. Fixed value: ComponentConfiguration.

items

Yes

Array of ConfigurationItem objects

Configuration item list.

Table 4 ConfigurationItem

Parameter

Mandatory

Type

Description

type

Yes

String

Definition

Component configuration type.

Constraints

N/A

Value Range

  • rds

  • cse

  • env: environment variable

  • access: access mode

  • scaling: scaling policy

  • volume: cloud storage configuration

  • healthCheck

  • lifecycle: lifecycle management

  • apm2: performance management

  • log: log collection

  • customMetric: custom monitoring metric

Default Value

N/A

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 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

EnvConfigurationDataAnnotations 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.

switch

No

String

AS policy configuration switch.

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

scale_strategy

No

String

Definition

AS policy type.

Constraints

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

Range

  • metric: metric policy

  • time: time policy

  • mix: mixed policy

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 local disk log path array.

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

cloud_storage_log_paths

No

Array of CloudStorageLogPathInfo objects

Custom cloud storage log path array.

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

multiline

No

multiline object

Multi-line log mode.

instrumentation

No

String

Definition

Agent injection mode.

Constraints

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

Range

  • automatic: auto probe injection

path

No

String

Collection path for custom metric monitoring.

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

port

No

Integer

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 envs

Parameter

Mandatory

Type

Description

{User defined key}

No

Map<String,String>

Environment variable.

Common environment variables:

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

  • LANG: language.

Table 8 AccessConfigurationDataItems

Parameter

Mandatory

Type

Description

operator

No

String

Configuration mode.

  • If the value of operator is empty, the full overwrite mode is used. Otherwise, the addition, deletion, and modification mode is used.

  • When the addition, deletion, and modification mode is used, the value of operator can be add, copy, modify, or delete, indicating to add, copy an element with a specified UID and add, modify, or delete an element, respectively.

  • When operator is set to copy, modify, or delete, the uid must not be empty and must exist in the configuration that takes effect last time.

  • When operator is set to copy or modify, if all fields except uid in the fields of the same level as operator are not set or left empty, or the list is empty, the value of the same field of the element specified by uid in the last effective configuration is retained. In addition, the operator values of all elements in the list, parent list, and child list must be empty or not empty.

uid

No

String

UID of the access mode.

metadata

No

AccessConfigurationMetadata object

Access mode configuration metadata.

type

No

String

Access mode type.

sub_type

No

String

Access mode subtype.

ingress_config_id

No

String

ID of the associated domain name suffix. Use commas (,) to separate multiple domain name suffixes.

domain_names

No

Array of strings

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.

elb_id

No

String

Selected ELB ID.

public_ip

No

String

Response body parameter, which indicates the public IP address of the selected ELB.

private_ip

No

String

Response body parameter, which indicates the private IP address of the selected ELB.

Table 9 AccessConfigurationMetadata

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. The configuration is as follows:

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

  • "kubernetes.io/elb.lb-algorithm": "ROUND_ROBIN"

Table 10 AccessControl

Parameter

Mandatory

Type

Description

black

No

Array of strings

Blacklist array.

  • Each line must contain an IP address or a CIDR block and end with a line break.

  • You can add a maximum of 300 IP addresses or CIDR blocks to each IP address group.

white

No

Array of strings

Whitelist array.

  • Each line must contain an IP address or a CIDR block and end with a line break.

  • You can add a maximum of 300 IP addresses or CIDR blocks to each IP address group.

Table 11 AccessConfigurationPort

Parameter

Mandatory

Type

Description

operator

No

String

Configuration mode.

  • If the value of operator is empty, the full overwrite mode is used. Otherwise, the addition, deletion, and modification mode is used.

  • When the addition, deletion, and modification mode is used, the value of operator can be add, copy, modify, or delete, indicating to add, copy an element with a specified UID and add, modify, or delete an element, respectively.

  • When operator is set to copy, modify, or delete, the uid must not be empty and must exist in the configuration that takes effect last time.

  • When operator is set to copy or modify, if all fields except uid in the fields of the same level as operator are not set or left empty, or the list is empty, the value of the same field of the element specified by uid in the last effective configuration is retained. In addition, the operator values of all elements in the list, parent list, and child list must be empty or not empty.

uid

No

String

UID of the port.

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.

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.

paths

No

Array of AccessConfigurationHttpPath objects

Path and domain name for matching.

elb_id

No

String

Selected ELB ID.

Table 12 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.

Table 13 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 14 ScaleConfigurationDataTrigger

Parameter

Mandatory

Type

Description

type

No

String

Definition

Metric type.

Range

  • cpu

  • memory

  • cron: scheduled metric

  • prometheus

metadata

No

ScalingTriggerMeta object

Metadata.

Table 15 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.

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 16 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 17 VolumeConfigurationDataVolume

Parameter

Mandatory

Type

Description

volume_id

No

String

Cloud storage ID.

resource_name

No

String

Cloud storage name.

resource_type

No

String

Definition

Resource type.

Range

  • obs: for object_bucket and parallel_file_system.

  • sfs: for sfs3.0 and sfs_turbo.

resource_sub_type

No

String

Definition

Resource sub-type.

Range

  • object_bucket

  • parallel_file_system

  • sfs3.0

  • sfs_turbo

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 18 VolumeConfigurationMountInfo

Parameter

Mandatory

Type

Description

path

No

String

Container mount path.

sub_path

No

String

Subpath.

access_mode

No

String

Read or write permission.

Table 19 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 20 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 21 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 22 HealthCheckConfigurationHttpGet

Parameter

Mandatory

Type

Description

path

No

String

URL.

port

No

Integer

Port.

scheme

No

String

Protocol.

Table 23 HealthCheckConfigurationTcpSocket

Parameter

Mandatory

Type

Description

port

No

Integer

Port.

Table 24 HealthCheckConfigurationExec

Parameter

Mandatory

Type

Description

command

No

Array of strings

Shell statement.

Table 25 postStart

Parameter

Mandatory

Type

Description

exec

No

LifeCycleConfigurationExec object

Command.

Table 26 preStop

Parameter

Mandatory

Type

Description

exec

No

LifeCycleConfigurationExec object

Command.

Table 27 LifeCycleConfigurationExec

Parameter

Mandatory

Type

Description

command

No

Array of strings

Shell statement.

Table 28 CloudStorageLogPathInfo

Parameter

Mandatory

Type

Description

dir_path

No

String

Container mount path.

file_name_pattern

No

String

Log file name matching mode.

Table 29 multiline

Parameter

Mandatory

Type

Description

mode

No

String

Definition

Multi-line log mode.

Range

  • time: log time

  • regular: regular expression mode

value

No

String

If mode is set to time, the value is in the format of yyyy-MM-dd hh:mm:sspm.SSS ZZZZ. If mode is set to regular, the value is a regular expression.

Table 30 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. The configuration is as follows:

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

  • "kubernetes.io/elb.lb-algorithm": "ROUND_ROBIN"

Response Parameters

Status code: 200

OK

None

Example Requests

  • 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" : "env-test",
              "value_from" : {
                "name" : "env-test",
                "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, OBS parallel file system, or SFS 3.0 capacity-oriented 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" ]
          }
        }
      } ]
    }
  • Add the component configuration of the external network access mode of the forwarding policy type in addition, deletion, and modification mode. In the following example, the forwarding policy configuration whose UID is 1-1 in the access mode whose UID is 1 in the last effective configuration is configured, the listening port is changed to 8080, the URL is changed to /test3, the domain name is test.example.com, the URL matching rule is regular expression matching, and the remaining fields remain unchanged.

    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" : [ {
              "operator" : "modify",
              "uid" : 1,
              "ports" : [ {
                "operator" : "copy",
                "uid" : "1-1",
                "target_port" : 8080,
                "paths" : [ {
                  "path" : "/test3",
                  "url_match_mode" : "REGEX",
                  "hostname" : "test.example.com"
                } ]
              } ]
            } ]
          }
        }
      } ]
    }
  • Delete the component configuration of the external network access mode of the forwarding policy type in addition, deletion, and modification mode. In the following example, the forwarding policy configuration whose UID is 1-2 in the access mode whose UID is 1 in the last effective configuration is deleted.

    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" : [ {
              "operator" : "modify",
              "uid" : 1,
              "ports" : [ {
                "operator" : "delete",
                "uid" : "1-2"
              } ]
            } ]
          }
        }
      } ]
    }
  • Modify the component configuration of the external network access mode of the forwarding policy type in addition, deletion, and modification mode. In the following example, the forwarding policy whose UID is 1-2 in the access mode whose UID is 1 in the last effective configuration is configured, and only the listening port is changed to 8081.

    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" : [ {
              "operator" : "modify",
              "uid" : 1,
              "ports" : [ {
                "operator" : "modify",
                "uid" : "1-2",
                "target_port" : 8081
              } ]
            } ]
          }
        }
      } ]
    }
  • Mixed policy configuration. The maximum number of instances is 3, and the minimum number is 1.

    POST https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id}/configurations
    
    {
      "api_version" : "v1",
      "kind" : "ComponentConfiguration",
      "items" : [ {
        "data" : {
          "spec" : {
            "scale_strategy" : "mix",
            "max_replica_count" : 3,
            "min_replica_count" : 1,
            "triggers" : [ {
              "metadata" : {
                "period_type" : "day",
                "schedulers" : [ {
                  "cron" : "00 00 * * *",
                  "target_replica" : 1
                }, {
                  "cron" : "00 09 * * *",
                  "target_replica" : 2
                } ]
              },
              "type" : "cron"
            }, {
              "metadata" : {
                "type" : "Utilization",
                "value" : "80"
              },
              "type" : "cpu"
            }, {
              "metadata" : {
                "type" : "Utilization",
                "value" : "80"
              },
              "type" : "memory"
            } ],
            "switch" : "on"
          }
        },
        "type" : "scaling"
      } ]
    }

Scaling metric: The CPU usage and memory usage are both set to 80%.

Scaling time: The number of instances remains 1 after 00:00 and 2 after 09:00 every day.

Example Responses

None

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.