Skip to content

Commit

Permalink
add K8sClusterInfo, availableK8sClusterVersion, availableK8sClusterNo…
Browse files Browse the repository at this point in the history
…deImage APIs

o New APIs
 - [GET] /tumblebug/k8sClusterInfo
 - [GET]
   /tumblebug/availableK8sClusterVersion?providerName={providerName}&regionName={regionName}
 - [GET]
   /tumblebug/availableK8sClusterNodeImage?providerName={providerName}&regionName={regionName}

related to #1562
  • Loading branch information
Sooyoung Kim committed Jun 5, 2024
1 parent 8b07b57 commit 7e1f193
Show file tree
Hide file tree
Showing 8 changed files with 1,027 additions and 25 deletions.
285 changes: 285 additions & 0 deletions src/api/rest/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,110 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/availableK8sClusterNodeImage": {
"get": {
"description": "Get available kubernetes cluster node image",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"[Infra resource] Cluster management"
],
"summary": "Get available kubernetes cluster node image",
"operationId": "GetAvailableK8sClusterNodeImage",
"parameters": [
{
"type": "string",
"description": "Name of the CSP to retrieve",
"name": "providerName",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Name of region to retrieve",
"name": "regionName",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/common.K8sClusterNodeImageDetailAvailable"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
}
}
}
},
"/availableK8sClusterVersion": {
"get": {
"description": "Get available kubernetes cluster version",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"[Infra resource] Cluster management"
],
"summary": "Get available kubernetes cluster version",
"operationId": "GetAvailableK8sClusterVersion",
"parameters": [
{
"type": "string",
"description": "Name of the CSP to retrieve",
"name": "providerName",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Name of region to retrieve",
"name": "regionName",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/common.K8sClusterVersionDetailAvailable"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
}
}
}
},
"/cloudInfo": {
"get": {
"description": "Get cloud information",
Expand Down Expand Up @@ -564,6 +668,42 @@ const docTemplate = `{
}
}
},
"/k8sClusterInfo": {
"get": {
"description": "Get kubernetes cluster information",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"[Admin] Multi-Cloud environment configuration"
],
"summary": "Get kubernetes cluster information",
"operationId": "GetK8sClusterInfo",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/common.K8sClusterInfo"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
}
}
}
},
"/loadCommonResource": {
"get": {
"description": "Load Common Resources from internal asset files (Spec, Image)",
Expand Down Expand Up @@ -1349,6 +1489,7 @@ const docTemplate = `{
"[Infra resource] Cluster management"
],
"summary": "List all Clusters or Clusters' ID",
"operationId": "GetAllCluster",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1428,6 +1569,7 @@ const docTemplate = `{
"[Infra resource] Cluster management"
],
"summary": "Create Cluster",
"operationId": "PostCluster",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1489,6 +1631,7 @@ const docTemplate = `{
"[Infra resource] Cluster management"
],
"summary": "Delete all Clusters",
"operationId": "DeleteAllCluster",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1535,6 +1678,7 @@ const docTemplate = `{
"[Infra resource] Cluster management"
],
"summary": "Get Cluster",
"operationId": "GetCluster",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1586,6 +1730,7 @@ const docTemplate = `{
"[Infra resource] Cluster management"
],
"summary": "Delete Cluster",
"operationId": "DeleteCluster",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1632,6 +1777,7 @@ const docTemplate = `{
"[Infra resource] Cluster management"
],
"summary": "Add a NodeGroup",
"operationId": "PostNodeGroup",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1693,6 +1839,7 @@ const docTemplate = `{
"[Infra resource] Cluster management"
],
"summary": "Remove a NodeGroup",
"operationId": "DeleteNodeGroup",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1746,6 +1893,7 @@ const docTemplate = `{
"[Infra resource] Cluster management"
],
"summary": "Change a NodeGroup's Autoscale Size",
"operationId": "PutChangeAutoscaleSize",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1805,6 +1953,7 @@ const docTemplate = `{
"[Infra resource] Cluster management"
],
"summary": "Set a NodeGroup's Autoscaling On/Off",
"operationId": "PutSetAutoscaling",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1864,6 +2013,7 @@ const docTemplate = `{
"[Infra resource] Cluster management"
],
"summary": "Upgrade a Cluster's version",
"operationId": "PutClusterUpgrade",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -8771,6 +8921,141 @@ const docTemplate = `{
"common.JSONResult": {
"type": "object"
},
"common.K8sClusterDetail": {
"type": "object",
"properties": {
"node_images": {
"type": "array",
"items": {
"$ref": "#/definitions/common.K8sClusterNodeImageDetail"
}
},
"nodegroups_with_cluster": {
"type": "boolean"
},
"root_disks": {
"type": "array",
"items": {
"$ref": "#/definitions/common.K8sClusterRootDiskDetail"
}
},
"versions": {
"type": "array",
"items": {
"$ref": "#/definitions/common.K8sClusterVersionDetail"
}
}
}
},
"common.K8sClusterInfo": {
"type": "object",
"properties": {
"k8s_cluster": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/common.K8sClusterDetail"
}
}
}
},
"common.K8sClusterNodeImageDetail": {
"type": "object",
"properties": {
"availables": {
"type": "array",
"items": {
"$ref": "#/definitions/common.K8sClusterNodeImageDetailAvailable"
}
},
"region": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"common.K8sClusterNodeImageDetailAvailable": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"common.K8sClusterRootDiskDetail": {
"type": "object",
"properties": {
"region": {
"type": "array",
"items": {
"type": "string"
}
},
"size": {
"$ref": "#/definitions/common.K8sClusterRootDiskDetailSize"
},
"type": {
"type": "array",
"items": {
"$ref": "#/definitions/common.K8sClusterRootDiskDetailType"
}
}
}
},
"common.K8sClusterRootDiskDetailSize": {
"type": "object",
"properties": {
"max": {
"type": "integer"
},
"min": {
"type": "integer"
}
}
},
"common.K8sClusterRootDiskDetailType": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"common.K8sClusterVersionDetail": {
"type": "object",
"properties": {
"availables": {
"type": "array",
"items": {
"$ref": "#/definitions/common.K8sClusterVersionDetailAvailable"
}
},
"region": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"common.K8sClusterVersionDetailAvailable": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"common.KeyValue": {
"type": "object",
"properties": {
Expand Down
Loading

0 comments on commit 7e1f193

Please sign in to comment.