proposalbot b96cce29e3 Changes to cce_api-ref from docs/doc-exports#954 (CCE API 20231108 version
1.Th

Reviewed-by: Eotvos, Oliver <oliver.eotvos@t-systems.com>
Co-authored-by: proposalbot <proposalbot@otc-service.com>
Co-committed-by: proposalbot <proposalbot@otc-service.com>
2023-11-09 12:52:48 +00:00

87 KiB

original_name

AddNode.html

Accepting a Node

Function

This API is used to accept a node into a specified cluster.

Note

The URL for cluster management is in the format of https://Endpoint/uri. In the URL, uri indicates the resource path, that is, the path for API access.

URI

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes/add

Table 1 Path Parameters
Parameter Mandatory Type Description
project_id Yes String Project ID. For details about how to obtain the value, see How to Obtain Parameters in the API URI <cce_02_0271>.
cluster_id Yes String Cluster ID. For details about how to obtain the value, see How to Obtain Parameters in the API URI <cce_02_0271>.

Request Parameters

Table 2 Request header parameters
Parameter Mandatory Type Description
Content-Type Yes String Message body type (format).
X-Auth-Token Yes String Requests for calling an API can be authenticated using either a token or AK/SK. If token-based authentication is used, this parameter is mandatory and must be set to a user token. For details, see API Usage Guidelines <cce_02_0344>.
Table 3 Request body parameters
Parameter Mandatory Type Description
apiVersion Yes String API version. The value is fixed at v3.
kind Yes String API type. The value is fixed at List.
nodeList Yes Array of AddNode <addnode__en-us_topic_0000001417516392_request_addnode> objects

List of the nodes to be accepted.

Note

Nodes must have 2-core or higher CPU, 4 GB or larger memory.

Table 4 AddNode
Parameter Mandatory Type Description
serverID Yes String Server ID. For details about how to obtain the server ID, see the ECS or BMS documentation.
spec Yes ReinstallNodeSpec <addnode__en-us_topic_0000001417516392_request_reinstallnodespec> object Node reinstallation configuration parameters. Currently, accepted nodes cannot be added into node pools.
Table 5 ReinstallNodeSpec
Parameter Mandatory Type Description
os Yes String Operating system. If you specify a custom image, the actual OS version in the IMS image is used. Select an OS version supported by the current cluster, for example, EulerOS 2.5, CentOS 7.7, or EulerOS 2.9.
login Yes Login <addnode__en-us_topic_0000001417516392_request_login> object Node login mode.
name No String

Node name.

Note

Specifying this field during reinstallation will change the node name, and the server name will change accordingly. By default, the current server name is used as the node name. Enter 1 to 56 characters starting with a letter and not ending with a hyphen (-). Only lowercase letters, digits, and hyphens (-) are allowed.

serverConfig No ReinstallServerConfig <addnode__en-us_topic_0000001417516392_request_reinstallserverconfig> object Server configuration.
volumeConfig No ReinstallVolumeConfig <addnode__en-us_topic_0000001417516392_request_reinstallvolumeconfig> object Volume management configuration.
runtimeConfig No ReinstallRuntimeConfig <addnode__en-us_topic_0000001417516392_request_reinstallruntimeconfig> object Container runtime configuration.
k8sOptions No ReinstallK8sOptionsConfig <addnode__en-us_topic_0000001417516392_request_reinstallk8soptionsconfig> object Kubernetes node configuration.
lifecycle No NodeLifecycleConfig <addnode__en-us_topic_0000001417516392_request_nodelifecycleconfig> object Customized lifecycle configuration of a node.
initializedConditions No Array of strings

Custom initialization flag.

Before CCE nodes are initialized, they are tainted with node.cloudprovider.kubernetes.io/uninitialized to prevent pods from being scheduled to them.

CCE supports custom initialization flags. After receiving the initializedConditions parameter, CCE converts the parameter value into a node label and provisions the label with the node, for example, cloudprovider.openvessel.io/inject-initialized-conditions=CCEInitial_CustomedInitial.

After the node is labeled, its status.Conditions is polled to check whether the type of conditions has a flag name, such as CCEInitial and CustomedInitial. If all input flags exist and their status is True, the node initialization is complete and the initialization taint is removed.

  • Use only letters and digits. Max. characters: 20.
  • Max. flags: 2.
extendParam No ReinstallExtendParam <addnode__en-us_topic_0000001417516392_request_reinstallextendparam> object Extended reinstallation parameter, which is discarded.
Table 6 Login
Parameter Mandatory Type Description
sshKey No String Name of the key pair used for login.
userPassword No String

Password used for node login.

Note

This field is not supported for the current version.

