Importing a CCE Workload¶
By importing Cloud Container Engine (CCE) workloads, you can open your CCE service capabilities through APIs.
Note
If your gateway does not support CCE workload import, contact customer service.
Precautions¶
Only CCE Turbo clusters and CCE clusters using the VPC network model are supported.
The CCE cluster and your gateway must be in the same VPC or otherwise connected.
If you select a CCE cluster that uses a VPC network model, add the container CIDR block of the cluster to Routes on the gateway details page.
After the import, APIs will be generated, together with a microservice load balance channel that monitors and updates address changes of all pods in the workload.
Prerequisites¶
You have created CCE workloads
Procedure¶
Go to the APIG console.
Select a gateway at the top of the navigation pane.
In the navigation pane, choose API Management > API Groups.
Choose Create API Group > Import CCE Workload. Set the parameters according to the following table.
¶ Parameter
Description
Group
Group to which the CCE workload belongs. You can create a group or select an existing group.
Cluster
Select a cluster. Click View CCE Console to view the available clusters.
Namespace
Namespace to which the workload will belong. A namespace is an abstract collection of resources and objects.
Workload Type
Deployment: Deployments do not store any data or status while they are running.
StatefulSet: StatefulSets store data and statuses while they are running.
DaemonSet: DaemonSets ensure that only one pod runs on all or some nodes. When a node is added to a cluster, a new pod is also added for the node. When a node is removed from a cluster, the pod is also reclaimed. If a DaemonSet is deleted, all pods created by it will be deleted.
For details about workload types, see Overview.
Service Label Key
Pod label of a workload. The service label name is the pod label key and the service label value is the pod label value.
For details about pod labels, see Labels and Annotations.
Service Label Value
Tag
Pod label of a workload. If a workload cannot be identified by certain service label name and value, select another pod label to specify the workload.
Protocol
HTTP and HTTPS are supported. HTTPS is recommended for transmitting important or sensitive data.
Request Path
You can use a plus sign (+) for prefix matching. For example, /a/{b+}.
Port
Listening port of the CCE workload.
Authentication Mode
App and IAM authentication is supported. You can also choose not to authenticate requests.
App: Requests will be authenticated by APIG. This authentication mode is recommended.
IAM: Requests will be authenticated by IAM.
None: No authentication will be required.
CORS
Determine whether to enable cross-origin resource sharing (CORS).
CORS allows browsers to send XMLHttpRequest to servers in other domains, overcoming the limitation that Asynchronous JavaScript and XML (AJAX) can be used only within the same domain.
There are two types of CORS requests:
Simple requests: requests that have the Origin field in the header.
Not-so-simple requests: HTTP requests sent before the actual request.
If CORS (not-so-simple request) is enabled for an API, another API that uses the OPTIONS method must be created. For details, see Enabling CORS.
Timeout (ms)
Backend request timeout.
If a backend timeout error occurs during API debugging, increase the timeout to locate the reason.
Note
Modify the maximum timeout by referring to Configuring Parameters. The value range is 1 ms to 600,000 ms.
Click OK.