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
|
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
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token.
|
|
X-Enterprise-Project-ID |
No |
String |
Enterprise project ID.
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.
|
|
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. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
type |
Yes |
String |
Definition Component configuration type. Constraints N/A Value Range
Default Value N/A |
|
data |
Yes |
ConfigurationData object |
Component configuration data. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
spec |
No |
ConfigurationRequestDataSpec object |
Component configuration data specifications. |
|
metadata |
No |
ConfigurationDataMetadata object |
Component configuration metadata. |
|
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 |
Environment variable. This parameter is mandatory when type under ConfigurationItem is set to env. Common environment variables:
|
|
|
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
|
|
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 |
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 |
Liveness probe configuration for health check. This parameter is mandatory when type under ConfigurationItem is set to healthCheck. |
|
|
startupProbe |
No |
Startup probe configuration for health check. This parameter is mandatory when type under ConfigurationItem is set to healthCheck. |
|
|
readinessProbe |
No |
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
|
|
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. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
{User defined key} |
No |
Map<String,String> |
Environment variable. Common environment variables:
|
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
operator |
No |
String |
Configuration mode.
|
|
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. |
|
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:
|
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
black |
No |
Array of strings |
Blacklist array.
|
|
white |
No |
Array of strings |
Whitelist array.
|
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
operator |
No |
String |
Configuration mode.
|
|
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. |
|
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. |
|
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. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
type |
No |
String |
Definition Metric type. Range
|
|
metadata |
No |
ScalingTriggerMeta object |
Metadata. |
|
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. |
|
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. |
|
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
|
|
resource_sub_type |
No |
String |
Definition Resource sub-type. Range
|
|
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. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
path |
No |
String |
Container mount path. |
|
sub_path |
No |
String |
Subpath. |
|
access_mode |
No |
String |
Read or write permission. |
|
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 |
HTTP request check information in the health check configuration. |
|
|
tcpSocket |
No |
TCP port check information in the health check configuration. |
|
|
exec |
No |
HealthCheckConfigurationExec object |
Command check information in the health check configuration. |
|
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 |
HTTP request check information in the health check configuration. |
|
|
tcpSocket |
No |
TCP port check information in the health check configuration. |
|
|
exec |
No |
HealthCheckConfigurationExec object |
Command check information in the health check configuration. |
|
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 |
HTTP request check information in the health check configuration. |
|
|
tcpSocket |
No |
TCP port check information in the health check configuration. |
|
|
exec |
No |
HealthCheckConfigurationExec object |
Command check information in the health check configuration. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
path |
No |
String |
URL. |
|
port |
No |
Integer |
Port. |
|
scheme |
No |
String |
Protocol. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
port |
No |
Integer |
Port. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
command |
No |
Array of strings |
Shell statement. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
exec |
No |
LifeCycleConfigurationExec object |
Command. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
exec |
No |
LifeCycleConfigurationExec object |
Command. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
command |
No |
Array of strings |
Shell statement. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
dir_path |
No |
String |
Container mount path. |
|
file_name_pattern |
No |
String |
Log file name matching mode. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
mode |
No |
String |
Definition Multi-line log mode. Range
|
|
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. |
|
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:
|
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot