A trigger is an API provided by Container Service for simple and fast redeployment and resource scaling.
The strict authentication is needed because standard APIs must guarantee the security. However, in scenarios where an API is integrated with a third-party system (for example, Jenkins or other continuous integration CI/CD system), the required permissions are limited, for example, messaging only. Therefore, to guarantee the security and convenience, APIs that have partial authentication policies and can be flexibly called are widely applied in scenarios requiring continuous integration and delivery.
Currently, Container Service provides redeployment trigger and resource scaling trigger.
You can integrate your APIs with your monitoring system and redeploy your applications when the system has exceptions. You can also integrate your APIs with container Hub, and then the application can be automatically redeployed by using the latest image after the new image is constructed.
Resource scaling trigger
You can call the resource scaling trigger to realize container scaling.
Log on to the Container Service console.
Click Applications in the left-side navigation pane.
Select the cluster in which the application resides from the Cluster list.
Click the application name.
Click Create Trigger in the upper right corner.
The Create Trigger dialog box appears. Select Redeploy or Resource Scaling from the Action list and then click Confirm.
If you have Write permission to the image used by the application, you can select the Associated with Image Update check box. Then, the application can be automatically redeployed by using the latest image after the new image is constructed.
Select the service that needs to set the resource scaling trigger from the Service list.
Note: To use the resource scaling trigger, upgrade the cluster Agent to the latest version.
The generated trigger address is the API address.
You can call the trigger by using a third-party integration system or a GET or POST request. For example, you can run the CURL command to call the trigger.
Call the redeployment trigger:
Call the resource scaling trigger:
Note: When calling the resource scaling trigger, manually add the following parameters to the trigger URL.
|Parameter name||Required?||Meaning||Optional value|
|type||Yes||The scaling type.||Contract: scale_in. Expand: scale_out.|
|step||Yes||The scaling number.||Positive integer: 1-100.|
For example, calling the following trigger will add five containers to the service.