twc icon indicating copy to clipboard operation
twc copied to clipboard

using wrong http method to delete k8s node

Open murtll opened this issue 2 years ago • 0 comments

trying to remove k8s node, getting error

in verbose logs can see lines

"GET /api/v1/k8s/clusters/123/nodes/123 HTTP/1.1" 405 22
405 Method Not Allowed

in api docs method is DELETE, simple curl works

$ twc version
v2.4.1

$ twc k8s node remove --verbose 123 123 
2023-10-04T02:07:06+0300:DEBUG:root:common:get_root_ctx: cli_parser: cmd=<TyperCommand remove>, params={'verbose': True, 'cluster_id': 123, 'node_ids': (123,)}
2023-10-04T02:07:06+0300:DEBUG:root:common:get_root_ctx: cli_parser: cmd=<TyperGroup node>, params={}
2023-10-04T02:07:06+0300:DEBUG:root:common:get_root_ctx: cli_parser: cmd=<TyperGroup k8s>, params={}
2023-10-04T02:07:06+0300:DEBUG:root:common:get_root_ctx: cli_parser: cmd=<TyperGroup root>, params={'version': None, 'verbose': False, 'config': None, 'profile': None}
2023-10-04T02:07:06+0300:DEBUG:root:common:config_callback: cli parser: root lvl: config=None
2023-10-04T02:07:06+0300:DEBUG:root:common:default_config_file: Configuration file found: /Users/murtll/.twcrc
2023-10-04T02:07:06+0300:DEBUG:root:common:get_root_ctx: cli_parser: cmd=<TyperCommand remove>, params={'verbose': True, 'cluster_id': 123, 'node_ids': (123,), 'config': PosixPath('/Users/murtll/.twcrc')}
2023-10-04T02:07:06+0300:DEBUG:root:common:get_root_ctx: cli_parser: cmd=<TyperGroup node>, params={}
2023-10-04T02:07:06+0300:DEBUG:root:common:get_root_ctx: cli_parser: cmd=<TyperGroup k8s>, params={}
2023-10-04T02:07:06+0300:DEBUG:root:common:get_root_ctx: cli_parser: cmd=<TyperGroup root>, params={'version': None, 'verbose': False, 'config': None, 'profile': None}
2023-10-04T02:07:06+0300:DEBUG:root:common:profile_callback: cli parser: root lvl: profile=None
This action cannot be undone. Continue? [y/N]: y
2023-10-04T02:07:08+0300:DEBUG:root:apiwrap:create_client: Config: file=/Users/murtll/.twcrc, profile=default
2023-10-04T02:07:08+0300:DEBUG:api_client:base:_request: Called with args: GET https://api.timeweb.cloud/api/v1/k8s/clusters/123/nodes/123 {'User-Agent': 'TWC-CLI/2.4.1 Python 3.11.5 (main, Aug 24 2023, 15:09:45) [Clang 14.0.3 (clang-1403.0.22.14.1)]', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Authorization': 'Bearer <SENSITIVE_DATA_DELETED>'}
2023-10-04T02:07:08+0300:DEBUG:urllib3.connectionpool:connectionpool:_new_conn: Starting new HTTPS connection (1): api.timeweb.cloud:443
2023-10-04T02:07:10+0300:DEBUG:urllib3.connectionpool:connectionpool:_make_request: https://api.timeweb.cloud:443 "GET /api/v1/k8s/clusters/123/nodes/123 HTTP/1.1" 405 22
2023-10-04T02:07:10+0300:DEBUG:api_client:base:_log_request: 
---------------- Request ----------------
GET https://api.timeweb.cloud/api/v1/k8s/clusters/123/nodes/123
User-Agent: TWC-CLI/2.4.1 Python 3.11.5 (main, Aug 24 2023, 15:09:45) [Clang 14.0.3 (clang-1403.0.22.14.1)]
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Authorization: Bearer <SENSITIVE_DATA_DELETED>

<NO_BODY>
---------------- Response ---------------
405 Method Not Allowed https://api.timeweb.cloud/api/v1/k8s/clusters/123/nodes/123
Server: QRATOR
Date: Tue, 03 Oct 2023 23:07:10 GMT
Content-Type: text/plain
Content-Length: 22
Connection: keep-alive
Keep-Alive: timeout=15
Vary: Origin, Origin
X-Krakend: Version 2.0.6
X-Krakend-Completed: false

405 method not allowed
Error: API returned malformed response: Response have no JSON schema or have invalid JSON syntax.
Try run command with '--verbose' option for details.

$ curl -H "authorization: bearer $TWC_TOKEN" https://api.timeweb.cloud/api/v1/k8s/clusters/123/nodes/123 -X DELETE
$ # this works

murtll avatar Oct 03 '23 23:10 murtll