-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Add support for deleting OCP clusters #18
base: master
Are you sure you want to change the base?
Conversation
@apodhrad Since the PR is WIP making it as a Draft ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good chunk of this PR should go into https://github.com/RedHatQE/wrapanapi for OCP resource identification and deletion.
cloudwash/providers/ec2.py
Outdated
|
||
def delete_ocp(ocp_name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -6,7 +6,7 @@ | |||
import pytz | |||
|
|||
_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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to rename OCPS
with OC_CLUSTERS
?
cloudwash/utils.py
Outdated
@@ -81,3 +84,11 @@ def gce_zones() -> list: | |||
_zones_combo = {**_bcds, **_abcfs, **_abcs} | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
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 |
Signed-off-by: Andrej Podhradsky [email protected]