Table 7 ReinstallServerConfig
Parameter Mandatory Type Description
userTags No Array of UserTag <addnode__en-us_topic_0000001417516392_request_usertag> objects Cloud server labels. The key of a label must be unique. The maximum number of user-defined labels supported by CCE depends on the region. In the region that supports the least number of labels, you can still create up to 5 labels for a cloud server.
rootVolume No ReinstallVolumeSpec <addnode__en-us_topic_0000001417516392_request_reinstallvolumespec> object System disk configurations used in reinstallation.
Table 8 UserTag
Parameter Mandatory Type Description
key No String Key of the cloud server label. The value cannot start with CCE- or __type_baremetal.
value No String Value of the cloud server label.
Table 9 ReinstallVolumeSpec
Parameter Mandatory Type Description
imageID No String Custom image ID.
cmkID No String User master key ID. If this parameter is left blank by default, the EVS disk is not encrypted.
Table 10 ReinstallVolumeConfig
Parameter Mandatory Type Description
lvmConfig No String

Docker data disk configurations.

The following is an example default configuration:

"lvmConfig":"dockerThinpool=vgpaas/90%VG;kubernetesLV=vgpaas/10%VG;diskType=evs;lvType=linear"

The following fields are included:

  • userLV: size of the user space, for example, vgpaas/20%VG.
  • userPath: mount path of the user space, for example, /home/wqt-test.
  • diskType: disk type. Currently, only evs, hdd, and ssd are supported.
  • lvType: type of a logic volume. The value can be linear or striped.
  • dockerThinpool: Docker space size, for example, vgpaas/60%VG.
  • kubernetesLV: kubelet space size, for example, vgpaas/20%VG.
storage No Storage <addnode__en-us_topic_0000001417516392_request_storage> object

Disk initialization management parameter.

This parameter is complex to configure. For details, see Attaching Disks to a Node <node_storage_example>.

If this parameter retains its default, disks are managed based on the DockerLVMConfigOverride (discarded) parameter in extendParam. This parameter is supported by clusters of version 1.15.11 and later.

Note

If a node specification involves local disks and EVS disks at the same time, do not retain the default value of this parameter to prevent unexpected disk partitions.

Table 11 Storage
Parameter Mandatory Type Description
storageSelectors Yes Array of StorageSelectors <addnode__en-us_topic_0000001417516392_request_storageselectors> objects Disk selection. Matched disks are managed according to matchLabels and storageType.
storageGroups Yes Array of StorageGroups <addnode__en-us_topic_0000001417516392_request_storagegroups> objects A storage group consists of multiple storage devices. It is used to divide storage space.
Table 12 StorageSelectors
Parameter Mandatory Type Description
name Yes String Selector name, used as the index of selectorNames in storageGroup. Therefore, the name of each selector must be unique.
storageType Yes String Specifies the storage type. Currently, only evs (EVS volumes) and local (local volumes) are supported. The local storage does not support disk selection. All local disks will form a VG. Therefore, only one storageSelector of the local type is allowed.
matchLabels No matchLabels <addnode__en-us_topic_0000001417516392_request_matchlabels> object Matching field of an EVS volume. The size, volumeType, metadataEncrypted, metadataCmkid and count fields are supported.
Table 13 matchLabels
Parameter Mandatory Type Description
size No String Matched disk size. If this parameter is left unspecified, the disk size is not limited. Example: 100
volumeType No String EVS disk type.
metadataEncrypted No String Disk encryption identifier. 0 indicates that the disk is not encrypted, and 1 indicates that the disk is encrypted.
metadataCmkid No String Customer master key ID of an encrypted disk. The value is a 36-byte string.
count No String Number of disks to be selected. If this parameter is left blank, all disks of this type are selected.
Table 14 StorageGroups
Parameter Mandatory Type Description
name Yes String Name of a virtual storage group, which must be unique.
cceManaged No Boolean Storage space for Kubernetes and runtime components. Only one group can be set to true. If this parameter is left blank, the default value false is used.
selectorNames Yes Array of strings This parameter corresponds to name in storageSelectors. A group can match multiple selectors, but a selector can match only one group.
virtualSpaces Yes Array of VirtualSpace <addnode__en-us_topic_0000001417516392_request_virtualspace> objects Detailed management of space configuration in a group.
Table 15 VirtualSpace
Parameter Mandatory Type Description
name Yes String

Name of a virtualSpace.

  • Kubernetes: Kubernetes space configuration. lvmConfig needs to be configured.
  • runtime: runtime space configuration. runtimeConfig needs to be configured.
  • user: user space configuration. lvmConfig needs to be configured.
size Yes String

Size of a virtualSpace. The value must be an integer in percentage. Example: 90%.

Note

The sum of the percentages of all virtualSpaces in a group cannot exceed 100%.

