diff --git a/go.work.sum b/go.work.sum index 5c173908..b942eed3 100644 --- a/go.work.sum +++ b/go.work.sum @@ -472,7 +472,6 @@ github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kX github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo= github.com/gorilla/sessions v1.3.0 h1:XYlkq7KcpOB2ZhHBPv5WpjMIxrQosiZanfoy1HLZFzg= github.com/gorilla/sessions v1.3.0/go.mod h1:ePLdVu+jbEgHH+KWw8I1z2wqd0BAdAQh/8LRvBeoNcQ= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w= @@ -483,6 +482,8 @@ github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjh github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= +github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= +github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= github.com/jackc/pgconn v1.14.3 h1:bVoTr12EGANZz66nZPkMInAV/KHD2TxH9npjXXgiB3w= @@ -572,8 +573,6 @@ golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= @@ -581,24 +580,21 @@ golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= +golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= +golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= -golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= diff --git a/src/api/rest/docs/docs.go b/src/api/rest/docs/docs.go index d1622005..c48ca141 100644 --- a/src/api/rest/docs/docs.go +++ b/src/api/rest/docs/docs.go @@ -2053,6 +2053,97 @@ const docTemplate = `{ } } }, + "/ns/{nsId}/cmd/k8sCluster/{k8sClusterId}": { + "post": { + "description": "Send a command to specified Container in K8sCluster\n[note] This feature is not intended for general use\nThis API is provided as an exceptional and limited function for specific purposes such as migration.\nKubernetes resource information required as input for this API is not currently provided, and its availability in the future is uncertain.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[Kubernetes] Cluster's Container Remote Command" + ], + "summary": "Send a command to specified Container in K8sCluster", + "operationId": "PostCmdK8sCluster", + "parameters": [ + { + "type": "string", + "default": "default", + "description": "Namespace ID", + "name": "nsId", + "in": "path", + "required": true + }, + { + "type": "string", + "default": "k8scluster01", + "description": "K8sCluster ID", + "name": "k8sClusterId", + "in": "path", + "required": true + }, + { + "type": "string", + "default": "mynamespace", + "description": "Namespace in K8sCluster to apply the command", + "name": "k8sClusterNamespace", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "mypod", + "description": "Pod Name in K8sCluster to apply the command", + "name": "k8sClusterPodName", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "Container Name in K8sCluster to apply the command", + "name": "k8sClusterContainerName", + "in": "query" + }, + { + "description": "K8sCluster's Container Command Request", + "name": "k8sClusterContainerCmdReq", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/model.TbK8sClusterContainerCmdReq" + } + }, + { + "type": "string", + "description": "Custom request ID", + "name": "x-request-id", + "in": "header" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/model.TbK8sClusterContainerCmdResult" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + } + } + } + }, "/ns/{nsId}/cmd/mci/{mciId}": { "post": { "description": "Send a command to specified MCI", @@ -3023,7 +3114,7 @@ const docTemplate = `{ }, { "type": "string", - "default": "nodegroup01", + "default": "k8snodegroup01", "description": "K8sNodeGroup Name", "name": "k8sNodeGroupName", "in": "path", @@ -3094,7 +3185,7 @@ const docTemplate = `{ }, { "type": "string", - "default": "nodegroup01", + "default": "k8snodegroup01", "description": "K8sNodeGroup Name", "name": "k8sNodeGroupName", "in": "path", @@ -14026,6 +14117,47 @@ const docTemplate = `{ } } }, + "model.TbK8sClusterContainerCmdReq": { + "type": "object", + "required": [ + "command" + ], + "properties": { + "command": { + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "echo hello" + ] + } + } + }, + "model.TbK8sClusterContainerCmdResult": { + "type": "object", + "properties": { + "command": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "err": {}, + "stderr": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "stdout": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, "model.TbK8sClusterDynamicReq": { "type": "object", "required": [ @@ -14078,12 +14210,12 @@ const docTemplate = `{ "name": { "description": "K8sCluster name if it is not empty.", "type": "string", - "example": "k8scluster-01" + "example": "k8scluster01" }, "nodeGroupName": { "description": "NodeGroup name if it is not empty", "type": "string", - "example": "k8snodegroup-01" + "example": "k8snodegroup01" }, "onAutoScaling": { "type": "string", @@ -14144,7 +14276,7 @@ const docTemplate = `{ "id": { "description": "Id is unique identifier for the object, same as Name", "type": "string", - "example": "k8scluster-01" + "example": "k8scluster01" }, "label": { "description": "Label is for describing the object by keywords", @@ -14156,7 +14288,7 @@ const docTemplate = `{ "name": { "description": "Name is human-readable string to represent the object", "type": "string", - "example": "k8scluster-01" + "example": "k8scluster01" }, "resourceType": { "description": "ResourceType is the type of the resource", @@ -14220,7 +14352,7 @@ const docTemplate = `{ "name": { "description": "(1) K8sCluster Info", "type": "string", - "example": "k8scluster-01" + "example": "k8scluster01" }, "securityGroupIds": { "type": "array", @@ -14303,7 +14435,7 @@ const docTemplate = `{ "name": { "description": "K8sNodeGroup name if it is not empty.", "type": "string", - "example": "k8snodegroup-01" + "example": "k8snodegroup01" }, "onAutoScaling": { "type": "string", @@ -14396,7 +14528,7 @@ const docTemplate = `{ }, "name": { "type": "string", - "example": "k8snodegroup-01" + "example": "k8snodegroup01" }, "onAutoScaling": { "description": "autoscale config.", diff --git a/src/api/rest/docs/swagger.json b/src/api/rest/docs/swagger.json index 15a35ff6..a997e760 100644 --- a/src/api/rest/docs/swagger.json +++ b/src/api/rest/docs/swagger.json @@ -2046,6 +2046,97 @@ } } }, + "/ns/{nsId}/cmd/k8sCluster/{k8sClusterId}": { + "post": { + "description": "Send a command to specified Container in K8sCluster\n[note] This feature is not intended for general use\nThis API is provided as an exceptional and limited function for specific purposes such as migration.\nKubernetes resource information required as input for this API is not currently provided, and its availability in the future is uncertain.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[Kubernetes] Cluster's Container Remote Command" + ], + "summary": "Send a command to specified Container in K8sCluster", + "operationId": "PostCmdK8sCluster", + "parameters": [ + { + "type": "string", + "default": "default", + "description": "Namespace ID", + "name": "nsId", + "in": "path", + "required": true + }, + { + "type": "string", + "default": "k8scluster01", + "description": "K8sCluster ID", + "name": "k8sClusterId", + "in": "path", + "required": true + }, + { + "type": "string", + "default": "mynamespace", + "description": "Namespace in K8sCluster to apply the command", + "name": "k8sClusterNamespace", + "in": "query", + "required": true + }, + { + "type": "string", + "default": "mypod", + "description": "Pod Name in K8sCluster to apply the command", + "name": "k8sClusterPodName", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "Container Name in K8sCluster to apply the command", + "name": "k8sClusterContainerName", + "in": "query" + }, + { + "description": "K8sCluster's Container Command Request", + "name": "k8sClusterContainerCmdReq", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/model.TbK8sClusterContainerCmdReq" + } + }, + { + "type": "string", + "description": "Custom request ID", + "name": "x-request-id", + "in": "header" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/model.TbK8sClusterContainerCmdResult" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/model.SimpleMsg" + } + } + } + } + }, "/ns/{nsId}/cmd/mci/{mciId}": { "post": { "description": "Send a command to specified MCI", @@ -3016,7 +3107,7 @@ }, { "type": "string", - "default": "nodegroup01", + "default": "k8snodegroup01", "description": "K8sNodeGroup Name", "name": "k8sNodeGroupName", "in": "path", @@ -3087,7 +3178,7 @@ }, { "type": "string", - "default": "nodegroup01", + "default": "k8snodegroup01", "description": "K8sNodeGroup Name", "name": "k8sNodeGroupName", "in": "path", @@ -14019,6 +14110,47 @@ } } }, + "model.TbK8sClusterContainerCmdReq": { + "type": "object", + "required": [ + "command" + ], + "properties": { + "command": { + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "echo hello" + ] + } + } + }, + "model.TbK8sClusterContainerCmdResult": { + "type": "object", + "properties": { + "command": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "err": {}, + "stderr": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "stdout": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, "model.TbK8sClusterDynamicReq": { "type": "object", "required": [ @@ -14071,12 +14203,12 @@ "name": { "description": "K8sCluster name if it is not empty.", "type": "string", - "example": "k8scluster-01" + "example": "k8scluster01" }, "nodeGroupName": { "description": "NodeGroup name if it is not empty", "type": "string", - "example": "k8snodegroup-01" + "example": "k8snodegroup01" }, "onAutoScaling": { "type": "string", @@ -14137,7 +14269,7 @@ "id": { "description": "Id is unique identifier for the object, same as Name", "type": "string", - "example": "k8scluster-01" + "example": "k8scluster01" }, "label": { "description": "Label is for describing the object by keywords", @@ -14149,7 +14281,7 @@ "name": { "description": "Name is human-readable string to represent the object", "type": "string", - "example": "k8scluster-01" + "example": "k8scluster01" }, "resourceType": { "description": "ResourceType is the type of the resource", @@ -14213,7 +14345,7 @@ "name": { "description": "(1) K8sCluster Info", "type": "string", - "example": "k8scluster-01" + "example": "k8scluster01" }, "securityGroupIds": { "type": "array", @@ -14296,7 +14428,7 @@ "name": { "description": "K8sNodeGroup name if it is not empty.", "type": "string", - "example": "k8snodegroup-01" + "example": "k8snodegroup01" }, "onAutoScaling": { "type": "string", @@ -14389,7 +14521,7 @@ }, "name": { "type": "string", - "example": "k8snodegroup-01" + "example": "k8snodegroup01" }, "onAutoScaling": { "description": "autoscale config.", diff --git a/src/api/rest/docs/swagger.yaml b/src/api/rest/docs/swagger.yaml index 48b9a8d2..4f40c550 100644 --- a/src/api/rest/docs/swagger.yaml +++ b/src/api/rest/docs/swagger.yaml @@ -1531,6 +1531,83 @@ paths: application/json: schema: $ref: '#/components/schemas/model.SimpleMsg' + /ns/{nsId}/cmd/k8sCluster/{k8sClusterId}: + post: + tags: + - "[Kubernetes] Cluster's Container Remote Command" + summary: Send a command to specified Container in K8sCluster + description: |- + Send a command to specified Container in K8sCluster + [note] This feature is not intended for general use + This API is provided as an exceptional and limited function for specific purposes such as migration. + Kubernetes resource information required as input for this API is not currently provided, and its availability in the future is uncertain. + operationId: PostCmdK8sCluster + 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: k8scluster01 + - name: k8sClusterNamespace + in: query + description: Namespace in K8sCluster to apply the command + required: true + schema: + type: string + default: mynamespace + - name: k8sClusterPodName + in: query + description: Pod Name in K8sCluster to apply the command + required: true + schema: + type: string + default: mypod + - name: k8sClusterContainerName + in: query + description: Container Name in K8sCluster to apply the command + schema: + type: string + - name: x-request-id + in: header + description: Custom request ID + schema: + type: string + requestBody: + description: K8sCluster's Container Command Request + content: + application/json: + schema: + $ref: '#/components/schemas/model.TbK8sClusterContainerCmdReq' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/model.TbK8sClusterContainerCmdResult' + "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: k8sClusterContainerCmdReq /ns/{nsId}/cmd/mci/{mciId}: post: tags: @@ -2276,7 +2353,7 @@ paths: required: true schema: type: string - default: nodegroup01 + default: k8snodegroup01 requestBody: description: Details of the TbChangeK8sNodeGroupAutoscaleSizeReq object content: @@ -2332,7 +2409,7 @@ paths: required: true schema: type: string - default: nodegroup01 + default: k8snodegroup01 requestBody: description: Details of the TbSetK8sNodeGroupAutoscalingReq object content: @@ -10498,6 +10575,34 @@ components: type: string name: type: string + model.TbK8sClusterContainerCmdReq: + required: + - command + type: object + properties: + command: + type: array + example: + - echo hello + items: + type: string + model.TbK8sClusterContainerCmdResult: + type: object + properties: + command: + type: object + additionalProperties: + type: string + err: + type: object + stderr: + type: object + additionalProperties: + type: string + stdout: + type: object + additionalProperties: + type: string model.TbK8sClusterDynamicReq: required: - commonImage @@ -10542,11 +10647,11 @@ components: name: type: string description: K8sCluster name if it is not empty. - example: k8scluster-01 + example: k8scluster01 nodeGroupName: type: string description: NodeGroup name if it is not empty - example: k8snodegroup-01 + example: k8snodegroup01 onAutoScaling: type: string example: "true" @@ -10597,7 +10702,7 @@ components: id: type: string description: "Id is unique identifier for the object, same as Name" - example: k8scluster-01 + example: k8scluster01 label: type: object additionalProperties: @@ -10606,7 +10711,7 @@ components: name: type: string description: Name is human-readable string to represent the object - example: k8scluster-01 + example: k8scluster01 resourceType: type: string description: ResourceType is the type of the resource @@ -10660,7 +10765,7 @@ components: name: type: string description: (1) K8sCluster Info - example: k8scluster-01 + example: k8scluster01 securityGroupIds: type: array example: @@ -10723,7 +10828,7 @@ components: name: type: string description: K8sNodeGroup name if it is not empty. - example: k8snodegroup-01 + example: k8snodegroup01 onAutoScaling: type: string example: "true" @@ -10799,7 +10904,7 @@ components: example: "1" name: type: string - example: k8snodegroup-01 + example: k8snodegroup01 onAutoScaling: type: string description: autoscale config.