diff --git a/src/api/rest/docs/docs.go b/src/api/rest/docs/docs.go index faab898a..195289f4 100644 --- a/src/api/rest/docs/docs.go +++ b/src/api/rest/docs/docs.go @@ -58,7 +58,7 @@ const docTemplate = `{ } } }, - "/availableK8sClusterNodeImage": { + "/availableK8sNodeImage": { "get": { "description": "(UNDER DEVELOPMENT!!!) Get available kubernetes cluster node image", "consumes": [ @@ -71,7 +71,7 @@ const docTemplate = `{ "[Kubernetes] Cluster Management" ], "summary": "(UNDER DEVELOPMENT!!!) Get available kubernetes cluster node image", - "operationId": "GetAvailableK8sClusterNodeImage", + "operationId": "GetAvailableK8sNodeImage", "parameters": [ { "type": "string", @@ -110,7 +110,7 @@ const docTemplate = `{ } } }, - "/availableK8sClusterVersion": { + "/availableK8sVersion": { "get": { "description": "Get available kubernetes cluster version", "consumes": [ @@ -123,7 +123,7 @@ const docTemplate = `{ "[Kubernetes] Cluster Management" ], "summary": "Get available kubernetes cluster version", - "operationId": "GetAvailableK8sClusterVersion", + "operationId": "GetAvailableK8sVersion", "parameters": [ { "type": "string", @@ -162,7 +162,7 @@ const docTemplate = `{ } } }, - "/checkNodeGroupsOnK8sCreation": { + "/checkK8sNodeGroupsOnK8sCreation": { "get": { "description": "Check whether nodegroups are required during the k8scluster creation", "consumes": [ @@ -175,7 +175,7 @@ const docTemplate = `{ "[Kubernetes] Cluster Management" ], "summary": "Check whether nodegroups are required during the k8scluster creation", - "operationId": "CheckNodeGroupsOnK8sCreation", + "operationId": "CheckK8sNodeGroupsOnK8sCreation", "parameters": [ { "type": "string", @@ -207,6 +207,51 @@ const docTemplate = `{ } } }, + "/checkK8sNodeImageDesignation": { + "get": { + "description": "Check whether node image designation is possible to create a k8scluster", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[Kubernetes] Cluster Management" + ], + "summary": "Check whether node image designation is possible to create a k8scluster", + "operationId": "CheckK8sNodeImageDesignation", + "parameters": [ + { + "type": "string", + "description": "Name of the CSP to retrieve", + "name": "providerName", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/model.K8sClusterNodeImageDesignation" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + } + } + } + }, "/cloudInfo": { "get": { "description": "Get cloud information", @@ -825,6 +870,102 @@ const docTemplate = `{ } } }, + "/k8sclusterDynamicCheckRequest": { + "post": { + "description": "Check available ConnectionConfig list before create K8sCluster Dynamically from common spec and image", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[Kubernetes] Cluster Management" + ], + "summary": "Check available ConnectionConfig list for creating K8sCluster Dynamically", + "operationId": "PostK8sClusterDynamicCheckRequest", + "parameters": [ + { + "description": "Details for K8sCluster dynamic request information", + "name": "k8sclusterReq", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/model.K8sClusterConnectionConfigCandidatesReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/model.CheckK8sClusterDynamicReqInfo" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + } + } + } + }, + "/k8sclusterRecommendNode": { + "post": { + "description": "Recommend K8sCluster's Node plan (filter and priority) Find details from https://github.com/cloud-barista/cb-tumblebug/discussions/1234", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[Kubernetes] Cluster Management" + ], + "summary": "Recommend K8sCluster's Node plan (filter and priority)", + "operationId": "RecommendNode", + "parameters": [ + { + "description": "Recommend K8sCluster's Node plan (filter and priority)", + "name": "deploymentPlan", + "in": "body", + "schema": { + "$ref": "#/definitions/model.DeploymentPlan" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/model.TbSpecInfo" + } + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + } + } + } + }, "/label/{labelType}/{uid}": { "get": { "description": "Get labels for a resource identified by its uid", @@ -1989,6 +2130,71 @@ const docTemplate = `{ } } }, + "/ns/{nsId}/control/k8scluster/{k8sClusterId}": { + "get": { + "description": "Control the creation of K8sCluster (continue, withdraw)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[Kubernetes] Cluster Management" + ], + "summary": "Control the creation of K8sCluster (continue, withdraw)", + "operationId": "GetControlK8sCluster", + "parameters": [ + { + "type": "string", + "default": "default", + "description": "Namespace ID", + "name": "nsId", + "in": "path", + "required": true + }, + { + "type": "string", + "default": "k8scluster-01", + "description": "K8sCluster ID", + "name": "k8sClusterId", + "in": "path", + "required": true + }, + { + "enum": [ + "continue", + "withdraw" + ], + "type": "string", + "description": "Action to K8sCluster", + "name": "action", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + } + } + } + }, "/ns/{nsId}/control/mci/{mciId}": { "get": { "description": "Control the lifecycle of MCI (refine, suspend, resume, reboot, terminate)", @@ -2514,6 +2720,15 @@ const docTemplate = `{ "description": "Delete resources containing matched ID-substring only", "name": "match", "in": "query" + }, + { + "enum": [ + "force" + ], + "type": "string", + "description": "Option for K8sCluster deletion", + "name": "option", + "in": "query" } ], "responses": { @@ -2614,6 +2829,15 @@ const docTemplate = `{ "name": "k8sClusterId", "in": "path", "required": true + }, + { + "enum": [ + "force" + ], + "type": "string", + "description": "Option for K8sCluster deletion", + "name": "option", + "in": "query" } ], "responses": { @@ -2733,6 +2957,15 @@ const docTemplate = `{ "name": "k8sNodeGroupName", "in": "path", "required": true + }, + { + "enum": [ + "force" + ], + "type": "string", + "description": "Option for K8sNodeGroup deletion", + "name": "option", + "in": "query" } ], "responses": { @@ -2956,6 +3189,76 @@ const docTemplate = `{ } } }, + "/ns/{nsId}/k8sclusterDynamic": { + "post": { + "description": "Create K8sCluster Dynamically from common spec and image", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[Kubernetes] Cluster Management" + ], + "summary": "Create K8sCluster Dynamically", + "operationId": "PostK8sClusterDynamic", + "parameters": [ + { + "type": "string", + "default": "default", + "description": "Namespace ID", + "name": "nsId", + "in": "path", + "required": true + }, + { + "description": "Request body to provision K8sCluster dynamically. \u003cbr\u003e Must include commonSpec and commonImage info. \u003cbr\u003e (ex: {name: k8scluster-01, commonImage: azure+koreacentral+ubuntu22.04, commonSpec: azure+koreacentral+Standard_B2s}]}) \u003cbr\u003e You can use /k8sclusterRecommendNode and /k8sclusterDynamicCheckRequest to get it. \u003cbr\u003e Check the guide: https://github.com/cloud-barista/cb-tumblebug/discussions/1570", + "name": "k8sclusterReq", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/model.TbK8sClusterDynamicReq" + } + }, + { + "enum": [ + "hold" + ], + "type": "string", + "description": "Option for K8sCluster creation", + "name": "option", + "in": "query" + }, + { + "type": "string", + "description": "Custom request ID", + "name": "x-request-id", + "in": "header" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/model.TbK8sClusterInfo" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + } + } + } + }, "/ns/{nsId}/mci": { "get": { "description": "List all MCIs or MCIs' ID", @@ -9588,6 +9891,51 @@ const docTemplate = `{ } } }, + "/requiredK8sSubnetCount": { + "get": { + "description": "Get the required subnet count to create a k8scluster", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[Kubernetes] Cluster Management" + ], + "summary": "Get the required subnet count to create a k8scluster", + "operationId": "GetRequiredK8sSubnetCount", + "parameters": [ + { + "type": "string", + "description": "Name of the CSP to retrieve", + "name": "providerName", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/model.K8sClusterRequiredSubnetCount" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + } + } + } + }, "/resources/{labelType}": { "get": { "description": "Get resources based on a label selector. The label selector supports the following operators:\n- ` + "`" + `=` + "`" + ` : Selects resources where the label key equals the specified value (e.g., ` + "`" + `env=production` + "`" + `).\n- ` + "`" + `!=` + "`" + ` : Selects resources where the label key does not equal the specified value (e.g., ` + "`" + `tier!=frontend` + "`" + `).\n- ` + "`" + `in` + "`" + ` : Selects resources where the label key is in the specified set of values (e.g., ` + "`" + `region in (us-west, us-east)` + "`" + `).\n- ` + "`" + `notin` + "`" + ` : Selects resources where the label key is not in the specified set of values (e.g., ` + "`" + `env notin (production, staging)` + "`" + `).\n- ` + "`" + `exists` + "`" + ` : Selects resources where the label key exists (e.g., ` + "`" + `env exists` + "`" + `).\n- ` + "`" + `!exists` + "`" + ` : Selects resources where the label key does not exist (e.g., ` + "`" + `env !exists` + "`" + `).", @@ -10303,6 +10651,20 @@ const docTemplate = `{ } } }, + "model.CheckK8sClusterDynamicReqInfo": { + "type": "object", + "required": [ + "reqCheck" + ], + "properties": { + "reqCheck": { + "type": "array", + "items": { + "$ref": "#/definitions/model.CheckNodeDynamicReqInfo" + } + } + } + }, "model.CheckMciDynamicReqInfo": { "type": "object", "required": [ @@ -10317,6 +10679,35 @@ const docTemplate = `{ } } }, + "model.CheckNodeDynamicReqInfo": { + "type": "object", + "properties": { + "connectionConfigCandidates": { + "description": "ConnectionConfigCandidates will provide ConnectionConfig options", + "type": "array", + "items": { + "type": "string" + } + }, + "image": { + "type": "array", + "items": { + "$ref": "#/definitions/model.TbImageInfo" + } + }, + "region": { + "$ref": "#/definitions/model.RegionDetail" + }, + "spec": { + "$ref": "#/definitions/model.TbSpecInfo" + }, + "systemMessage": { + "description": "Latest system message such as error message", + "type": "string", + "example": "Failed because ..." + } + } + }, "model.CheckVmDynamicReqInfo": { "type": "object", "properties": { @@ -10757,9 +11148,30 @@ const docTemplate = `{ } } }, + "model.K8sClusterConnectionConfigCandidatesReq": { + "type": "object", + "required": [ + "commonSpec" + ], + "properties": { + "commonSpec": { + "description": "CommonSpec is field for id of a spec in common namespace", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "azure+koreacentral+Standard_B2s" + ] + } + } + }, "model.K8sClusterDetail": { "type": "object", "properties": { + "node_image_designation": { + "type": "boolean" + }, "node_images": { "type": "array", "items": { @@ -10769,6 +11181,9 @@ const docTemplate = `{ "nodegroups_on_creation": { "type": "boolean" }, + "required_subnet_count": { + "type": "integer" + }, "root_disks": { "type": "array", "items": { @@ -10803,6 +11218,15 @@ const docTemplate = `{ } } }, + "model.K8sClusterNodeImageDesignation": { + "type": "object", + "properties": { + "result": { + "type": "string", + "example": "true" + } + } + }, "model.K8sClusterNodeImageDetail": { "type": "object", "properties": { @@ -10831,6 +11255,15 @@ const docTemplate = `{ } } }, + "model.K8sClusterRequiredSubnetCount": { + "type": "object", + "properties": { + "result": { + "type": "string", + "example": "1" + } + } + }, "model.K8sClusterRootDiskDetail": { "type": "object", "properties": { @@ -12751,6 +13184,89 @@ const docTemplate = `{ } } }, + "model.TbK8sClusterDynamicReq": { + "type": "object", + "required": [ + "commonImage", + "commonSpec", + "name" + ], + "properties": { + "commonImage": { + "description": "CommonImage is field for id of a image in common namespace", + "type": "string", + "example": "default, azure+koreacentrall+ubuntu20.04" + }, + "commonSpec": { + "description": "CommonSpec is field for id of a spec in common namespace", + "type": "string", + "example": "azure+koreacentral+standard_b2s" + }, + "connectionName": { + "description": "if ConnectionName is given, the VM tries to use associtated credential.\nif not, it will use predefined ConnectionName in Spec objects", + "type": "string", + "default": "azure-koreacentral" + }, + "description": { + "type": "string", + "example": "Description" + }, + "desiredNodeSize": { + "type": "string", + "default": "1", + "example": "1" + }, + "label": { + "description": "Label is for describing the object by keywords", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "maxNodeSize": { + "type": "string", + "default": "2", + "example": "3" + }, + "minNodeSize": { + "type": "string", + "default": "1", + "example": "1" + }, + "name": { + "description": "K8sCluster name if it is not empty.", + "type": "string", + "example": "k8scluster-01" + }, + "nodeGroupName": { + "description": "NodeGroup name if it is not empty", + "type": "string", + "example": "nodegroup-01" + }, + "onAutoScaling": { + "type": "string", + "default": "true", + "example": "true" + }, + "rootDiskSize": { + "description": "\"default\", Integer (GB): [\"50\", ..., \"1000\"]", + "type": "string", + "default": "default", + "example": "default, 30, 42, ..." + }, + "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_essd\"], TENCENT: [\"CLOUD_PREMIUM\", \"CLOUD_SSD\"]", + "type": "string", + "default": "default", + "example": "default, TYPE1, ..." + }, + "version": { + "description": "K8s Clsuter version", + "type": "string", + "example": "1.29" + } + } + }, "model.TbK8sClusterInfo": { "type": "object", "properties": { @@ -12852,6 +13368,13 @@ const docTemplate = `{ "$ref": "#/definitions/model.TbK8sNodeGroupReq" } }, + "label": { + "description": "Label is for describing the object by keywords", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, "name": { "description": "(1) K8sCluster Info", "type": "string", @@ -12875,6 +13398,11 @@ const docTemplate = `{ "subnet-01" ] }, + "systemLabel": { + "description": "SystemLabel is for describing the k8scluster in a keyword (any string can be used) for special System purpose", + "type": "string", + "example": "" + }, "vNetId": { "description": "(2) Network Info", "type": "string", diff --git a/src/api/rest/docs/swagger.json b/src/api/rest/docs/swagger.json index c9557515..72ab18c1 100644 --- a/src/api/rest/docs/swagger.json +++ b/src/api/rest/docs/swagger.json @@ -51,7 +51,7 @@ } } }, - "/availableK8sClusterNodeImage": { + "/availableK8sNodeImage": { "get": { "description": "(UNDER DEVELOPMENT!!!) Get available kubernetes cluster node image", "consumes": [ @@ -64,7 +64,7 @@ "[Kubernetes] Cluster Management" ], "summary": "(UNDER DEVELOPMENT!!!) Get available kubernetes cluster node image", - "operationId": "GetAvailableK8sClusterNodeImage", + "operationId": "GetAvailableK8sNodeImage", "parameters": [ { "type": "string", @@ -103,7 +103,7 @@ } } }, - "/availableK8sClusterVersion": { + "/availableK8sVersion": { "get": { "description": "Get available kubernetes cluster version", "consumes": [ @@ -116,7 +116,7 @@ "[Kubernetes] Cluster Management" ], "summary": "Get available kubernetes cluster version", - "operationId": "GetAvailableK8sClusterVersion", + "operationId": "GetAvailableK8sVersion", "parameters": [ { "type": "string", @@ -155,7 +155,7 @@ } } }, - "/checkNodeGroupsOnK8sCreation": { + "/checkK8sNodeGroupsOnK8sCreation": { "get": { "description": "Check whether nodegroups are required during the k8scluster creation", "consumes": [ @@ -168,7 +168,7 @@ "[Kubernetes] Cluster Management" ], "summary": "Check whether nodegroups are required during the k8scluster creation", - "operationId": "CheckNodeGroupsOnK8sCreation", + "operationId": "CheckK8sNodeGroupsOnK8sCreation", "parameters": [ { "type": "string", @@ -200,6 +200,51 @@ } } }, + "/checkK8sNodeImageDesignation": { + "get": { + "description": "Check whether node image designation is possible to create a k8scluster", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[Kubernetes] Cluster Management" + ], + "summary": "Check whether node image designation is possible to create a k8scluster", + "operationId": "CheckK8sNodeImageDesignation", + "parameters": [ + { + "type": "string", + "description": "Name of the CSP to retrieve", + "name": "providerName", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/model.K8sClusterNodeImageDesignation" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + } + } + } + }, "/cloudInfo": { "get": { "description": "Get cloud information", @@ -818,6 +863,102 @@ } } }, + "/k8sclusterDynamicCheckRequest": { + "post": { + "description": "Check available ConnectionConfig list before create K8sCluster Dynamically from common spec and image", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[Kubernetes] Cluster Management" + ], + "summary": "Check available ConnectionConfig list for creating K8sCluster Dynamically", + "operationId": "PostK8sClusterDynamicCheckRequest", + "parameters": [ + { + "description": "Details for K8sCluster dynamic request information", + "name": "k8sclusterReq", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/model.K8sClusterConnectionConfigCandidatesReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/model.CheckK8sClusterDynamicReqInfo" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + } + } + } + }, + "/k8sclusterRecommendNode": { + "post": { + "description": "Recommend K8sCluster's Node plan (filter and priority) Find details from https://github.com/cloud-barista/cb-tumblebug/discussions/1234", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[Kubernetes] Cluster Management" + ], + "summary": "Recommend K8sCluster's Node plan (filter and priority)", + "operationId": "RecommendNode", + "parameters": [ + { + "description": "Recommend K8sCluster's Node plan (filter and priority)", + "name": "deploymentPlan", + "in": "body", + "schema": { + "$ref": "#/definitions/model.DeploymentPlan" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/model.TbSpecInfo" + } + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + } + } + } + }, "/label/{labelType}/{uid}": { "get": { "description": "Get labels for a resource identified by its uid", @@ -1982,6 +2123,71 @@ } } }, + "/ns/{nsId}/control/k8scluster/{k8sClusterId}": { + "get": { + "description": "Control the creation of K8sCluster (continue, withdraw)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[Kubernetes] Cluster Management" + ], + "summary": "Control the creation of K8sCluster (continue, withdraw)", + "operationId": "GetControlK8sCluster", + "parameters": [ + { + "type": "string", + "default": "default", + "description": "Namespace ID", + "name": "nsId", + "in": "path", + "required": true + }, + { + "type": "string", + "default": "k8scluster-01", + "description": "K8sCluster ID", + "name": "k8sClusterId", + "in": "path", + "required": true + }, + { + "enum": [ + "continue", + "withdraw" + ], + "type": "string", + "description": "Action to K8sCluster", + "name": "action", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + } + } + } + }, "/ns/{nsId}/control/mci/{mciId}": { "get": { "description": "Control the lifecycle of MCI (refine, suspend, resume, reboot, terminate)", @@ -2507,6 +2713,15 @@ "description": "Delete resources containing matched ID-substring only", "name": "match", "in": "query" + }, + { + "enum": [ + "force" + ], + "type": "string", + "description": "Option for K8sCluster deletion", + "name": "option", + "in": "query" } ], "responses": { @@ -2607,6 +2822,15 @@ "name": "k8sClusterId", "in": "path", "required": true + }, + { + "enum": [ + "force" + ], + "type": "string", + "description": "Option for K8sCluster deletion", + "name": "option", + "in": "query" } ], "responses": { @@ -2726,6 +2950,15 @@ "name": "k8sNodeGroupName", "in": "path", "required": true + }, + { + "enum": [ + "force" + ], + "type": "string", + "description": "Option for K8sNodeGroup deletion", + "name": "option", + "in": "query" } ], "responses": { @@ -2949,6 +3182,76 @@ } } }, + "/ns/{nsId}/k8sclusterDynamic": { + "post": { + "description": "Create K8sCluster Dynamically from common spec and image", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[Kubernetes] Cluster Management" + ], + "summary": "Create K8sCluster Dynamically", + "operationId": "PostK8sClusterDynamic", + "parameters": [ + { + "type": "string", + "default": "default", + "description": "Namespace ID", + "name": "nsId", + "in": "path", + "required": true + }, + { + "description": "Request body to provision K8sCluster dynamically. \u003cbr\u003e Must include commonSpec and commonImage info. \u003cbr\u003e (ex: {name: k8scluster-01, commonImage: azure+koreacentral+ubuntu22.04, commonSpec: azure+koreacentral+Standard_B2s}]}) \u003cbr\u003e You can use /k8sclusterRecommendNode and /k8sclusterDynamicCheckRequest to get it. \u003cbr\u003e Check the guide: https://github.com/cloud-barista/cb-tumblebug/discussions/1570", + "name": "k8sclusterReq", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/model.TbK8sClusterDynamicReq" + } + }, + { + "enum": [ + "hold" + ], + "type": "string", + "description": "Option for K8sCluster creation", + "name": "option", + "in": "query" + }, + { + "type": "string", + "description": "Custom request ID", + "name": "x-request-id", + "in": "header" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/model.TbK8sClusterInfo" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + } + } + } + }, "/ns/{nsId}/mci": { "get": { "description": "List all MCIs or MCIs' ID", @@ -9581,6 +9884,51 @@ } } }, + "/requiredK8sSubnetCount": { + "get": { + "description": "Get the required subnet count to create a k8scluster", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[Kubernetes] Cluster Management" + ], + "summary": "Get the required subnet count to create a k8scluster", + "operationId": "GetRequiredK8sSubnetCount", + "parameters": [ + { + "type": "string", + "description": "Name of the CSP to retrieve", + "name": "providerName", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/model.K8sClusterRequiredSubnetCount" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + } + } + } + }, "/resources/{labelType}": { "get": { "description": "Get resources based on a label selector. The label selector supports the following operators:\n- `=` : Selects resources where the label key equals the specified value (e.g., `env=production`).\n- `!=` : Selects resources where the label key does not equal the specified value (e.g., `tier!=frontend`).\n- `in` : Selects resources where the label key is in the specified set of values (e.g., `region in (us-west, us-east)`).\n- `notin` : Selects resources where the label key is not in the specified set of values (e.g., `env notin (production, staging)`).\n- `exists` : Selects resources where the label key exists (e.g., `env exists`).\n- `!exists` : Selects resources where the label key does not exist (e.g., `env !exists`).", @@ -10296,6 +10644,20 @@ } } }, + "model.CheckK8sClusterDynamicReqInfo": { + "type": "object", + "required": [ + "reqCheck" + ], + "properties": { + "reqCheck": { + "type": "array", + "items": { + "$ref": "#/definitions/model.CheckNodeDynamicReqInfo" + } + } + } + }, "model.CheckMciDynamicReqInfo": { "type": "object", "required": [ @@ -10310,6 +10672,35 @@ } } }, + "model.CheckNodeDynamicReqInfo": { + "type": "object", + "properties": { + "connectionConfigCandidates": { + "description": "ConnectionConfigCandidates will provide ConnectionConfig options", + "type": "array", + "items": { + "type": "string" + } + }, + "image": { + "type": "array", + "items": { + "$ref": "#/definitions/model.TbImageInfo" + } + }, + "region": { + "$ref": "#/definitions/model.RegionDetail" + }, + "spec": { + "$ref": "#/definitions/model.TbSpecInfo" + }, + "systemMessage": { + "description": "Latest system message such as error message", + "type": "string", + "example": "Failed because ..." + } + } + }, "model.CheckVmDynamicReqInfo": { "type": "object", "properties": { @@ -10750,9 +11141,30 @@ } } }, + "model.K8sClusterConnectionConfigCandidatesReq": { + "type": "object", + "required": [ + "commonSpec" + ], + "properties": { + "commonSpec": { + "description": "CommonSpec is field for id of a spec in common namespace", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "azure+koreacentral+Standard_B2s" + ] + } + } + }, "model.K8sClusterDetail": { "type": "object", "properties": { + "node_image_designation": { + "type": "boolean" + }, "node_images": { "type": "array", "items": { @@ -10762,6 +11174,9 @@ "nodegroups_on_creation": { "type": "boolean" }, + "required_subnet_count": { + "type": "integer" + }, "root_disks": { "type": "array", "items": { @@ -10796,6 +11211,15 @@ } } }, + "model.K8sClusterNodeImageDesignation": { + "type": "object", + "properties": { + "result": { + "type": "string", + "example": "true" + } + } + }, "model.K8sClusterNodeImageDetail": { "type": "object", "properties": { @@ -10824,6 +11248,15 @@ } } }, + "model.K8sClusterRequiredSubnetCount": { + "type": "object", + "properties": { + "result": { + "type": "string", + "example": "1" + } + } + }, "model.K8sClusterRootDiskDetail": { "type": "object", "properties": { @@ -12744,6 +13177,89 @@ } } }, + "model.TbK8sClusterDynamicReq": { + "type": "object", + "required": [ + "commonImage", + "commonSpec", + "name" + ], + "properties": { + "commonImage": { + "description": "CommonImage is field for id of a image in common namespace", + "type": "string", + "example": "default, azure+koreacentrall+ubuntu20.04" + }, + "commonSpec": { + "description": "CommonSpec is field for id of a spec in common namespace", + "type": "string", + "example": "azure+koreacentral+standard_b2s" + }, + "connectionName": { + "description": "if ConnectionName is given, the VM tries to use associtated credential.\nif not, it will use predefined ConnectionName in Spec objects", + "type": "string", + "default": "azure-koreacentral" + }, + "description": { + "type": "string", + "example": "Description" + }, + "desiredNodeSize": { + "type": "string", + "default": "1", + "example": "1" + }, + "label": { + "description": "Label is for describing the object by keywords", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "maxNodeSize": { + "type": "string", + "default": "2", + "example": "3" + }, + "minNodeSize": { + "type": "string", + "default": "1", + "example": "1" + }, + "name": { + "description": "K8sCluster name if it is not empty.", + "type": "string", + "example": "k8scluster-01" + }, + "nodeGroupName": { + "description": "NodeGroup name if it is not empty", + "type": "string", + "example": "nodegroup-01" + }, + "onAutoScaling": { + "type": "string", + "default": "true", + "example": "true" + }, + "rootDiskSize": { + "description": "\"default\", Integer (GB): [\"50\", ..., \"1000\"]", + "type": "string", + "default": "default", + "example": "default, 30, 42, ..." + }, + "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_essd\"], TENCENT: [\"CLOUD_PREMIUM\", \"CLOUD_SSD\"]", + "type": "string", + "default": "default", + "example": "default, TYPE1, ..." + }, + "version": { + "description": "K8s Clsuter version", + "type": "string", + "example": "1.29" + } + } + }, "model.TbK8sClusterInfo": { "type": "object", "properties": { @@ -12845,6 +13361,13 @@ "$ref": "#/definitions/model.TbK8sNodeGroupReq" } }, + "label": { + "description": "Label is for describing the object by keywords", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, "name": { "description": "(1) K8sCluster Info", "type": "string", @@ -12868,6 +13391,11 @@ "subnet-01" ] }, + "systemLabel": { + "description": "SystemLabel is for describing the k8scluster in a keyword (any string can be used) for special System purpose", + "type": "string", + "example": "" + }, "vNetId": { "description": "(2) Network Info", "type": "string", diff --git a/src/api/rest/docs/swagger.yaml b/src/api/rest/docs/swagger.yaml index 67a6ae7d..9958a759 100644 --- a/src/api/rest/docs/swagger.yaml +++ b/src/api/rest/docs/swagger.yaml @@ -36,13 +36,13 @@ paths: type: object security: - Bearer: [] - /availableK8sClusterNodeImage: + /availableK8sNodeImage: get: tags: - "[Kubernetes] Cluster Management" summary: (UNDER DEVELOPMENT!!!) Get available kubernetes cluster node image description: (UNDER DEVELOPMENT!!!) Get available kubernetes cluster node image - operationId: GetAvailableK8sClusterNodeImage + operationId: GetAvailableK8sNodeImage parameters: - name: providerName in: query @@ -75,13 +75,13 @@ paths: application/json: schema: $ref: '#/components/schemas/model.SimpleMsg' - /availableK8sClusterVersion: + /availableK8sVersion: get: tags: - "[Kubernetes] Cluster Management" summary: Get available kubernetes cluster version description: Get available kubernetes cluster version - operationId: GetAvailableK8sClusterVersion + operationId: GetAvailableK8sVersion parameters: - name: providerName in: query @@ -114,13 +114,13 @@ paths: application/json: schema: $ref: '#/components/schemas/model.SimpleMsg' - /checkNodeGroupsOnK8sCreation: + /checkK8sNodeGroupsOnK8sCreation: get: tags: - "[Kubernetes] Cluster Management" summary: Check whether nodegroups are required during the k8scluster creation description: Check whether nodegroups are required during the k8scluster creation - operationId: CheckNodeGroupsOnK8sCreation + operationId: CheckK8sNodeGroupsOnK8sCreation parameters: - name: providerName in: query @@ -147,6 +147,39 @@ paths: application/json: schema: $ref: '#/components/schemas/model.SimpleMsg' + /checkK8sNodeImageDesignation: + get: + tags: + - "[Kubernetes] Cluster Management" + summary: Check whether node image designation is possible to create a k8scluster + description: Check whether node image designation is possible to create a k8scluster + operationId: CheckK8sNodeImageDesignation + parameters: + - name: providerName + in: query + description: Name of the CSP to retrieve + required: true + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/model.K8sClusterNodeImageDesignation' + "404": + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/model.SimpleMsg' + "500": + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/model.SimpleMsg' /cloudInfo: get: tags: @@ -613,6 +646,78 @@ paths: application/json: schema: $ref: '#/components/schemas/model.SimpleMsg' + /k8sclusterDynamicCheckRequest: + post: + tags: + - "[Kubernetes] Cluster Management" + summary: Check available ConnectionConfig list for creating K8sCluster Dynamically + description: Check available ConnectionConfig list before create K8sCluster + Dynamically from common spec and image + operationId: PostK8sClusterDynamicCheckRequest + requestBody: + description: Details for K8sCluster dynamic request information + content: + application/json: + schema: + $ref: '#/components/schemas/model.K8sClusterConnectionConfigCandidatesReq' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/model.CheckK8sClusterDynamicReqInfo' + "404": + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/model.SimpleMsg' + "500": + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/model.SimpleMsg' + x-codegen-request-body-name: k8sclusterReq + /k8sclusterRecommendNode: + post: + tags: + - "[Kubernetes] Cluster Management" + summary: Recommend K8sCluster's Node plan (filter and priority) + description: Recommend K8sCluster's Node plan (filter and priority) Find details + from https://github.com/cloud-barista/cb-tumblebug/discussions/1234 + operationId: RecommendNode + requestBody: + description: Recommend K8sCluster's Node plan (filter and priority) + content: + application/json: + schema: + $ref: '#/components/schemas/model.DeploymentPlan' + required: false + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/model.TbSpecInfo' + "404": + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/model.SimpleMsg' + "500": + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/model.SimpleMsg' + x-codegen-request-body-name: deploymentPlan /label/{labelType}/{uid}: get: tags: @@ -1486,6 +1591,56 @@ paths: schema: $ref: '#/components/schemas/model.SimpleMsg' x-codegen-request-body-name: mciCmdReq + /ns/{nsId}/control/k8scluster/{k8sClusterId}: + get: + tags: + - "[Kubernetes] Cluster Management" + summary: "Control the creation of K8sCluster (continue, withdraw)" + description: "Control the creation of K8sCluster (continue, withdraw)" + operationId: GetControlK8sCluster + parameters: + - name: nsId + in: path + description: Namespace ID + required: true + schema: + type: string + default: default + - name: k8sClusterId + in: path + description: K8sCluster ID + required: true + schema: + type: string + default: k8scluster-01 + - name: action + in: query + description: Action to K8sCluster + required: true + schema: + type: string + enum: + - continue + - withdraw + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/model.SimpleMsg' + "404": + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/model.SimpleMsg' + "500": + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/model.SimpleMsg' /ns/{nsId}/control/mci/{mciId}: get: tags: @@ -1887,6 +2042,13 @@ paths: description: Delete resources containing matched ID-substring only schema: type: string + - name: option + in: query + description: Option for K8sCluster deletion + schema: + type: string + enum: + - force responses: "200": description: OK @@ -1962,6 +2124,13 @@ paths: schema: type: string default: k8scluster-01 + - name: option + in: query + description: Option for K8sCluster deletion + schema: + type: string + enum: + - force responses: "200": description: OK @@ -2053,6 +2222,13 @@ paths: schema: type: string default: ng-01 + - name: option + in: query + description: Option for K8sNodeGroup deletion + schema: + type: string + enum: + - force responses: "200": description: OK @@ -2227,6 +2403,64 @@ paths: schema: $ref: '#/components/schemas/model.SimpleMsg' x-codegen-request-body-name: upgradeK8sClusterReq + /ns/{nsId}/k8sclusterDynamic: + post: + tags: + - "[Kubernetes] Cluster Management" + summary: Create K8sCluster Dynamically + description: Create K8sCluster Dynamically from common spec and image + operationId: PostK8sClusterDynamic + parameters: + - name: nsId + in: path + description: Namespace ID + required: true + schema: + type: string + default: default + - name: option + in: query + description: Option for K8sCluster creation + schema: + type: string + enum: + - hold + - name: x-request-id + in: header + description: Custom request ID + schema: + type: string + requestBody: + description: "Request body to provision K8sCluster dynamically.
Must\ + \ include commonSpec and commonImage info.
(ex: {name: k8scluster-01,\ + \ commonImage: azure+koreacentral+ubuntu22.04, commonSpec: azure+koreacentral+Standard_B2s}]})\ + \
You can use /k8sclusterRecommendNode and /k8sclusterDynamicCheckRequest\ + \ to get it.
Check the guide: https://github.com/cloud-barista/cb-tumblebug/discussions/1570" + content: + application/json: + schema: + $ref: '#/components/schemas/model.TbK8sClusterDynamicReq' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/model.TbK8sClusterInfo' + "404": + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/model.SimpleMsg' + "500": + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/model.SimpleMsg' + x-codegen-request-body-name: k8sclusterReq /ns/{nsId}/mci: get: tags: @@ -7275,6 +7509,39 @@ paths: application/json: schema: $ref: '#/components/schemas/model.SimpleMsg' + /requiredK8sSubnetCount: + get: + tags: + - "[Kubernetes] Cluster Management" + summary: Get the required subnet count to create a k8scluster + description: Get the required subnet count to create a k8scluster + operationId: GetRequiredK8sSubnetCount + parameters: + - name: providerName + in: query + description: Name of the CSP to retrieve + required: true + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/model.K8sClusterRequiredSubnetCount' + "404": + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/model.SimpleMsg' + "500": + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/model.SimpleMsg' /resources/{labelType}: get: tags: @@ -7793,6 +8060,15 @@ components: type: object additionalProperties: $ref: '#/components/schemas/model.RegionDetail' + model.CheckK8sClusterDynamicReqInfo: + required: + - reqCheck + type: object + properties: + reqCheck: + type: array + items: + $ref: '#/components/schemas/model.CheckNodeDynamicReqInfo' model.CheckMciDynamicReqInfo: required: - reqCheck @@ -7802,6 +8078,26 @@ components: type: array items: $ref: '#/components/schemas/model.CheckVmDynamicReqInfo' + model.CheckNodeDynamicReqInfo: + type: object + properties: + connectionConfigCandidates: + type: array + description: ConnectionConfigCandidates will provide ConnectionConfig options + items: + type: string + image: + type: array + items: + $ref: '#/components/schemas/model.TbImageInfo' + region: + $ref: '#/components/schemas/model.RegionDetail' + spec: + $ref: '#/components/schemas/model.TbSpecInfo' + systemMessage: + type: string + description: Latest system message such as error message + example: Failed because ... model.CheckVmDynamicReqInfo: type: object properties: @@ -8108,15 +8404,31 @@ components: type: string tumblebugOverview: $ref: '#/components/schemas/model.inspectOverview' + model.K8sClusterConnectionConfigCandidatesReq: + required: + - commonSpec + type: object + properties: + commonSpec: + type: array + description: CommonSpec is field for id of a spec in common namespace + example: + - azure+koreacentral+Standard_B2s + items: + type: string model.K8sClusterDetail: type: object properties: + node_image_designation: + type: boolean node_images: type: array items: $ref: '#/components/schemas/model.K8sClusterNodeImageDetail' nodegroups_on_creation: type: boolean + required_subnet_count: + type: integer root_disks: type: array items: @@ -8138,6 +8450,12 @@ components: result: type: string example: "true" + model.K8sClusterNodeImageDesignation: + type: object + properties: + result: + type: string + example: "true" model.K8sClusterNodeImageDetail: type: object properties: @@ -8156,6 +8474,12 @@ components: type: string name: type: string + model.K8sClusterRequiredSubnetCount: + type: object + properties: + result: + type: string + example: "1" model.K8sClusterRootDiskDetail: type: object properties: @@ -9498,6 +9822,77 @@ components: type: string name: type: string + model.TbK8sClusterDynamicReq: + required: + - commonImage + - commonSpec + - name + type: object + properties: + commonImage: + type: string + description: CommonImage is field for id of a image in common namespace + example: "default, azure+koreacentrall+ubuntu20.04" + commonSpec: + type: string + description: CommonSpec is field for id of a spec in common namespace + example: azure+koreacentral+standard_b2s + connectionName: + type: string + description: |- + if ConnectionName is given, the VM tries to use associtated credential. + if not, it will use predefined ConnectionName in Spec objects + default: azure-koreacentral + description: + type: string + example: Description + desiredNodeSize: + type: string + example: "1" + default: "1" + label: + type: object + additionalProperties: + type: string + description: Label is for describing the object by keywords + maxNodeSize: + type: string + example: "3" + default: "2" + minNodeSize: + type: string + example: "1" + default: "1" + name: + type: string + description: K8sCluster name if it is not empty. + example: k8scluster-01 + nodeGroupName: + type: string + description: NodeGroup name if it is not empty + example: nodegroup-01 + onAutoScaling: + type: string + example: "true" + default: "true" + rootDiskSize: + type: string + description: "\"default\", Integer (GB): [\"50\", ..., \"1000\"]" + example: "default, 30, 42, ..." + default: default + rootDiskType: + type: string + 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_essd\"], TENCENT:\ + \ [\"CLOUD_PREMIUM\", \"CLOUD_SSD\"]" + example: "default, TYPE1, ..." + default: default + version: + type: string + description: K8s Clsuter version + example: "1.29" model.TbK8sClusterInfo: type: object properties: @@ -9581,6 +9976,11 @@ components: description: (3) NodeGroupInfo List items: $ref: '#/components/schemas/model.TbK8sNodeGroupReq' + label: + type: object + additionalProperties: + type: string + description: Label is for describing the object by keywords name: type: string description: (1) K8sCluster Info @@ -9597,6 +9997,11 @@ components: - subnet-01 items: type: string + systemLabel: + type: string + description: SystemLabel is for describing the k8scluster in a keyword (any + string can be used) for special System purpose + example: "" vNetId: type: string description: (2) Network Info