Reviewed-by: Gergo-Bence Lorincz <a200452876@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: qiujiandong1 <qiujiandong1@huawei.com> Co-committed-by: qiujiandong1 <qiujiandong1@huawei.com>
28 KiB
Creating a Federation Connection and Downloading kubeconfig
Function
This API is used to create a VPC endpoint for connecting to the federation API server and downloading kubeconfig of the federation API server after federation is enabled for a fleet.
URI
POST /v1/clustergroups/{clustergroupid}/cert
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
clustergroupid |
Yes |
String |
Fleet ID |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
X-Auth-Token |
Yes |
String |
Identity authentication information. 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. |
Content-Type |
Yes |
String |
Message body type (format). Only application/json is supported. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
projectID |
Yes |
String |
Project ID |
vpcID |
Yes |
String |
VPC ID, which must belong to the project specified by projectID. |
subnetID |
Yes |
String |
Subnet ID, which must belong to the VPC specified by vpcID. |
duration |
Yes |
Integer |
Validity period of the certificate in kubeconfig, in days. Minimum value: 1 Maximum value: 1825 |
Response Parameters
Status code: 201
Parameter |
Type |
Description |
|---|---|---|
kind |
String |
API type. The value is fixed at Config and cannot be changed. |
apiVersion |
String |
API version. The value is fixed at v1 and cannot be changed. |
clusters |
Array of NamedCluster objects |
Cluster list |
users |
Array of NamedAuthInfo objects |
Certificate information and client key information of specified users |
contexts |
Array of NamedContext objects |
Context list |
current-context |
String |
Current context |
Parameter |
Type |
Description |
|---|---|---|
name |
String |
Cluster name |
cluster |
ClusterCert object |
Cluster information |
Parameter |
Type |
Description |
|---|---|---|
server |
String |
Server address |
certificate-authority-data |
String |
Certificate authorization data |
insecure-skip-tls-verify |
String |
Whether to skip server certificate verification |
Parameter |
Type |
Description |
|---|---|---|
name |
String |
Username |
user |
AuthInfo object |
Certificate information and client key information of a specified user |
Parameter |
Type |
Description |
|---|---|---|
client-certificate-data |
String |
Client certificate |
client-key-data |
String |
PEM encoding data from the TLS client key file |
token |
String |
Authentication token |
Parameter |
Type |
Description |
|---|---|---|
name |
String |
Context name |
context |
Context object |
Context information |
Example Requests
Creating a federation connection and downloading kubeconfig
{
"projectID" : "08d44be1ef00d22e2f6fc0061f54a2f1",
"vpcID" : "11c9fe72-5a90-4295-bcfe-774726fb9066",
"subnetID" : "0de91d89-1e06-4e24-b371-35d5d3d3779b",
"duration" : 30
}
Example Responses
Status code: 201
kubeconfig file
{
"kind" : "Config",
"apiVersion" : "v1",
"clusters" : [ {
"name" : "cluster-demo",
"cluster" : {
"server" : "https://ip:port",
"certificate-authority-data" : ""
}
} ],
"users" : [ {
"name" : "user",
"user" : {
"client-certificate-data" : "",
"client-key-data" : "",
"token" : ""
}
} ],
"contexts" : [ {
"name" : "demo",
"context" : {
"cluster" : "cluster-demo",
"user" : "user"
}
} ],
"current-context" : "demo"
}
Status Codes
Status Code |
Description |
|---|---|
201 |
kubeconfig file |
Error Codes
See Error Codes.