Skip to content
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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

apodhrad
Copy link

Signed-off-by: Andrej Podhradsky [email protected]

@jyejare
Copy link
Collaborator

jyejare commented Jun 14, 2022

@apodhrad Since the PR is WIP making it as a Draft !

@jyejare jyejare marked this pull request as draft June 14, 2022 11:20
@jyejare
Copy link
Collaborator

jyejare commented Jun 24, 2022

@apodhrad Please rebase your PR with new merged PR #24 and other conflicts !

Copy link
Collaborator

@jyejare jyejare left a 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/cli.py Show resolved Hide resolved
cloudwash/providers/ec2.py Outdated Show resolved Hide resolved
cloudwash/providers/ec2.py Outdated Show resolved Hide resolved
cloudwash/providers/ec2.py Outdated Show resolved Hide resolved

def delete_ocp(ocp_name):
Copy link
Collaborator

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.

Comment on lines 25 to 44
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)
Copy link
Collaborator

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.

Copy link
Author

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?

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):
Copy link
Collaborator

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/providers/ec2.py Outdated Show resolved Hide resolved
@@ -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': []}}
Copy link
Collaborator

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 ?

@@ -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):
Copy link
Collaborator

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 !

@jyejare
Copy link
Collaborator

jyejare commented Jul 18, 2022

Ping @apodhrad !

@apodhrad apodhrad force-pushed the delete_ocps_ec2 branch 2 times, most recently from 2f1c7e1 to 8670743 Compare July 25, 2022 14:34
@jyejare
Copy link
Collaborator

jyejare commented Jul 26, 2022

@apodhrad If its ready, please remove WIP and Draft state !

@apodhrad
Copy link
Author

not ready...I still need to finish some changes and test it

Signed-off-by: Andrej Podhradsky <[email protected]>
@apodhrad
Copy link
Author

Now, waiting until the wrapanapi's PR is merged
RedHatQE/wrapanapi#455

@jyejare
Copy link
Collaborator

jyejare commented Sep 15, 2022

@apodhrad I have pinged you there as the wrapanapi PR is waiting to update from long time.

@jyejare
Copy link
Collaborator

jyejare commented Jan 23, 2023

Ping @apodhrad , Are you willing to continue on it ?

@ntkathole
Copy link
Collaborator

@ogajduse ^

@oharan2
Copy link
Contributor

oharan2 commented Jun 2, 2024

Can be closed, followed with #134

@oharan2
Copy link
Contributor

oharan2 commented Jun 2, 2024

Good chunk of this PR should go into https://github.com/RedHatQE/wrapanapi for OCP resource identification and deletion.

@jyejare Ack on this review, will be resolved in #134. Thanks

@jyejare
Copy link
Collaborator

jyejare commented Jun 2, 2024

@oharan2 Do you wish to close this PR now since #134 is arrived ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants