Created
April 24, 2022 09:26
-
-
Save codebykyle/1c481352c12264fb7da2011aba11c504 to your computer and use it in GitHub Desktop.
Revisions
-
codebykyle created this gist
Apr 24, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ import requests import json namespaces_response = requests.get('http://127.0.0.1:8001/api/v1/namespaces').json() for namespace_item in namespaces_response['items']: if namespace_item['status']['phase'] == 'Terminating': url = 'http://127.0.0.1:8001/api/v1/namespaces/%s' % namespace_item['metadata']['name'] namespace_get_data = requests.get(url).json() updated_body = namespace_get_data updated_body['spec'] = {} updated_body['metadata']['finalizers'] = [] print(updated_body) requests.put(url + '/finalize', json=updated_body) requests.delete(url) response = requests.get(url) print (response)