-
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
Conversation
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
|
9edd70c to
e38efc3
Compare
e4e64f1 to
a59afc3
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 <ivan.mikheykin@flant.com>
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
++ add mount for config so gc works Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
…nance Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
a92568b to
4be9c59
Compare
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
|
Superseded by #1688. |
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