-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 support for repeated PVC-claim but using subPath in AA-validation #3091
Add support for repeated PVC-claim but using subPath in AA-validation #3091
Conversation
The validation for compatibility with the Affinity Assistant does not support the same PVC repeated, but using different subPaths. This patch adds support for this case.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The following is the coverage report on the affected files.
|
I'll leave this as a draft for now - since I have not implemented any test case for this case. I feel it is a bit heavy to add a complete new test case for this case - so the test may need refactoring. Feel free to add test case if anyone feel this fix is in hurry. |
will take it with or without a test! :) don't want to be stuck in 0.14.3, haha |
My suggestion would be to move the validation bit into // pkg/reconciler/taskrun/taskrun.go
// after workspace.ValidateBindings() is called in prepare()
_, isAssociatedWithAnAffinityAssistant := tr.Annotations[workspace.AnnotationAffinityAssistantName]
if isAssociatedWithAnAffinityAssistant {
if err := workspace.ValidateOnlyOnePVCBindingUsed(tr.Spec.Workspaces); err != nil {
logger.Errorf("TaskRun %q workspaces are invalid: %v", tr.Name, err)
tr.Status.MarkResourceFailed(podconvert.ReasonFailedValidation, err)
return nil, nil, controller.NewPermanentError(err)
}
} // pkg/workspace/validate.go
func ValidateOnlyOnePVCBindingUsed(wbs []v1beta1.WorkspaceBinding) error {
workspaceVolumes := make(map[string]bool)
for _, w := range wbs {
if w.PersistentVolumeClaim != nil {
workspaceVolumes[w.PersistentVolumeClaim.ClaimName] = true
}
if w.VolumeClaimTemplate != nil {
workspaceVolumes[w.Name] = true
}
}
if len(workspaceVolumes) > 1 {
return fmt.Errorf("TaskRun mounts more than one ...") // cut for brevity
}
return nil
} Then |
@sbwsg sounds good to me |
Updated as described and opened #3099 |
Changes
The validation for compatibility with the Affinity Assistant does not
support the same PVC repeated, but using different subPaths.
This patch adds support for this case.
Closes #3085
/kind bug
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Double check this list of stuff that's easy to miss:
cmd
dir, please updatethe release Task to build and release this image.
Reviewer Notes
If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.
Release Notes