-
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
TEP-0135: Refactor Affinity Assistant PVC creation #6741
TEP-0135: Refactor Affinity Assistant PVC creation #6741
Conversation
Skipping CI for Draft Pull Request. |
The following is the coverage report on the affected files.
|
/kind feature |
/test all |
The following is the coverage report on the affected files.
|
3985e3f
to
27a5c14
Compare
/test all |
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
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.
What integration tests do we currently have using VolumeClaimTemplate and PersistentVolumeClaim for workspace bindings?
27a5c14
to
ed93f29
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
ed93f29
to
ed77ad6
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
/test pull-tekton-pipeline-go-coverage-df |
@QuanZhang-William: The specified target(s) for
The following commands are available to trigger optional jobs:
Use In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The following is the coverage report on the affected files.
|
Hey @QuanZhang-William @lbernick I am trying to understand the changes made in this PR mainly focusing on no functionality changes. Please help understand!
Do you have an example pipelineRun demonstrating impact of these changes? How does this impact the affinity assistant StatefulSet specification? Let's say I have three workspaces (
|
There can only be a single workspace in a pipelineRun backed by |
Hi @pritidesai . In the PR, we preserve the current bahavior that PVCs will be created from
Taking an example from the unit test, before this change, the More details can be found in this section of TEP design
Taking an simplified yaml file with 1 VolumeClaimTemplate: apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
generateName: demo-pipeline-run-one-workspaces-only-
spec:
pipelineSpec:
workspaces:
- name: git-source
tasks:
...
workspaces:
- name: git-source
volumeClaimTemplate:
spec:
... The AA apiVersion: apps/v1
kind: StatefulSet
metadata:
name: affinity-assistant-e6744f7e3a
spec:
...
volumeClaimTemplates:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
name: pvc-45d7ac1f34
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
volumeMode: Filesystem
... The final PVC created via AA StatefulSet's k get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pvc-45d7ac1f34-affinity-assistant-e6744f7e3a-0 Terminating pvc-5b671726-c277-49ed-a9b9-63101d65b589 1Gi RWO standard-rwo 5m33s pipelierun with 3 |
We will keep this validation for |
Thank you @QuanZhang-William for getting back, appreciate it!
Please note, the state of the PVC, |
Here is the difference between the I am thinking this state difference might not matter or impact any use case except the cluster will now have a tons of |
Given this change in behavior, please update the release notes to reflect the status change. I humbly request to be cautious next time with these kind of changes, as they can go unnoticed until they are reported by the users. |
Thanks, I agree this is a side effect of this change, and I will update the release note for it. Once the completed
Yeah, this is a good point, but I'm not sure if there is such a scenario (or is it right) for a user to rely on a /cc @lbernick |
Thanks for the reminder! I have updated the release note! |
Thanks @pritidesai for looking into this in more detail-- I did not realize the end state here would be "terminating" rather than "bound". It sounds like we should improve our integration test coverage for affinity assistant. There are two decisions we need to make:
@pritidesai @QuanZhang-William would love to hear your thoughts. |
To update the discussion on API WG: We will support backwards compatibility for existing affinity assistant ( For the new coscheduling mode |
Part of [tektoncd#6740][tektoncd#6740], developed based on Priti's [prototype][prototype] and partially completes the PVC deletion behavior [discussion][discussion]. Prior to this commit, the `PVCs` created from `PipelineRun's` `VolumeClaimTemplate` are not auto deleted when the owning `PipelineRun` is completed. This commit updates the `cleanupAffinityAssistantsAndPVCs` function to remove the `kubernetes.io/pvc-protection` finalizer protection (so that the pvc is allowed to be deleted while the pod consuming it is not deleted). The function then explicitly delete such `PVC` when cleaning up the `Affinity Assistants` at pr completion time. This change is NOT applied to `coschedule: workspaces` mode as there is backward compatability concern. See more details in this [discussion][discussion] [tektoncd#6740]: tektoncd#6740 [prototype]: tektoncd#6635 [discussion]: tektoncd#6741 (comment)
Part of [tektoncd#6740][tektoncd#6740], developed based on Priti's [prototype][prototype] and partially completes the PVC deletion behavior [discussion][discussion]. Prior to this commit, the `PVCs` created from `PipelineRun's` `VolumeClaimTemplate` are not auto deleted when the owning `PipelineRun` is completed. This commit updates the `cleanupAffinityAssistantsAndPVCs` function to remove the `kubernetes.io/pvc-protection` finalizer protection (so that the pvc is allowed to be deleted while the pod consuming it is not deleted). The function then explicitly delete such `PVC` when cleaning up the `Affinity Assistants` at pr completion time. This change is NOT applied to `coschedule: workspaces` mode as there is backward compatability concern. See more details in this [discussion][discussion] [tektoncd#6740]: tektoncd#6740 [prototype]: tektoncd#6635 [discussion]: tektoncd#6741 (comment)
Part of [tektoncd#6740][tektoncd#6740], developed based on Priti's [prototype][prototype] and partially completes the PVC deletion behavior [discussion][discussion]. Prior to this commit, the `PVCs` created from `PipelineRun's` `VolumeClaimTemplate` are not auto deleted when the owning `PipelineRun` is completed. This commit updates the `cleanupAffinityAssistantsAndPVCs` function to remove the `kubernetes.io/pvc-protection` finalizer protection (so that the pvc is allowed to be deleted while the pod consuming it is not deleted). The function then explicitly delete such `PVC` when cleaning up the `Affinity Assistants` at pr completion time. This change is NOT applied to `coschedule: workspaces` mode as there is backward compatability concern. See more details in this [discussion][discussion] [tektoncd#6740]: tektoncd#6740 [prototype]: tektoncd#6635 [discussion]: tektoncd#6741 (comment)
Part of [tektoncd#6740][tektoncd#6740], developed based on Priti's [prototype][prototype] and partially completes the PVC deletion behavior [discussion][discussion]. Prior to this commit, the `PVCs` created from `PipelineRun's` `VolumeClaimTemplate` are not auto deleted when the owning `PipelineRun` is completed. This commit updates the `cleanupAffinityAssistantsAndPVCs` function to remove the `kubernetes.io/pvc-protection` finalizer protection (so that the pvc is allowed to be deleted while the pod consuming it is not deleted). The function then explicitly delete such `PVC` when cleaning up the `Affinity Assistants` at pr completion time. This change is NOT applied to `coschedule: workspaces` mode as there is backward compatability concern. See more details in this [discussion][discussion] [tektoncd#6740]: tektoncd#6740 [prototype]: tektoncd#6635 [discussion]: tektoncd#6741 (comment)
Part of [#6740][#6740], developed based on Priti's [prototype][prototype] and partially completes the PVC deletion behavior [discussion][discussion]. Prior to this commit, the `PVCs` created from `PipelineRun's` `VolumeClaimTemplate` are not auto deleted when the owning `PipelineRun` is completed. This commit updates the `cleanupAffinityAssistantsAndPVCs` function to remove the `kubernetes.io/pvc-protection` finalizer protection (so that the pvc is allowed to be deleted while the pod consuming it is not deleted). The function then explicitly delete such `PVC` when cleaning up the `Affinity Assistants` at pr completion time. This change is NOT applied to `coschedule: workspaces` mode as there is backward compatability concern. See more details in this [discussion][discussion] [#6740]: #6740 [prototype]: #6635 [discussion]: #6741 (comment)
Part of #6740 and based on @lbernick's prototype. TEP-0135 introduces a feature that allows a cluster operator to ensure that all of a PipelineRun's pods are scheduled to the same node.
Before this commit, the PipelineRun reconciler creates PVC for each
VolumeClaimTemplate
backed workspace, and mount the PVCs to the AA to avoid PV availability zone conflict. This implementation works forAffinityAssistantPerWorkspace
but introduces availability zone conflict issue in theAffinityAssistantPerPipelineRun
mode since we cannot enforce all the PVC are created in the same availability zone.Instead of directly creating a PVC for each PipelineRun workspace backed by a VolumeClaimTemplate, this commit sets one VolumeClaimTemplate per PVC workspace in the affinity assistant StatefulSet spec, which enforces all VolumeClaimTemplates in StatefulSets are all provisioned on the same node/availability zone.
This commit just refactors the current implementation in favor of the
AffinityAssistantPerPipelineRun
feature. There is no functionality change. TheAffinityAssistantPerPipelineRun
feature will be added in the follow up PRs.Changes
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes