WIP: Add support for deleting OCP clusters#18
WIP: Add support for deleting OCP clusters#18apodhrad wants to merge 1 commit intoRedHatQE:masterfrom
Conversation
|
@apodhrad Since the PR is WIP making it as a Draft ! |
jyejare
left a comment
There was a problem hiding this comment.
Good chunk of this PR should go into https://github.com/RedHatQE/wrapanapi for OCP resource identification and deletion.
cloudwash/providers/ec2.py
Outdated
| from os.path import exists | ||
| import os | ||
|
|
||
| def delete_ocp(ocp_name): |
There was a problem hiding this comment.
This entire function should go into https://github.com/RedHatQE/wrapanapi as its the cloudwash dependency to play with resources.
cloudwash/providers/ec2.py
Outdated
| wget.download('https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest-4.10/openshift-install-linux.tar.gz') | ||
| tar = tarfile.open('openshift-install-linux.tar.gz', "r:gz") | ||
| tar.extractall() | ||
| tar.close() | ||
| my_env = os.environ.copy() | ||
| my_env["AWS_ACCESS_KEY_ID"] = settings.providers.ec2.username | ||
| my_env["AWS_SECRET_ACCESS_KEY"] = settings.providers.ec2.password | ||
| subprocess.call(['./openshift-install' , 'destroy', 'cluster', '--log-level=debug'], env=my_env) |
There was a problem hiding this comment.
I think there should be APIs available from OCP to do this instead of using openshift-install CLI utility.
There was a problem hiding this comment.
Hi @jyejare what do you mean by "APIs available from OCP"? Unfortunately, using the openshift-install CLI tool is the only one way for uninstalling OCP I know :( Is there any other way?
cloudwash/providers/ec2.py
Outdated
| ocp_name = key[22:] | ||
| #logger.info("ocp_name: " + ocp_name + " but only " + settings.delete_ocp + "* can be deletes") | ||
| discovered = discovery_timestamp(vpc) | ||
| if ocp_name.startswith(settings.delete_ocp): |
There was a problem hiding this comment.
You need to add delete_ocp setting to the settings file. Also understand this means that we will only delete the VMs that startwith settings.delete_ocp. So is that the sufficient criteria for deletion ?
cloudwash/utils.py
Outdated
|
|
||
| _vms_dict = {'VMS': {'delete': [], 'stop': []}} | ||
| dry_data = {'NICS': {'delete': []}, 'DISCS': {'delete': []}, 'PIPS': {'delete': []}} | ||
| dry_data = {'NICS': {'delete': []}, 'DISCS': {'delete': []}, 'PIPS': {'delete': []}, 'OCPS': {'delete': []}} |
There was a problem hiding this comment.
How to rename OCPS with OC_CLUSTERS ?
cloudwash/utils.py
Outdated
| zones = [f'{loc}-{zone}' for loc, zones in _zones_combo.items() for zone in zones] | ||
| return zones | ||
|
|
||
| def discovery_timestamp(resource): |
There was a problem hiding this comment.
This should also be moved to wrapanapi !
|
Ping @apodhrad ! |
2f1c7e1 to
8670743
Compare
|
@apodhrad If its ready, please remove WIP and Draft state ! |
|
not ready...I still need to finish some changes and test it |
Signed-off-by: Andrej Podhradsky <apodhrad@redhat.com>
8670743 to
9ddca14
Compare
|
Now, waiting until the wrapanapi's PR is merged |
|
@apodhrad I have pinged you there as the wrapanapi PR is waiting to update from long time. |
|
Ping @apodhrad , Are you willing to continue on it ? |
|
Can be closed, followed with #134 |
@jyejare Ack on this review, will be resolved in #134. Thanks |
|
@oharan2 You have plans to continue on this one or shall we close this and would you reopen another. |
Signed-off-by: Andrej Podhradsky apodhrad@redhat.com