lvmConfig No LVMConfig <addnode__en-us_topic_0000001417516392_request_lvmconfig> object LVM configurations, applicable to kubernetes and user spaces. Note that one virtual space supports only one config.
runtimeConfig No RuntimeConfig <addnode__en-us_topic_0000001417516392_request_runtimeconfig> object runtime configurations, applicable to the runtime space. Note that one virtual space supports only one config.
Table 16 LVMConfig
Parameter Mandatory Type Description
lvType Yes String LVM write mode. linear indicates the linear mode. striped indicates the striped mode, in which multiple disks are used to form a strip to improve disk performance.
path No String Path to which the disk is attached. This parameter takes effect only in user configuration. The value is an absolute path. Digits, letters, periods (.), hyphens (-), and underscores (_) are allowed.
Table 17 RuntimeConfig
Parameter Mandatory Type Description
lvType Yes String LVM write mode. linear indicates the linear mode. striped indicates the striped mode, in which multiple disks are used to form a strip to improve disk performance.
Table 18 ReinstallRuntimeConfig
Parameter Mandatory Type Description
dockerBaseSize No Integer

Available disk space of a single container on a node, in GB.

If this parameter is left blank or is set to 0, the default value is used. In Device Mapper mode, the default value is 10. In OverlayFS mode, the available space of a single container is not limited by default, and the dockerBaseSize setting takes effect only on EulerOS nodes in the cluster of the new version.

When Device Mapper is used, you are advised to set dockerBaseSize to a value less than or equal to 80 GB. If the value is too large, the container runtime may fail to be started due to long initialization. If there are special requirements for the container disk space, you can mount an external or local storage device.

runtime No Runtime <addnode__en-us_topic_0000001417516392_request_runtime> object Container runtime. Defaults to docker.
Table 19 Runtime
Parameter Mandatory Type Description
name No String

Container runtime. Defaults to docker.

Enumeration values:

  • docker
  • containerd
Table 20 ReinstallK8sOptionsConfig
Parameter Mandatory Type Description
labels No Map<String,String>

Defined in key-value pairs. A maximum of 20 key-value pairs are allowed.

  • Key: Enter 1 to 63 characters, starting with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. A DNS subdomain can be prefixed to a key and contain a maximum of 253 characters. Example DNS subdomain: example.com/my-key
  • Value: The value can be left blank or contain 1 to 63 characters that start with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed in the character string.

Example:

"k8sTags": {
  "key": "value"
}
taints No Array of Taint <addnode__en-us_topic_0000001417516392_request_taint> objects

Taints can be added for anti-affinity when creating nodes. A maximum of 20 taints can be added. Each taint contains the following parameters:

  • Key: A key must contain 1 to 63 characters starting with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. A DNS subdomain name can be used as the prefix of a key.
  • Value: A value must start with a letter or digit and can contain a maximum of 63 characters, including letters, digits, hyphens (-), underscores (_), and periods (.).
  • Effect: Available options are NoSchedule, PreferNoSchedule, and NoExecute.

Example:

"taints": [{
  "key": "status",
  "value": "unavailable",
  "effect": "NoSchedule"
}, {
  "key": "looks",
  "value": "bad",
  "effect": "NoSchedule"
}]
maxPods No Integer Maximum number of pods that can be created on a node, including the default system pods. Value range: 16 to 256. This limit prevents the node from being overloaded of pods.
Table 21 Taint
Parameter Mandatory Type Description
key Yes String Key.
value No String Value.
effect Yes String Effect.
Table 22 NodeLifecycleConfig
Parameter Mandatory Type Description
preInstall No String

Pre-installation script.

Note

The input value must be Base64-encoded. (Command: echo -n "Content to be encoded" | base64)

postInstall No String

Post-installation script.

Note

The input value must be Base64-encoded. (Command: echo -n "Content to be encoded" | base64)

Table 23 ReinstallExtendParam
Parameter Mandatory Type Description
alpha.cce/NodeImageID No String (Discarded) ID of the user image to run the target OS. Specifying this parameter is equivalent to specifying imageID in ReinstallVolumeSpec. The original value will be overwritten.

Response Parameters

Status code: 200

Table 24 Response body parameters
Parameter Type Description
jobid String Job ID returned after the job is delivered. The job ID can be used to query the job execution status.

Example Requests

Accepting a Node

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes/add

{
  "kind" : "List",
  "apiVersion" : "v3",
  "nodeList" : [ {
    "serverID" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "spec" : {
      "name" : "my-ecs-0001",
      "os" : "EulerOS 2.5",
      "login" : {
        "sshKey" : "KeyPair-001"
      }
    }
  } ]
}

Example Responses

Status code: 200

The job for accepting a node into a specified cluster is successfully delivered.

{
  "jobid" : "2ec9b78d-9368-46f3-8f29-d1a95622a568"
}

Status Codes

Status Code Description
200 The job for accepting a node into a specified cluster is successfully delivered.

Error Codes

See Error Codes <cce_02_0250>.