-
Notifications
You must be signed in to change notification settings - Fork 2
feat(core): auto-cleanup for dvcr storage #1633
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
Draft
diafour
wants to merge
9
commits into
main
Choose a base branch
from
feat/core/dvcr-autocleanup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
Contributor
Reviewer's GuideThis PR implements an auto-cleanup feature for DVCR storage by introducing a maintenance mode toggled via a Kubernetes Secret, refactoring the CronSource to enqueue cleanup jobs independently, extending the dvcr-cleaner tool with new run and check commands, and updating Helm charts and module configuration to support scheduled cleanup and read‐only maintenance. ER diagram for DVCR auto-cleanup eligible imageserDiagram
ClusterVirtualImage {
string name
}
VirtualImage {
string namespace
string name
}
VirtualDisk {
string namespace
string name
string phase
}
RegistryImage {
string type
string namespace
string name
string path
}
ClusterVirtualImage ||--o| RegistryImage : "has image"
VirtualImage ||--o| RegistryImage : "has image"
VirtualDisk ||--o| RegistryImage : "has image"
Class diagram for CronSource and ObjectLister refactorclassDiagram
class CronSource {
- schedule: cron.Schedule
- objLister: ObjectLister
- log: *log.Logger
- clock: clock.Clock
+ Start(ctx, queue)
+ enqueueObjects(ctx, queueAddFunc)
}
class ObjectLister {
+ List(ctx, now): []client.Object
}
class ObjectListerImpl {
- ListFunc: func(ctx, now) ([]client.Object, error)
+ List(ctx, now): []client.Object
}
CronSource --> ObjectLister
ObjectLister <|-- ObjectListerImpl
Class diagram for dvcr-cleaner auto-cleanup commandsclassDiagram
class AutoCleanupCmd {
+ run
+ check
}
class autoCleanupRunCmd {
+ autoCleanupRun(cmd, args)
}
class autoCleanupCheckCmd {
+ autoCleanupCheck(cmd, args)
}
class registry {
+ RemoveImages(images)
+ ExecGarbageCollect()
+ StorageStats()
+ ListImagesAll()
}
class kubernetes {
+ NewVirtualizationClient()
+ ListAllPossibleImages(ctx)
}
AutoCleanupCmd --> autoCleanupRunCmd
AutoCleanupCmd --> autoCleanupCheckCmd
autoCleanupRunCmd --> registry
autoCleanupCheckCmd --> registry
autoCleanupRunCmd --> kubernetes
autoCleanupCheckCmd --> kubernetes
Class diagram for DVCR maintenance controller and handlersclassDiagram
class Reconciler {
- handlers: []Handler
- client: client.Client
+ Reconcile(ctx, req)
+ SetupController(ctx, mgr, ctr)
}
class Handler {
+ Handle(ctx, deploy)
}
class LifeCycleHandler {
- client: client.Client
+ Handle(ctx, deploy)
}
class Watcher {
+ Watch(mgr, ctr)
}
class DVCRDeploymentWatcher {
- client: client.Client
+ Watch(mgr, ctr)
}
class CronWatcher {
+ Watch(mgr, ctr)
}
Reconciler --> Handler
Handler <|-- LifeCycleHandler
Reconciler --> Watcher
Watcher <|-- DVCRDeploymentWatcher
Watcher <|-- CronWatcher
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
fd87859 to
d4a5cb2
Compare
- Add maintenance mode for DVCR Deployment. - Add auto-cleanup schedule setting in ModuleConfig. - Add 'auto-cleanup check' command to dvcr-cleaner to get all images eligible for cleanup. Internals: - Add hook to switch DVCR into maintenance mode depending on Secret created by controller. - Refactor cron source, make it independent on gc manager. Start maintenance mode by cron source. - Add condition on Deployment/dvcr to get maintenance mode state, e.g. auto-cleanup state. - Maintenance mode keep dvcr in RO mode, so VM with mounted images should able to reboot. - Also, postpone importer and uploader Pods creation for new cvi/vi/vd until auto-cleanup finishes. Signed-off-by: Ivan Mikheykin <[email protected]>
9edd70c to
e38efc3
Compare
Signed-off-by: Ivan Mikheykin <[email protected]>
++ add mount for config so gc works Signed-off-by: Ivan Mikheykin <[email protected]>
Signed-off-by: Ivan Mikheykin <[email protected]>
Signed-off-by: Ivan Mikheykin <[email protected]>
Signed-off-by: Ivan Mikheykin <[email protected]>
Signed-off-by: Ivan Mikheykin <[email protected]>
Signed-off-by: Ivan Mikheykin <[email protected]>
Signed-off-by: Ivan Mikheykin <[email protected]>
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.
Description
Internals:
Why do we need it, and what problem does it solve?
ClusterVirtualImage/VirtualImage/VirtualDisk deletion in cluster should free space on DVCR storage.
What is the expected result?
Checklist
Changelog entries