-
Notifications
You must be signed in to change notification settings - Fork 2
feat(images): add DVCR image presence monitoring #1622
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Daniil Loktev <[email protected]>
Reviewer's GuideIntroduces a periodic DVCR image presence monitor for VirtualImage and ClusterVirtualImage using the existing GC framework and minimal API surface changes. Sequence diagram for periodic DVCR image presence monitoringsequenceDiagram
participant CronScheduler
participant ImageMonitorManager
participant DVCRRegistry
participant K8sAPI
CronScheduler->>ImageMonitorManager: Trigger ListForDelete()
ImageMonitorManager->>K8sAPI: List VirtualImage/ClusterVirtualImage
loop For each Ready image
ImageMonitorManager->>DVCRRegistry: CheckImageExists(registryURL)
alt Image exists
ImageMonitorManager-->>CronScheduler: No action
else Image missing
ImageMonitorManager->>K8sAPI: Update Status.Phase to ImageLost
ImageMonitorManager->>K8sAPI: Set Condition Reason=ImageLost
end
end
ER diagram for updated VirtualImage and ClusterVirtualImage status phaseserDiagram
VIRTUALIMAGE {
string id
ImagePhase phase
string progress
string registry_url
}
CLUSTERVIRTUALIMAGE {
string id
ImagePhase phase
string progress
string registry_url
}
IMAGEPHASE {
string name
}
VIRTUALIMAGE ||--o| IMAGEPHASE : "has phase"
CLUSTERVIRTUALIMAGE ||--o| IMAGEPHASE : "has phase"
IMAGEPHASE {
Pending
Provisioning
WaitForUserUpload
Ready
Failed
Terminating
ImageLost
PVCLost
}
Class diagram for DVCR image presence monitoringclassDiagram
class VirtualImage {
+Status: VirtualImageStatus
+Spec: VirtualImageSpec
}
class ClusterVirtualImage {
+Status: ClusterVirtualImageStatus
+Spec: ClusterVirtualImageSpec
}
class VirtualImageStatus {
+Phase: ImagePhase
+Progress: string
+Conditions: []Condition
+Target: TargetInfo
}
class ClusterVirtualImageStatus {
+Phase: ImagePhase
+Progress: string
+Conditions: []Condition
+Target: TargetInfo
}
class ImagePhase {
<<enum>>
Pending
Provisioning
WaitForUserUpload
Ready
Failed
Terminating
ImageLost
PVCLost
}
class ImageMonitorManager {
+client: Client
+dvcrSettings: DVCRSettings
+New()
+ShouldBeDeleted(obj)
+ListForDelete(ctx, now)
+checkImage(ctx, registryURL)
+markImageLost(ctx, obj, registryURL)
+getAuthCredentials(ctx)
}
class DVCRSettings {
+AuthSecret: string
+AuthSecretNamespace: string
+InsecureTLS: string
}
class ImageChecker {
<<interface>>
+CheckImageExists(ctx, imageURL)
}
class DefaultImageChecker {
+username: string
+password: string
+insecure: bool
+CheckImageExists(ctx, imageURL)
}
VirtualImageStatus --> ImagePhase
ClusterVirtualImageStatus --> ImagePhase
ImageMonitorManager --> DVCRSettings
ImageMonitorManager --> ImageChecker
DefaultImageChecker ..|> ImageChecker
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `images/virtualization-artifact/pkg/dvcr/checker.go:126-127` </location>
<code_context>
+ contains(errStr, "404")
+}
+
+// contains checks if a string contains a substring (case-insensitive helper).
+func contains(s, substr string) bool {
+ return len(s) >= len(substr) && (s == substr || containsHelper(s, substr))
+}
</code_context>
<issue_to_address>
**suggestion:** Use strings.Contains for substring checks instead of custom implementation.
Refactor the 'contains' and 'containsHelper' functions to use 'strings.Contains' for improved readability and reliability.
Suggested implementation:
```golang
import "strings"
// contains checks if a string contains a substring.
func contains(s, substr string) bool {
return strings.Contains(s, substr)
}
```
If there is a `containsHelper` function elsewhere in the file, it should be removed as it is no longer needed.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
…e-presence-monitoring
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
|
Workflow has started. The target step completed with status: failure. |
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
|
Workflow has started. The target step completed with status: failure. |
Description
Implements periodic monitoring of DVCR (Deckhouse Virtualization Container Registry) image presence for
VirtualImageandClusterVirtualImageresources.Key components:
Why do we need it, and what problem does it solve?
When images are deleted from DVCR (either manually or due to storage issues), the VirtualImage/ClusterVirtualImage resources continue to show Ready phase even though the underlying image data is gone. This creates a misleading state where users think images are available but VM creation fails.
This feature provides automated detection of missing images and updates resource status accordingly, giving users accurate visibility into image availability.
What is the expected result?
Checklist
Changelog entries