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

common-instancetypes: Ensure CRDs are present before Cleanup #467

Merged

Conversation

lyarwood
Copy link
Member

What this PR does / why we need it:

This change ensure the VirtualMachineCluster{Instancetype,Preference} CRDs are present before attempting to cleanup resources from the cluster. This is required as operators such as HCO remove dependent projects such as KubeVirt and the SSP operator in parallel thus cleanup must be resilient to the CRDs already being removed.

Which issue(s) this PR fixes:

Fixes #466

Special notes for your reviewer:

Release note:

NONE

This change ensure the VirtualMachineCluster{Instancetype,Preference}
CRDs are present before attempting to cleanup resources from the
cluster. This is required as operators such as HCO remove dependent
projects such as KubeVirt and the SSP operator in parallel thus cleanup
must be resilient to the CRDs already being removed.

Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Dec 13, 2022
@sonarcloud
Copy link

sonarcloud bot commented Dec 13, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@0xFelix 0xFelix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but I wonder if common.Cleanup should also be changed? It ignores not found errors, but it could also ignore unknown errors? (When a CRD is deleted all CRs are deleted as well)

See:

if errors.IsNotFound(err) {

Giving you a chance to comment on this.

/approve
/lgtm
/hold

@kubevirt-bot kubevirt-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 14, 2022
@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 14, 2022
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 0xFelix

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 14, 2022
@0xFelix
Copy link
Member

0xFelix commented Dec 14, 2022

/retest

1 similar comment
@0xFelix
Copy link
Member

0xFelix commented Dec 14, 2022

/retest

@lyarwood
Copy link
Member Author

Looks good to me, but I wonder if common.Cleanup should also be changed? It ignores not found errors, but it could also ignore unknown errors? (When a CRD is deleted all CRs are deleted as well)

See:

if errors.IsNotFound(err) {

Giving you a chance to comment on this.

/approve /lgtm /hold

/hold cancel

Thanks @0xFelix, lets land the fix as is for now and follow up with @akrejcir in the new year about taking that approach as it will impact a few operands.

@kubevirt-bot kubevirt-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 14, 2022
@lyarwood
Copy link
Member Author

/retest

1 similar comment
@lyarwood
Copy link
Member Author

/retest

lyarwood added a commit to lyarwood/ssp-operator that referenced this pull request Dec 14, 2022
A quick follow up to kubevirt#467 to provide functional test coverage of the
behaviour through some existing but previously missed cleanup tests.

Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
@lyarwood
Copy link
Member Author

/retest-required

lyarwood added a commit to lyarwood/ssp-operator that referenced this pull request Dec 14, 2022
A quick follow up to kubevirt#467 to provide functional test coverage of the
behaviour through some existing but previously missed cleanup tests.

Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
@lyarwood
Copy link
Member Author

/hold

@kubevirt-bot kubevirt-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 14, 2022
@lyarwood
Copy link
Member Author

/hold cancel

@kubevirt-bot kubevirt-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 14, 2022
@lyarwood
Copy link
Member Author

/retest-required

@kubevirt-bot kubevirt-bot merged commit 87e8b74 into kubevirt:master Dec 14, 2022
lyarwood added a commit to lyarwood/ssp-operator that referenced this pull request Dec 14, 2022
A quick follow up to kubevirt#467 to provide functional test coverage of the
behaviour through some existing but previously missed cleanup tests.

Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

common-instancetypes unable to cleanup if CRDs removed first
3 participants