diff --git a/src/api/rest/docs/docs.go b/src/api/rest/docs/docs.go index bc602e3c5..6a64b112c 100644 --- a/src/api/rest/docs/docs.go +++ b/src/api/rest/docs/docs.go @@ -1905,7 +1905,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "Field value for filtering (ex: ns01-alibaba-ap-northeast-1-vpc)", + "description": "Field value for filtering (ex: ns01-alibaba-ap-northeast-2-vpc)", "name": "filterVal", "in": "query" } @@ -1947,7 +1947,7 @@ const docTemplate = `{ } }, "post": { - "description": "Create K8sCluster", + "description": "Create K8sCluster\u003cbr\u003eFind details from https://github.com/cloud-barista/cb-tumblebug/discussions/1614", "consumes": [ "application/json" ], @@ -2079,7 +2079,7 @@ const docTemplate = `{ }, { "type": "string", - "default": "c1", + "default": "k8scluster-01", "description": "K8sCluster ID", "name": "k8sClusterId", "in": "path", @@ -2131,6 +2131,7 @@ const docTemplate = `{ }, { "type": "string", + "default": "k8scluster-01", "description": "K8sCluster ID", "name": "k8sClusterId", "in": "path", @@ -2178,6 +2179,7 @@ const docTemplate = `{ }, { "type": "string", + "default": "k8scluster-01", "description": "K8sCluster ID", "name": "k8sClusterId", "in": "path", @@ -2240,6 +2242,7 @@ const docTemplate = `{ }, { "type": "string", + "default": "k8scluster-01", "description": "K8sCluster ID", "name": "k8sClusterId", "in": "path", @@ -2247,6 +2250,7 @@ const docTemplate = `{ }, { "type": "string", + "default": "ng-01", "description": "K8sNodeGroup Name", "name": "k8sNodeGroupName", "in": "path", @@ -2294,6 +2298,7 @@ const docTemplate = `{ }, { "type": "string", + "default": "k8scluster-01", "description": "K8sCluster ID", "name": "k8sClusterId", "in": "path", @@ -2301,6 +2306,7 @@ const docTemplate = `{ }, { "type": "string", + "default": "ng-01", "description": "K8sNodeGroup Name", "name": "k8sNodeGroupName", "in": "path", @@ -2363,6 +2369,7 @@ const docTemplate = `{ }, { "type": "string", + "default": "k8scluster-01", "description": "K8sCluster ID", "name": "k8sClusterId", "in": "path", @@ -2370,6 +2377,7 @@ const docTemplate = `{ }, { "type": "string", + "default": "ng-01", "description": "K8sNodeGroup Name", "name": "k8sNodeGroupName", "in": "path", @@ -2432,6 +2440,7 @@ const docTemplate = `{ }, { "type": "string", + "default": "k8scluster-01", "description": "K8sCluster ID", "name": "k8sClusterId", "in": "path", @@ -9236,10 +9245,12 @@ const docTemplate = `{ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "example": "1.30.1-aliyun.1" }, "name": { - "type": "string" + "type": "string", + "example": "1.30" } } }, @@ -11782,13 +11793,16 @@ const docTemplate = `{ "type": "object", "properties": { "desiredNodeSize": { - "type": "string" + "type": "string", + "example": "1" }, "maxNodeSize": { - "type": "string" + "type": "string", + "example": "3" }, "minNodeSize": { - "type": "string" + "type": "string", + "example": "1" } } }, @@ -11817,7 +11831,8 @@ const docTemplate = `{ "example": "http://1.2.3.4:6443" }, "kubeconfig": { - "type": "string" + "type": "string", + "example": "apiVersion: v1\nclusters:\n- cluster:\n certificate-authority-data: LS0..." } } }, @@ -11842,23 +11857,28 @@ const docTemplate = `{ "$ref": "#/definitions/mcis.TbK8sAddonsInfo" }, "connectionName": { - "type": "string" + "type": "string", + "example": "alibaba-ap-northeast-2" }, "createdTime": { "type": "string", "example": "1970-01-01T00:00:00.00Z" }, "cspK8sClusterId": { - "type": "string" + "type": "string", + "example": "c123456789012345678901234567890" }, "cspK8sClusterName": { - "type": "string" + "type": "string", + "example": "ns01-k8scluster-01" }, "description": { - "type": "string" + "type": "string", + "example": "My K8sCluster" }, "id": { - "type": "string" + "type": "string", + "example": "k8scluster-01" }, "k8sNodeGroupList": { "type": "array", @@ -11873,7 +11893,8 @@ const docTemplate = `{ } }, "name": { - "type": "string" + "type": "string", + "example": "k8scluster-01" }, "network": { "$ref": "#/definitions/mcis.TbK8sClusterNetworkInfo" @@ -11900,7 +11921,7 @@ const docTemplate = `{ "version": { "description": "Kubernetes Version, ex) 1.23.3", "type": "string", - "example": "1.23.3" + "example": "1.30.1-aliyun.1" } } }, @@ -11917,16 +11938,23 @@ const docTemplate = `{ "type": "array", "items": { "type": "string" - } + }, + "example": [ + "sg-01" + ] }, "subnetIds": { "type": "array", "items": { "type": "string" - } + }, + "example": [ + "subnet-01" + ] }, "vNetId": { - "type": "string" + "type": "string", + "example": "vpc-01" } } }, @@ -11943,19 +11971,21 @@ const docTemplate = `{ "connectionName": { "description": "Namespace string ` + "`" + `json:\"namespace\" validate:\"required\" example:\"ns01\"` + "`" + `", "type": "string", - "example": "testcloud01-seoul" + "example": "alibaba-ap-northeast-2" }, "cspK8sClusterId": { - "description": "Fields for \"Register existing K8sCluster\" feature\nCspK8sClusterId is required to register a k8s cluster from CSP (option=register)", - "type": "string" + "description": "Fields for \"Register existing K8sCluster\" feature\n@description CspK8sClusterId is required to register a k8s cluster from CSP (option=register)", + "type": "string", + "example": "required when option is register" }, "description": { - "type": "string" + "type": "string", + "example": "My K8sCluster" }, "id": { "description": "(1) K8sCluster Info", "type": "string", - "example": "testcloud01-seoul-k8scluster" + "example": "k8scluster-01" }, "k8sNodeGroupList": { "description": "(3) NodeGroupInfo List", @@ -11968,21 +11998,28 @@ const docTemplate = `{ "type": "array", "items": { "type": "string" - } + }, + "example": [ + "sg-01" + ] }, "subnetIds": { "type": "array", "items": { "type": "string" - } + }, + "example": [ + "subnet-01" + ] }, "vNetId": { "description": "(2) Network Info", - "type": "string" + "type": "string", + "example": "vpc-01" }, "version": { "type": "string", - "example": "1.23.4" + "example": "1.30.1-aliyun.1" } } }, @@ -12007,21 +12044,27 @@ const docTemplate = `{ "type": "object", "properties": { "desiredNodeSize": { - "type": "integer" + "type": "integer", + "example": 1 }, "id": { - "type": "string" + "type": "string", + "example": "ng-01" }, "imageId": { "description": "VM config.", - "type": "string" + "type": "string", + "example": "image-01" }, "k8sNodes": { "description": "id for nodes", "type": "array", "items": { "type": "string" - } + }, + "example": [ + "node-01" + ] }, "keyValueList": { "type": "array", @@ -12030,26 +12073,33 @@ const docTemplate = `{ } }, "maxNodeSize": { - "type": "integer" + "type": "integer", + "example": 3 }, "minNodeSize": { - "type": "integer" + "type": "integer", + "example": 1 }, "onAutoScaling": { "description": "Scaling config.", - "type": "boolean" + "type": "boolean", + "example": true }, "rootDiskSize": { - "type": "string" + "type": "string", + "example": "40" }, "rootDiskType": { - "type": "string" + "type": "string", + "example": "cloud_essd" }, "specId": { - "type": "string" + "type": "string", + "example": "spec-01" }, "sshKeyId": { - "type": "string" + "type": "string", + "example": "sshkey-01" }, "status": { "description": "---", @@ -12066,39 +12116,47 @@ const docTemplate = `{ "type": "object", "properties": { "desiredNodeSize": { - "type": "string" + "type": "string", + "example": "1" }, "imageId": { - "type": "string" + "type": "string", + "example": "image-01" }, "maxNodeSize": { - "type": "string" + "type": "string", + "example": "3" }, "minNodeSize": { - "type": "string" + "type": "string", + "example": "1" }, "name": { - "type": "string" + "type": "string", + "example": "ng-01" }, "onAutoScaling": { "description": "autoscale config.", - "type": "string" + "type": "string", + "example": "true" }, "rootDiskSize": { "description": "\"default\", Integer (GB): [\"50\", ..., \"1000\"]", "type": "string", - "example": "default, 30, 42, ..." + "example": "40" }, "rootDiskType": { "description": "\"\", \"default\", \"TYPE1\", AWS: [\"standard\", \"gp2\", \"gp3\"], Azure: [\"PremiumSSD\", \"StandardSSD\", \"StandardHDD\"], GCP: [\"pd-standard\", \"pd-balanced\", \"pd-ssd\", \"pd-extreme\"], ALIBABA: [\"cloud_efficiency\", \"cloud\", \"cloud_ssd\"], TENCENT: [\"CLOUD_PREMIUM\", \"CLOUD_SSD\"]", "type": "string", - "example": "default, TYPE1, ..." + "example": "cloud_essd" }, "specId": { - "type": "string" + "type": "string", + "example": "spec-01" }, "sshKeyId": { - "type": "string" + "type": "string", + "example": "sshkey-01" } } }, @@ -12577,7 +12635,8 @@ const docTemplate = `{ "type": "object", "properties": { "onAutoScaling": { - "type": "string" + "type": "string", + "example": "true" } } }, @@ -12585,7 +12644,8 @@ const docTemplate = `{ "type": "object", "properties": { "version": { - "type": "string" + "type": "string", + "example": "1.30.1-alyun.1" } } }, diff --git a/src/api/rest/docs/swagger.json b/src/api/rest/docs/swagger.json index 68479e288..8ccda77a4 100644 --- a/src/api/rest/docs/swagger.json +++ b/src/api/rest/docs/swagger.json @@ -1898,7 +1898,7 @@ }, { "type": "string", - "description": "Field value for filtering (ex: ns01-alibaba-ap-northeast-1-vpc)", + "description": "Field value for filtering (ex: ns01-alibaba-ap-northeast-2-vpc)", "name": "filterVal", "in": "query" } @@ -1940,7 +1940,7 @@ } }, "post": { - "description": "Create K8sCluster", + "description": "Create K8sCluster\u003cbr\u003eFind details from https://github.com/cloud-barista/cb-tumblebug/discussions/1614", "consumes": [ "application/json" ], @@ -2072,7 +2072,7 @@ }, { "type": "string", - "default": "c1", + "default": "k8scluster-01", "description": "K8sCluster ID", "name": "k8sClusterId", "in": "path", @@ -2124,6 +2124,7 @@ }, { "type": "string", + "default": "k8scluster-01", "description": "K8sCluster ID", "name": "k8sClusterId", "in": "path", @@ -2171,6 +2172,7 @@ }, { "type": "string", + "default": "k8scluster-01", "description": "K8sCluster ID", "name": "k8sClusterId", "in": "path", @@ -2233,6 +2235,7 @@ }, { "type": "string", + "default": "k8scluster-01", "description": "K8sCluster ID", "name": "k8sClusterId", "in": "path", @@ -2240,6 +2243,7 @@ }, { "type": "string", + "default": "ng-01", "description": "K8sNodeGroup Name", "name": "k8sNodeGroupName", "in": "path", @@ -2287,6 +2291,7 @@ }, { "type": "string", + "default": "k8scluster-01", "description": "K8sCluster ID", "name": "k8sClusterId", "in": "path", @@ -2294,6 +2299,7 @@ }, { "type": "string", + "default": "ng-01", "description": "K8sNodeGroup Name", "name": "k8sNodeGroupName", "in": "path", @@ -2356,6 +2362,7 @@ }, { "type": "string", + "default": "k8scluster-01", "description": "K8sCluster ID", "name": "k8sClusterId", "in": "path", @@ -2363,6 +2370,7 @@ }, { "type": "string", + "default": "ng-01", "description": "K8sNodeGroup Name", "name": "k8sNodeGroupName", "in": "path", @@ -2425,6 +2433,7 @@ }, { "type": "string", + "default": "k8scluster-01", "description": "K8sCluster ID", "name": "k8sClusterId", "in": "path", @@ -9229,10 +9238,12 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "example": "1.30.1-aliyun.1" }, "name": { - "type": "string" + "type": "string", + "example": "1.30" } } }, @@ -11775,13 +11786,16 @@ "type": "object", "properties": { "desiredNodeSize": { - "type": "string" + "type": "string", + "example": "1" }, "maxNodeSize": { - "type": "string" + "type": "string", + "example": "3" }, "minNodeSize": { - "type": "string" + "type": "string", + "example": "1" } } }, @@ -11810,7 +11824,8 @@ "example": "http://1.2.3.4:6443" }, "kubeconfig": { - "type": "string" + "type": "string", + "example": "apiVersion: v1\nclusters:\n- cluster:\n certificate-authority-data: LS0..." } } }, @@ -11835,23 +11850,28 @@ "$ref": "#/definitions/mcis.TbK8sAddonsInfo" }, "connectionName": { - "type": "string" + "type": "string", + "example": "alibaba-ap-northeast-2" }, "createdTime": { "type": "string", "example": "1970-01-01T00:00:00.00Z" }, "cspK8sClusterId": { - "type": "string" + "type": "string", + "example": "c123456789012345678901234567890" }, "cspK8sClusterName": { - "type": "string" + "type": "string", + "example": "ns01-k8scluster-01" }, "description": { - "type": "string" + "type": "string", + "example": "My K8sCluster" }, "id": { - "type": "string" + "type": "string", + "example": "k8scluster-01" }, "k8sNodeGroupList": { "type": "array", @@ -11866,7 +11886,8 @@ } }, "name": { - "type": "string" + "type": "string", + "example": "k8scluster-01" }, "network": { "$ref": "#/definitions/mcis.TbK8sClusterNetworkInfo" @@ -11893,7 +11914,7 @@ "version": { "description": "Kubernetes Version, ex) 1.23.3", "type": "string", - "example": "1.23.3" + "example": "1.30.1-aliyun.1" } } }, @@ -11910,16 +11931,23 @@ "type": "array", "items": { "type": "string" - } + }, + "example": [ + "sg-01" + ] }, "subnetIds": { "type": "array", "items": { "type": "string" - } + }, + "example": [ + "subnet-01" + ] }, "vNetId": { - "type": "string" + "type": "string", + "example": "vpc-01" } } }, @@ -11936,19 +11964,21 @@ "connectionName": { "description": "Namespace string `json:\"namespace\" validate:\"required\" example:\"ns01\"`", "type": "string", - "example": "testcloud01-seoul" + "example": "alibaba-ap-northeast-2" }, "cspK8sClusterId": { - "description": "Fields for \"Register existing K8sCluster\" feature\nCspK8sClusterId is required to register a k8s cluster from CSP (option=register)", - "type": "string" + "description": "Fields for \"Register existing K8sCluster\" feature\n@description CspK8sClusterId is required to register a k8s cluster from CSP (option=register)", + "type": "string", + "example": "required when option is register" }, "description": { - "type": "string" + "type": "string", + "example": "My K8sCluster" }, "id": { "description": "(1) K8sCluster Info", "type": "string", - "example": "testcloud01-seoul-k8scluster" + "example": "k8scluster-01" }, "k8sNodeGroupList": { "description": "(3) NodeGroupInfo List", @@ -11961,21 +11991,28 @@ "type": "array", "items": { "type": "string" - } + }, + "example": [ + "sg-01" + ] }, "subnetIds": { "type": "array", "items": { "type": "string" - } + }, + "example": [ + "subnet-01" + ] }, "vNetId": { "description": "(2) Network Info", - "type": "string" + "type": "string", + "example": "vpc-01" }, "version": { "type": "string", - "example": "1.23.4" + "example": "1.30.1-aliyun.1" } } }, @@ -12000,21 +12037,27 @@ "type": "object", "properties": { "desiredNodeSize": { - "type": "integer" + "type": "integer", + "example": 1 }, "id": { - "type": "string" + "type": "string", + "example": "ng-01" }, "imageId": { "description": "VM config.", - "type": "string" + "type": "string", + "example": "image-01" }, "k8sNodes": { "description": "id for nodes", "type": "array", "items": { "type": "string" - } + }, + "example": [ + "node-01" + ] }, "keyValueList": { "type": "array", @@ -12023,26 +12066,33 @@ } }, "maxNodeSize": { - "type": "integer" + "type": "integer", + "example": 3 }, "minNodeSize": { - "type": "integer" + "type": "integer", + "example": 1 }, "onAutoScaling": { "description": "Scaling config.", - "type": "boolean" + "type": "boolean", + "example": true }, "rootDiskSize": { - "type": "string" + "type": "string", + "example": "40" }, "rootDiskType": { - "type": "string" + "type": "string", + "example": "cloud_essd" }, "specId": { - "type": "string" + "type": "string", + "example": "spec-01" }, "sshKeyId": { - "type": "string" + "type": "string", + "example": "sshkey-01" }, "status": { "description": "---", @@ -12059,39 +12109,47 @@ "type": "object", "properties": { "desiredNodeSize": { - "type": "string" + "type": "string", + "example": "1" }, "imageId": { - "type": "string" + "type": "string", + "example": "image-01" }, "maxNodeSize": { - "type": "string" + "type": "string", + "example": "3" }, "minNodeSize": { - "type": "string" + "type": "string", + "example": "1" }, "name": { - "type": "string" + "type": "string", + "example": "ng-01" }, "onAutoScaling": { "description": "autoscale config.", - "type": "string" + "type": "string", + "example": "true" }, "rootDiskSize": { "description": "\"default\", Integer (GB): [\"50\", ..., \"1000\"]", "type": "string", - "example": "default, 30, 42, ..." + "example": "40" }, "rootDiskType": { "description": "\"\", \"default\", \"TYPE1\", AWS: [\"standard\", \"gp2\", \"gp3\"], Azure: [\"PremiumSSD\", \"StandardSSD\", \"StandardHDD\"], GCP: [\"pd-standard\", \"pd-balanced\", \"pd-ssd\", \"pd-extreme\"], ALIBABA: [\"cloud_efficiency\", \"cloud\", \"cloud_ssd\"], TENCENT: [\"CLOUD_PREMIUM\", \"CLOUD_SSD\"]", "type": "string", - "example": "default, TYPE1, ..." + "example": "cloud_essd" }, "specId": { - "type": "string" + "type": "string", + "example": "spec-01" }, "sshKeyId": { - "type": "string" + "type": "string", + "example": "sshkey-01" } } }, @@ -12570,7 +12628,8 @@ "type": "object", "properties": { "onAutoScaling": { - "type": "string" + "type": "string", + "example": "true" } } }, @@ -12578,7 +12637,8 @@ "type": "object", "properties": { "version": { - "type": "string" + "type": "string", + "example": "1.30.1-alyun.1" } } }, diff --git a/src/api/rest/docs/swagger.yaml b/src/api/rest/docs/swagger.yaml index e8111bcb1..2f32eba3b 100644 --- a/src/api/rest/docs/swagger.yaml +++ b/src/api/rest/docs/swagger.yaml @@ -198,8 +198,10 @@ definitions: common.K8sClusterVersionDetailAvailable: properties: id: + example: 1.30.1-aliyun.1 type: string name: + example: "1.30" type: string type: object common.KeyValue: @@ -1937,10 +1939,13 @@ definitions: mcis.TbChangeK8sNodeGroupAutoscaleSizeReq: properties: desiredNodeSize: + example: "1" type: string maxNodeSize: + example: "3" type: string minNodeSize: + example: "1" type: string type: object mcis.TbIdNameInDetailInfo: @@ -1960,6 +1965,11 @@ definitions: example: http://1.2.3.4:6443 type: string kubeconfig: + example: |- + apiVersion: v1 + clusters: + - cluster: + certificate-authority-data: LS0... type: string type: object mcis.TbK8sAddonsInfo: @@ -1976,17 +1986,22 @@ definitions: addons: $ref: '#/definitions/mcis.TbK8sAddonsInfo' connectionName: + example: alibaba-ap-northeast-2 type: string createdTime: example: "1970-01-01T00:00:00.00Z" type: string cspK8sClusterId: + example: c123456789012345678901234567890 type: string cspK8sClusterName: + example: ns01-k8scluster-01 type: string description: + example: My K8sCluster type: string id: + example: k8scluster-01 type: string k8sNodeGroupList: items: @@ -1997,6 +2012,7 @@ definitions: $ref: '#/definitions/common.KeyValue' type: array name: + example: k8scluster-01 type: string network: $ref: '#/definitions/mcis.TbK8sClusterNetworkInfo' @@ -2016,7 +2032,7 @@ definitions: type: string version: description: Kubernetes Version, ex) 1.23.3 - example: 1.23.3 + example: 1.30.1-aliyun.1 type: string type: object mcis.TbK8sClusterNetworkInfo: @@ -2026,32 +2042,39 @@ definitions: $ref: '#/definitions/common.KeyValue' type: array securityGroupIds: + example: + - sg-01 items: type: string type: array subnetIds: + example: + - subnet-01 items: type: string type: array vNetId: + example: vpc-01 type: string type: object mcis.TbK8sClusterReq: properties: connectionName: description: Namespace string `json:"namespace" validate:"required" example:"ns01"` - example: testcloud01-seoul + example: alibaba-ap-northeast-2 type: string cspK8sClusterId: description: |- Fields for "Register existing K8sCluster" feature - CspK8sClusterId is required to register a k8s cluster from CSP (option=register) + @description CspK8sClusterId is required to register a k8s cluster from CSP (option=register) + example: required when option is register type: string description: + example: My K8sCluster type: string id: description: (1) K8sCluster Info - example: testcloud01-seoul-k8scluster + example: k8scluster-01 type: string k8sNodeGroupList: description: (3) NodeGroupInfo List @@ -2059,18 +2082,23 @@ definitions: $ref: '#/definitions/mcis.TbK8sNodeGroupReq' type: array securityGroupIds: + example: + - sg-01 items: type: string type: array subnetIds: + example: + - subnet-01 items: type: string type: array vNetId: description: (2) Network Info + example: vpc-01 type: string version: - example: 1.23.4 + example: 1.30.1-aliyun.1 type: string required: - connectionName @@ -2096,14 +2124,19 @@ definitions: mcis.TbK8sNodeGroupInfo: properties: desiredNodeSize: + example: 1 type: integer id: + example: ng-01 type: string imageId: description: VM config. + example: image-01 type: string k8sNodes: description: id for nodes + example: + - node-01 items: type: string type: array @@ -2112,19 +2145,26 @@ definitions: $ref: '#/definitions/common.KeyValue' type: array maxNodeSize: + example: 3 type: integer minNodeSize: + example: 1 type: integer onAutoScaling: description: Scaling config. + example: true type: boolean rootDiskSize: + example: "40" type: string rootDiskType: + example: cloud_essd type: string specId: + example: spec-01 type: string sshKeyId: + example: sshkey-01 type: string status: allOf: @@ -2135,32 +2175,40 @@ definitions: mcis.TbK8sNodeGroupReq: properties: desiredNodeSize: + example: "1" type: string imageId: + example: image-01 type: string maxNodeSize: + example: "3" type: string minNodeSize: + example: "1" type: string name: + example: ng-01 type: string onAutoScaling: description: autoscale config. + example: "true" type: string rootDiskSize: description: '"default", Integer (GB): ["50", ..., "1000"]' - example: default, 30, 42, ... + example: "40" type: string rootDiskType: description: '"", "default", "TYPE1", AWS: ["standard", "gp2", "gp3"], Azure: ["PremiumSSD", "StandardSSD", "StandardHDD"], GCP: ["pd-standard", "pd-balanced", "pd-ssd", "pd-extreme"], ALIBABA: ["cloud_efficiency", "cloud", "cloud_ssd"], TENCENT: ["CLOUD_PREMIUM", "CLOUD_SSD"]' - example: default, TYPE1, ... + example: cloud_essd type: string specId: + example: spec-01 type: string sshKeyId: + example: sshkey-01 type: string type: object mcis.TbK8sNodeGroupStatus: @@ -2518,11 +2566,13 @@ definitions: mcis.TbSetK8sNodeGroupAutoscalingReq: properties: onAutoScaling: + example: "true" type: string type: object mcis.TbUpgradeK8sClusterReq: properties: version: + example: 1.30.1-alyun.1 type: string type: object mcis.TbVmDynamicReq: @@ -4417,7 +4467,7 @@ paths: in: query name: filterKey type: string - - description: 'Field value for filtering (ex: ns01-alibaba-ap-northeast-1-vpc)' + - description: 'Field value for filtering (ex: ns01-alibaba-ap-northeast-2-vpc)' in: query name: filterVal type: string @@ -4449,7 +4499,7 @@ paths: post: consumes: - application/json - description: Create K8sCluster + description: Create K8sCluster
Find details from https://github.com/cloud-barista/cb-tumblebug/discussions/1614 operationId: PostK8sCluster parameters: - default: ns01 @@ -4502,7 +4552,8 @@ paths: name: nsId required: true type: string - - description: K8sCluster ID + - default: k8scluster-01 + description: K8sCluster ID in: path name: k8sClusterId required: true @@ -4533,7 +4584,7 @@ paths: name: nsId required: true type: string - - default: c1 + - default: k8scluster-01 description: K8sCluster ID in: path name: k8sClusterId @@ -4570,7 +4621,8 @@ paths: name: nsId required: true type: string - - description: K8sCluster ID + - default: k8scluster-01 + description: K8sCluster ID in: path name: k8sClusterId required: true @@ -4612,12 +4664,14 @@ paths: name: nsId required: true type: string - - description: K8sCluster ID + - default: k8scluster-01 + description: K8sCluster ID in: path name: k8sClusterId required: true type: string - - description: K8sNodeGroup Name + - default: ng-01 + description: K8sNodeGroup Name in: path name: k8sNodeGroupName required: true @@ -4649,12 +4703,14 @@ paths: name: nsId required: true type: string - - description: K8sCluster ID + - default: k8scluster-01 + description: K8sCluster ID in: path name: k8sClusterId required: true type: string - - description: K8sNodeGroup Name + - default: ng-01 + description: K8sNodeGroup Name in: path name: k8sNodeGroupName required: true @@ -4696,12 +4752,14 @@ paths: name: nsId required: true type: string - - description: K8sCluster ID + - default: k8scluster-01 + description: K8sCluster ID in: path name: k8sClusterId required: true type: string - - description: K8sNodeGroup Name + - default: ng-01 + description: K8sNodeGroup Name in: path name: k8sNodeGroupName required: true @@ -4743,7 +4801,8 @@ paths: name: nsId required: true type: string - - description: K8sCluster ID + - default: k8scluster-01 + description: K8sCluster ID in: path name: k8sClusterId required: true diff --git a/src/api/rest/server/mcis/k8scluster.go b/src/api/rest/server/mcis/k8scluster.go index 90ecb65b7..fc06a55c9 100644 --- a/src/api/rest/server/mcis/k8scluster.go +++ b/src/api/rest/server/mcis/k8scluster.go @@ -79,7 +79,7 @@ func RestGetAvailableK8sClusterNodeImage(c echo.Context) error { // RestPostK8sCluster godoc // @ID PostK8sCluster // @Summary Create K8sCluster -// @Description Create K8sCluster +// @Description Create K8sCluster
Find details from https://github.com/cloud-barista/cb-tumblebug/discussions/1614 // @Tags [Infra resource] K8sCluster management // @Accept json // @Produce json @@ -125,7 +125,7 @@ func RestPostK8sCluster(c echo.Context) error { // @Accept json // @Produce json // @Param nsId path string true "Namespace ID" default(ns01) -// @Param k8sClusterId path string true "K8sCluster ID" default(c1) +// @Param k8sClusterId path string true "K8sCluster ID" default(k8scluster-01) // @Param k8sClusterInfo body mcis.TbK8sClusterInfo true "Details of the K8sCluster object" // @Success 200 {object} mcis.TbK8sClusterInfo // @Failure 404 {object} common.SimpleMsg @@ -147,8 +147,8 @@ func RestPutK8sCluster(c echo.Context) error { // @Accept json // @Produce json // @Param nsId path string true "Namespace ID" default(ns01) -// @Param k8sClusterId path string true "K8sCluster ID" -// @Param k8sNodeGroupReq body mcis.TbK8sNodeGroupReq true "Details of the K8sNodeGroup object" +// @Param k8sClusterId path string true "K8sCluster ID" default(k8scluster-01) +// @Param k8sNodeGroupReq body mcis.TbK8sNodeGroupReq true "Details of the K8sNodeGroup object" default(ng-01) // @Success 200 {object} mcis.TbK8sClusterInfo // @Failure 404 {object} common.SimpleMsg // @Failure 500 {object} common.SimpleMsg @@ -185,8 +185,8 @@ func RestPostK8sNodeGroup(c echo.Context) error { // @Accept json // @Produce json // @Param nsId path string true "Namespace ID" default(ns01) -// @Param k8sClusterId path string true "K8sCluster ID" -// @Param k8sNodeGroupName path string true "K8sNodeGroup Name" +// @Param k8sClusterId path string true "K8sCluster ID" default(k8scluster-01) +// @Param k8sNodeGroupName path string true "K8sNodeGroup Name" default(ng-01) // @Success 200 {object} common.SimpleMsg // @Failure 404 {object} common.SimpleMsg // @Router /ns/{nsId}/k8scluster/{k8sClusterId}/k8snodegroup/{k8sNodeGroupName} [delete] @@ -224,8 +224,8 @@ func RestDeleteK8sNodeGroup(c echo.Context) error { // @Accept json // @Produce json // @Param nsId path string true "Namespace ID" default(ns01) -// @Param k8sClusterId path string true "K8sCluster ID" -// @Param k8sNodeGroupName path string true "K8sNodeGroup Name" +// @Param k8sClusterId path string true "K8sCluster ID" default(k8scluster-01) +// @Param k8sNodeGroupName path string true "K8sNodeGroup Name" default(ng-01) // @Param setK8sNodeGroupAutoscalingReq body mcis.TbSetK8sNodeGroupAutoscalingReq true "Details of the TbSetK8sNodeGroupAutoscalingReq object" // @Success 200 {object} common.SimpleMsg // @Failure 404 {object} common.SimpleMsg @@ -264,8 +264,8 @@ func RestPutSetK8sNodeGroupAutoscaling(c echo.Context) error { // @Accept json // @Produce json // @Param nsId path string true "Namespace ID" default(ns01) -// @Param k8sClusterId path string true "K8sCluster ID" -// @Param k8sNodeGroupName path string true "K8sNodeGroup Name" +// @Param k8sClusterId path string true "K8sCluster ID" default(k8scluster-01) +// @Param k8sNodeGroupName path string true "K8sNodeGroup Name" default(ng-01) // @Param changeK8sNodeGroupAutoscaleSizeReq body mcis.TbChangeK8sNodeGroupAutoscaleSizeReq true "Details of the TbChangeK8sNodeGroupAutoscaleSizeReq object" // @Success 200 {object} common.SimpleMsg // @Failure 404 {object} common.SimpleMsg @@ -304,7 +304,7 @@ func RestPutChangeK8sNodeGroupAutoscaleSize(c echo.Context) error { // @Accept json // @Produce json // @Param nsId path string true "Namespace ID" default(ns01) -// @Param k8sClusterId path string true "K8sCluster ID" default(c1) +// @Param k8sClusterId path string true "K8sCluster ID" default(k8scluster-01) // @Success 200 {object} mcis.TbK8sClusterInfo // @Failure 404 {object} common.SimpleMsg // @Failure 500 {object} common.SimpleMsg @@ -338,7 +338,7 @@ type RestGetAllK8sClusterResponse struct { // @Param nsId path string true "Namespace ID" default(ns01) // @Param option query string false "Option" Enums(id) // @Param filterKey query string false "Field key for filtering (ex: cspK8sClusterName)" -// @Param filterVal query string false "Field value for filtering (ex: ns01-alibaba-ap-northeast-1-vpc)" +// @Param filterVal query string false "Field value for filtering (ex: ns01-alibaba-ap-northeast-2-vpc)" // @Success 200 {object} JSONResult{[DEFAULT]=RestGetAllK8sClusterResponse,[ID]=common.IdList} "Different return structures by the given option param" // @Failure 404 {object} common.SimpleMsg // @Failure 500 {object} common.SimpleMsg @@ -387,7 +387,7 @@ func RestGetAllK8sCluster(c echo.Context) error { // @Accept json // @Produce json // @Param nsId path string true "Namespace ID" default(ns01) -// @Param k8sClusterId path string true "K8sCluster ID" +// @Param k8sClusterId path string true "K8sCluster ID" default(k8scluster-01) // @Success 200 {object} common.SimpleMsg // @Failure 404 {object} common.SimpleMsg // @Router /ns/{nsId}/k8scluster/{k8sClusterId} [delete] @@ -453,7 +453,7 @@ func RestDeleteAllK8sCluster(c echo.Context) error { // @Accept json // @Produce json // @Param nsId path string true "Namespace ID" default(ns01) -// @Param k8sClusterId path string true "K8sCluster ID" +// @Param k8sClusterId path string true "K8sCluster ID" default(k8scluster-01) // @Param upgradeK8sClusterReq body mcis.TbUpgradeK8sClusterReq true "Details of the TbUpgradeK8sClusterReq object" // @Success 200 {object} common.SimpleMsg // @Failure 404 {object} common.SimpleMsg diff --git a/src/core/common/config.go b/src/core/common/config.go index d0e52db7e..af56e4db2 100644 --- a/src/core/common/config.go +++ b/src/core/common/config.go @@ -86,8 +86,8 @@ type K8sClusterVersionDetail struct { // K8sClusterVersionDetailAvailable is structure for kubernetes cluster version detail's available information type K8sClusterVersionDetailAvailable struct { - Name string `mapstructure:"name" json:"name"` - Id string `mapstructure:"id" json:"id"` + Name string `mapstructure:"name" json:"name" example:"1.30"` + Id string `mapstructure:"id" json:"id" example:"1.30.1-aliyun.1"` } // K8sClusterNodeImageDetail is structure for kubernetes cluster node image detail information diff --git a/src/core/mcis/k8scluster.go b/src/core/mcis/k8scluster.go index b6e0806b7..a920875e8 100644 --- a/src/core/mcis/k8scluster.go +++ b/src/core/mcis/k8scluster.go @@ -90,24 +90,24 @@ type SpiderClusterReqInfo struct { // TbK8sClusterReq is a struct to handle 'Create K8sCluster' request toward CB-Tumblebug. type TbK8sClusterReq struct { // Tumblebug //Namespace string `json:"namespace" validate:"required" example:"ns01"` - ConnectionName string `json:"connectionName" validate:"required" example:"testcloud01-seoul"` - Description string `json:"description"` + ConnectionName string `json:"connectionName" validate:"required" example:"alibaba-ap-northeast-2"` + Description string `json:"description" example:"My K8sCluster"` // (1) K8sCluster Info - Id string `json:"id" validate:"required" example:"testcloud01-seoul-k8scluster"` - Version string `json:"version" example:"1.23.4"` + Id string `json:"id" validate:"required" example:"k8scluster-01"` + Version string `json:"version" example:"1.30.1-aliyun.1"` // (2) Network Info - VNetId string `json:"vNetId" validate:"required"` - SubnetIds []string `json:"subnetIds" validate:"required"` - SecurityGroupIds []string `json:"securityGroupIds" validate:"required"` + VNetId string `json:"vNetId" validate:"required" example:"vpc-01"` + SubnetIds []string `json:"subnetIds" validate:"required" example:"subnet-01"` + SecurityGroupIds []string `json:"securityGroupIds" validate:"required" example:"sg-01"` // (3) NodeGroupInfo List K8sNodeGroupList []TbK8sNodeGroupReq `json:"k8sNodeGroupList"` // Fields for "Register existing K8sCluster" feature - // CspK8sClusterId is required to register a k8s cluster from CSP (option=register) - CspK8sClusterId string `json:"cspK8sClusterId"` + // @description CspK8sClusterId is required to register a k8s cluster from CSP (option=register) + CspK8sClusterId string `json:"cspK8sClusterId" example:"required when option is register"` } // 2023-11-13 https://github.com/cloud-barista/cb-spider/blob/fa4bd91fdaa6bb853ea96eca4a7b4f58a2abebf2/api-runtime/rest-runtime/ClusterRest.go#L441 @@ -137,18 +137,18 @@ type SpiderNodeGroupReqInfo struct { // TbK8sNodeGroupReq is a struct to handle requests related to K8sNodeGroup toward CB-Tumblebug. type TbK8sNodeGroupReq struct { - Name string `json:"name"` - ImageId string `json:"imageId"` - SpecId string `json:"specId"` - RootDiskType string `json:"rootDiskType" example:"default, TYPE1, ..."` // "", "default", "TYPE1", AWS: ["standard", "gp2", "gp3"], Azure: ["PremiumSSD", "StandardSSD", "StandardHDD"], GCP: ["pd-standard", "pd-balanced", "pd-ssd", "pd-extreme"], ALIBABA: ["cloud_efficiency", "cloud", "cloud_ssd"], TENCENT: ["CLOUD_PREMIUM", "CLOUD_SSD"] - RootDiskSize string `json:"rootDiskSize" example:"default, 30, 42, ..."` // "default", Integer (GB): ["50", ..., "1000"] - SshKeyId string `json:"sshKeyId"` + Name string `json:"name" example:"ng-01"` + ImageId string `json:"imageId" example:"image-01"` + SpecId string `json:"specId" example:"spec-01"` + RootDiskType string `json:"rootDiskType" example:"cloud_essd" enum:"default, TYPE1, ..."` // "", "default", "TYPE1", AWS: ["standard", "gp2", "gp3"], Azure: ["PremiumSSD", "StandardSSD", "StandardHDD"], GCP: ["pd-standard", "pd-balanced", "pd-ssd", "pd-extreme"], ALIBABA: ["cloud_efficiency", "cloud", "cloud_ssd"], TENCENT: ["CLOUD_PREMIUM", "CLOUD_SSD"] + RootDiskSize string `json:"rootDiskSize" example:"40" enum:"default, 30, 42, ..."` // "default", Integer (GB): ["50", ..., "1000"] + SshKeyId string `json:"sshKeyId" example:"sshkey-01"` // autoscale config. - OnAutoScaling string `json:"onAutoScaling"` - DesiredNodeSize string `json:"desiredNodeSize"` - MinNodeSize string `json:"minNodeSize"` - MaxNodeSize string `json:"maxNodeSize"` + OnAutoScaling string `json:"onAutoScaling" example:"true"` + DesiredNodeSize string `json:"desiredNodeSize" example:"1"` + MinNodeSize string `json:"minNodeSize" example:"1"` + MaxNodeSize string `json:"maxNodeSize" example:"3"` } // SpiderSetAutoscalingReq is a wrapper struct to create JSON body of 'Set Autoscaling On/Off' request. @@ -164,7 +164,7 @@ type SpiderSetAutoscalingReqInfo struct { // TbSetK8sNodeGroupAutoscalingReq is a struct to handle 'Set K8sNodeGroup's Autoscaling' request toward CB-Tumblebug. type TbSetK8sNodeGroupAutoscalingReq struct { - OnAutoScaling string `json:"onAutoScaling"` + OnAutoScaling string `json:"onAutoScaling" example:"true"` } // SpiderChangeAutoscaleSizeReq is a wrapper struct to create JSON body of 'Change Autoscale Size' request. @@ -182,9 +182,9 @@ type SpiderChangeAutoscaleSizeReqInfo struct { // TbChangeK8sNodeGroupAutoscaleSizeReq is a struct to handle 'Change K8sNodeGroup's Autoscale Size' request toward CB-Tumblebug. type TbChangeK8sNodeGroupAutoscaleSizeReq struct { - DesiredNodeSize string `json:"desiredNodeSize"` - MinNodeSize string `json:"minNodeSize"` - MaxNodeSize string `json:"maxNodeSize"` + DesiredNodeSize string `json:"desiredNodeSize" example:"1"` + MinNodeSize string `json:"minNodeSize" example:"1"` + MaxNodeSize string `json:"maxNodeSize" example:"3"` } // SpiderChangeAutoscaleSizeRes is a wrapper struct to get JSON body of 'Change Autoscale Size' response @@ -212,7 +212,7 @@ type SpiderUpgradeClusterReqInfo struct { // TbUpgradeK8sClusterReq is a struct to handle 'Upgrade K8sCluster' request toward CB-Tumblebug. type TbUpgradeK8sClusterReq struct { - Version string `json:"version"` + Version string `json:"version" example:"1.30.1-alyun.1"` } // TbK8sClusterReqStructLevelValidation is a function to validate 'TbK8sClusterReq' object. @@ -306,11 +306,11 @@ type SpiderClusterInfo struct { // TbK8sClusterInfo is a struct that represents TB K8sCluster object. type TbK8sClusterInfo struct { // Tumblebug - Id string `json:"id"` - Name string `json:"name"` - ConnectionName string `json:"connectionName"` + Id string `json:"id" example:"k8scluster-01"` + Name string `json:"name" example:"k8scluster-01"` + ConnectionName string `json:"connectionName" example:"alibaba-ap-northeast-2"` - Version string `json:"version" example:"1.23.3"` // Kubernetes Version, ex) 1.23.3 + Version string `json:"version" example:"1.30.1-aliyun.1"` // Kubernetes Version, ex) 1.23.3 Network TbK8sClusterNetworkInfo // --- @@ -324,9 +324,9 @@ type TbK8sClusterInfo struct { // Tumblebug CreatedTime time.Time `json:"createdTime" example:"1970-01-01T00:00:00.00Z"` KeyValueList []common.KeyValue `json:"keyValueList"` - Description string `json:"description"` - CspK8sClusterId string `json:"cspK8sClusterId"` - CspK8sClusterName string `json:"cspK8sClusterName"` + Description string `json:"description" example:"My K8sCluster"` + CspK8sClusterId string `json:"cspK8sClusterId" example:"c123456789012345678901234567890"` + CspK8sClusterName string `json:"cspK8sClusterName" example:"ns01-k8scluster-01"` // Latest system message such as error message SystemMessage string `json:"systemMessage" example:"Failed because ..." default:""` // systeam-given string message @@ -350,9 +350,9 @@ type SpiderNetworkInfo struct { // TbK8sClusterNetworkInfo is a struct to handle K8sCluster Network information from the CB-Tumblebug's REST API response type TbK8sClusterNetworkInfo struct { - VNetId string `json:"vNetId"` - SubnetIds []string `json:"subnetIds"` - SecurityGroupIds []string `json:"securityGroupIds"` + VNetId string `json:"vNetId" example:"vpc-01"` + SubnetIds []string `json:"subnetIds" example:"subnet-01"` + SecurityGroupIds []string `json:"securityGroupIds" example:"sg-01"` // --- @@ -386,25 +386,25 @@ type SpiderNodeGroupInfo struct { // TbK8sNodeGroupInfo is a struct to handle K8sCluster's Node Group information from the CB-Tumblebug's REST API response type TbK8sNodeGroupInfo struct { - Id string `json:"id"` + Id string `json:"id" example:"ng-01"` //Name string `json:"name"` // VM config. - ImageId string `json:"imageId"` - SpecId string `json:"specId"` - RootDiskType string `json:"rootDiskType"` - RootDiskSize string `json:"rootDiskSize"` - SshKeyId string `json:"sshKeyId"` + ImageId string `json:"imageId" example:"image-01"` + SpecId string `json:"specId" example:"spec-01"` + RootDiskType string `json:"rootDiskType" example:"cloud_essd"` + RootDiskSize string `json:"rootDiskSize" example:"40"` + SshKeyId string `json:"sshKeyId" example:"sshkey-01"` // Scaling config. - OnAutoScaling bool `json:"onAutoScaling"` - DesiredNodeSize int `json:"desiredNodeSize"` - MinNodeSize int `json:"minNodeSize"` - MaxNodeSize int `json:"maxNodeSize"` + OnAutoScaling bool `json:"onAutoScaling" example:"true"` + DesiredNodeSize int `json:"desiredNodeSize" example:"1"` + MinNodeSize int `json:"minNodeSize" example:"1"` + MaxNodeSize int `json:"maxNodeSize" example:"3"` // --- - Status TbK8sNodeGroupStatus `json:"status" example:"Creating"` // Creating, Active, Inactive, Updating, Deleting - K8sNodes []string `json:"k8sNodes"` // id for nodes + Status TbK8sNodeGroupStatus `json:"status" example:"Creating"` // Creating, Active, Inactive, Updating, Deleting + K8sNodes []string `json:"k8sNodes" example:"node-01"` // id for nodes KeyValueList []common.KeyValue `json:"keyValueList"` } @@ -418,7 +418,7 @@ type SpiderAccessInfo struct { // TbK8sAccessInfo is a struct to handle K8sCluster Access information from the CB-Tumblebug's REST API response type TbK8sAccessInfo struct { Endpoint string `json:"endpoint" example:"http://1.2.3.4:6443"` - Kubeconfig string `json:"kubeconfig"` + Kubeconfig string `json:"kubeconfig" example:"apiVersion: v1\nclusters:\n- cluster:\n certificate-authority-data: LS0..."` } // SpiderAddonsInfo is a struct to handle Cluster Addons information from the CB-Spider's REST API response