-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add PVC bound check #32
Conversation
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.
Hi let me be a bit pedantic :) and ask that you add description for the PR and explanation in the commit message of what you did here. And also you added and changed params that are not related to PVC bound check
and they are hidden in the commit and PR, such as the vmiTimeout and storageclass, it should have received separate commits with explanations.
pkg/internal/checkup/checkup.go
Outdated
@@ -342,14 +350,18 @@ func isDataSourceReady(conditions []cdiv1.DataSourceCondition) bool { | |||
return false | |||
} | |||
|
|||
func (c *Checkup) updategoldenImagePvc(pvc *corev1.PersistentVolumeClaim, cs *goldenImagesCheckState) { | |||
func (c *Checkup) updateGoldenImagePvc(pvc *corev1.PersistentVolumeClaim, cs *goldenImagesCheckState) { | |||
if pvc == nil { | |||
return | |||
} | |||
|
|||
// Prefer golden image with default SC |
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.
Prefer golden image with **configured**/ default SC
pkg/internal/checkup/checkup.go
Outdated
if pvc == nil { | ||
return | ||
} | ||
|
||
// Prefer golden image with default SC | ||
if c.goldenImagePvc != nil { | ||
if sc := c.goldenImagePvc.Spec.StorageClassName; sc == nil || *sc == c.results.DefaultStorageClass { | ||
sc := c.goldenImagePvc.Spec.StorageClassName | ||
if c.checkupConfig.StorageClass != "" && sc != nil && *sc == c.checkupConfig.StorageClass { |
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.
nit but, how about:
if sc == nil{
return
}
if *sc == c.results.DefaultStorageClass ||
(c.checkupConfig.StorageClass != "" && *sc == c.checkupConfig.StorageClass) {
pkg/internal/checkup/checkup.go
Outdated
AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}, | ||
Resources: corev1.ResourceRequirements{ | ||
Requests: corev1.ResourceList{ | ||
corev1.ResourceStorage: resource.MustParse("10Mi"), |
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.
We already know that there are some provisioners that needs at least 20Mi
pkg/internal/checkup/checkup.go
Outdated
@@ -390,6 +402,61 @@ func (c *Checkup) checkDefaultStorageClass(scs *storagev1.StorageClassList, errS | |||
} | |||
} | |||
|
|||
func (c *Checkup) checkPVCBound(ctx context.Context, errStr *string) error { | |||
log.Print("checkPVCCreation") |
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.
Maybe even more specific print of checkPVCCreationAndBinding
} | ||
|
||
if sc := c.checkupConfig.StorageClass; sc != "" { | ||
log.Printf("PVC storage class %q", sc) |
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.
Didnt knew this %q option :) thanks
} | ||
|
||
log.Printf("Waiting for PVC %q bound", pvcName) | ||
if err := wait.PollImmediateWithContext(ctx, pollInterval, time.Minute, conditionFn); err != nil { |
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.
So in case the provisioner binding mode is WFFC we are returning error? why is this the desired behavior?
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.
so we better create DV with cdi.kubevirt.io/storage.bind.immediate.requested: "true"
instead?
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.
Im not sure what we want to test exactly.. so I guess is depends
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.
all we want to check is that a PVC of the configured/default SC can be successfully bound
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.
ok then I guess yes we should use the bind annotation
pkg/internal/config/config.go
Outdated
PodUID: baseConfig.PodUID, | ||
PodName: baseConfig.PodName, | ||
PodUID: baseConfig.PodUID, | ||
StorageClass: baseConfig.Params[StorageClassParamName], |
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.
I think since storageclass is also optional you shouldnt set it here, but you should do it in the set optional params.. I know that in the current way it will also be empty if it wasnt set but code wise its a bit confusing.
a690e70
to
b84873b
Compare
Add a check that we can create a 20MiB PVC of the default storage class and it will be bound by the provisioner. Signed-off-by: Arnon Gilboa <[email protected]>
- spec.param.storageClass - optional storage class to be used instead of the default one. - spec.param.vmiTimeout - optional timeout for VMI operations (the default is 3min). Signed-off-by: Arnon Gilboa <[email protected]>
b84873b
to
684479b
Compare
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.
/lgtm
Add a check that we can create a 20MiB PVC of the configured/default storage class and it will be bound by the provisioner.
Also add optional checkup params:
spec.param.storageClass
- optional storage class to be used instead of the default one (needed for the new check).spec.param.vmiTimeout
- optional timeout for VMI operations (the default is 3min).