-
Notifications
You must be signed in to change notification settings - Fork 3
feat(vd): validate sc for vi(pvc) from vd and vd from vi(pvc) #1563
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
Reviewer's GuideThis PR introduces a StorageClassMatchValidator for both VirtualDisk and VirtualImage webhooks, adding logic to fetch the default storage class and ensure that PVC-based resources created via object references share matching storage classes, and it integrates this validator into the respective webhook controllers. Sequence diagram for storage class validation when creating VirtualDisk from VirtualImagesequenceDiagram
participant VDWebhook
participant StorageClassMatchValidator
participant K8sClient
participant VirtualImage
VDWebhook->>StorageClassMatchValidator: ValidateCreate(ctx, vd)
StorageClassMatchValidator->>K8sClient: Fetch VirtualImage by ObjectRef
K8sClient-->>StorageClassMatchValidator: VirtualImage object
StorageClassMatchValidator->>StorageClassMatchValidator: Compare storage classes (VD vs VI)
StorageClassMatchValidator-->>VDWebhook: Return error if mismatch
Class diagram for StorageClassMatchValidator and integration with webhook validatorsclassDiagram
class StorageClassMatchValidator {
+client: Client
+scService: VirtualDiskStorageClassService | VirtualImageStorageClassService
+ValidateCreate(ctx, obj): (Warnings, error)
+ValidateUpdate(ctx, oldObj, newObj): (Warnings, error)
+Validate(ctx, obj): (Warnings, error)
}
class VirtualDiskValidator {
+validators: []Validator
}
class VirtualImageValidator {
+logger: Logger
+client: Client
+scService: VirtualImageStorageClassService
+storageClassMatchValidator: StorageClassMatchValidator
}
StorageClassMatchValidator <|-- VirtualDiskValidator : used by
StorageClassMatchValidator <|-- VirtualImageValidator : used by
VirtualDiskValidator o-- StorageClassMatchValidator
VirtualImageValidator o-- StorageClassMatchValidator
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Signed-off-by: Valeriy Khorunzhin <[email protected]>
178252d
to
1d83ca0
Compare
Workflow has started. |
Signed-off-by: Valeriy Khorunzhin <[email protected]>
Workflow has started. The target step completed with status: failure. |
Description
Why do we need it, and what problem does it solve?
What is the expected result?
Checklist
Changelog entries