Implement OCP cluster cleanup using openshift-install#179
Open
jyejare wants to merge 1 commit into
Open
Conversation
Replace the dry-run-only OCP stub with a full cleanup implementation that uses the openshift-install CLI to destroy leftover OCP clusters on AWS, addressing review feedback from PR RedHatQE#166. - Add LeftoverAWSOcp class to model cluster resources and metadata - Add destroy_ocp_cluster/write_metadata_file/check_installer_exists utils - Support OCP exceptions in config for cluster exclusion - Move OCP constants to constants.py, remove dead code from utils.py - Install openshift-install CLI in Dockerfile.dev Co-authored-by: Cursor <cursoragent@cursor.com>
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 characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements full OCP cluster cleanup on AWS using the
openshift-installCLI, superseding #166. This builds on the work from PR #166 by @oharan2, incorporating all review feedback.LeftoverAWSOcpclass to model cluster resources, extract metadata from AWS resource tags (clusterName,clusterID,infraID), and build themetadata.jsonrequired byopenshift-installopenshift-install destroy clusterfor each deletable clusterOCPS: []inaws.yamlconfig (consistent with VM/Stack exception patterns) instead of interactive--yespromptscheck_installer_exists(),destroy_ocp_cluster(),write_metadata_file()with proper docstrings,pathlibusage, and specific exception handlingfilter_resources_by_time_modified→are_resources_older_than(returnsbool, integrates time threshold calculation)openshift-installCLI under/usr/local/bin/delete_ocpstub, duplicatedgroup_ocps_by_clusterfrom utils)OCP_TAG_SUBSTRand related tag constants toconstants.pyReview feedback addressed from #166:
--yesCLI flag — uses standard exceptions config instead (per @jyejare feedback on automated cleanup)self._deletenaming for consistency with other cleanup classes_deletedict structure for future dry-data standardizationpathlib.Pathused for file operationsSupersedes #166
Test plan
swach -d aws --ocpsin dry mode to verify resource discovery and filteringOCPS: []in configswach aws --ocpswithopenshift-installavailable to confirm cluster destructionDockerfile.devto confirmopenshift-installis availableMade with Cursor