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

Implement garbage collection action #1374

Conversation

lburgazzoli
Copy link
Contributor

@lburgazzoli lburgazzoli commented Nov 15, 2024

Signed-off-by: Luca Burgazzoli lburgazzoli@gmail.com

Description

https://issues.redhat.com/browse/RHOAIENG-15183

How Has This Been Tested?

Screenshot or short clip

Merge criteria

  • You have read the contributors guide.
  • Commit messages are meaningful - have a clear and concise summary and detailed explanation of what was changed and why.
  • Pull Request contains a description of the solution, a link to the JIRA issue, and to any dependent or related Pull Request.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

@openshift-ci openshift-ci bot requested review from CFSNM and lphiri November 15, 2024 15:48
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 29.42779% with 259 lines in your changes missing coverage. Please review.

Please upload report for BASE (feature-operator-refactor@74b3e85). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pkg/services/gc/gc.go 0.00% 204 Missing ⚠️
pkg/controller/actions/gc/action_gc.go 70.51% 18 Missing and 5 partials ⚠️
pkg/services/gc/gc_support.go 34.28% 23 Missing ⚠️
pkg/controller/actions/gc/action_gc_support.go 72.72% 4 Missing and 2 partials ⚠️
pkg/controller/actions/deploy/action_deploy.go 76.92% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@                     Coverage Diff                      @@
##             feature-operator-refactor    #1374   +/-   ##
============================================================
  Coverage                             ?   26.85%           
============================================================
  Files                                ?       60           
  Lines                                ?     4782           
  Branches                             ?        0           
============================================================
  Hits                                 ?     1284           
  Misses                               ?     3349           
  Partials                             ?      149           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

)

// TODO: this singleton must be removed.
var Instance *GC
Copy link
Member

Choose a reason for hiding this comment

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

Can this eventually be a struct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is actually a struct, I've removed the global Run method and added some better comments

main.go Show resolved Hide resolved
pkg/services/gc/gc.go Show resolved Hide resolved
main.go Show resolved Hide resolved
@lburgazzoli lburgazzoli force-pushed the RHOAIENG-15183-gc branch 2 times, most recently from 3f6dda1 to eb3b863 Compare November 20, 2024 11:08
@lburgazzoli lburgazzoli requested review from zdtsw and removed request for lphiri and CFSNM November 20, 2024 11:09
Comment on lines +80 to +83
if !rr.Generated {
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

so this is saying:
even component CR gets deleted by human, after it gets recreated, since we have cache, rr.Generated = true wont be called, thus this run() will get fast return nil

Copy link
Contributor Author

@lburgazzoli lburgazzoli Nov 20, 2024

Choose a reason for hiding this comment

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

Not sure if I got it right, but in the case of the component CR being re-created, the rr.Generated == true, because the rendering task takes into account also the CR's UID when computing the hash, so the gc task would kicks in.

pkg/controller/actions/render/render_support.go Outdated Show resolved Hide resolved
pkg/services/gc/gc_support.go Show resolved Hide resolved
Signed-off-by: Luca Burgazzoli <lburgazzoli@gmail.com>
Copy link

openshift-ci bot commented Nov 21, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zdtsw

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

@openshift-merge-bot openshift-merge-bot bot merged commit d748e02 into opendatahub-io:feature-operator-refactor Nov 21, 2024
10 checks passed
@lburgazzoli lburgazzoli deleted the RHOAIENG-15183-gc branch November 21, 2024 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants