Skip to content
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

Task with more than one workspace waiting forever to start #2829

Closed
r0bj opened this issue Jun 18, 2020 · 8 comments
Closed

Task with more than one workspace waiting forever to start #2829

r0bj opened this issue Jun 18, 2020 · 8 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.

Comments

@r0bj
Copy link

r0bj commented Jun 18, 2020

Expected Behavior

Task with more than one workspace starts.

Actual Behavior

Task with more than one workspace waiting forever to start because it cannot attach volumes.

Steps to Reproduce the Problem

  1. There is a task (taskA) in pipeline which uses 2 workspaces
  2. Pipelinerun starts, creates 2 different affinity-assistants
  3. Because affinity-assistants use anti-affinity they are started on 2 different nodes
  4. Each affinity-assistant mount volume on node where it runs, so volumes are mounted on different nodes
  5. Task (taskA) cannot start because it uses affinity to one of the affinity-assistants and tries to attach 2 volumes which is impossible with ReadWriteOnce volumes
  6. Task (taskA) waits forever to start

Is it possible to handle this situation with affinity-assistant enabled?

Additional Info

  • Tekton Pipeline version:
Client version: 0.10.0
Pipeline version: v0.13.2
Triggers version: v0.5.0
@vdemeester
Copy link
Member

/kind bug
/cc @jlpettersson

@tekton-robot tekton-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 18, 2020
@vdemeester vdemeester added the priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. label Jun 18, 2020
@jlpettersson
Copy link
Member

jlpettersson commented Jun 18, 2020

Is it possible to handle this situation with affinity-assistant enabled?

No - by intention. When the Affinity Assistant was introduced, the docs was also updated so that we recommend at most one writeable workspace per Task. If you really need to use two PVC volumes in a single Task - you should disable the Affinity Assistant.

Each affinity-assistant mount volume on node where it runs, so volumes are mounted on different nodes

And this will happen if e.g. a pipeline starts with two parallel tasks - even without the Affinity Assistant.

In the worst case - these two volumes are located in two different Availability Zones - and your Pipeline is deadlocked - with or without the Affinity Assistant. For this reason I had to remove an end-to-end-test using two volumes - that sometimes ended up in to different Availability Zones in a Regional cluster: #2546

If you really want to use two volumes in a single Task - you must disable the Affinity Assistant, but you will must likely run into problems in regional clusters - but it depends on how your storage work.

There are two alternatives, either disable the Affinity Assistant (but parallelism in pipeline will be harder) or design Tasks so that they use at most one workspace.

@jlpettersson
Copy link
Member

We should probably validate and emit an Event or use the Admission Webhook to validate these situation to inform the user in a better way.

@jlpettersson
Copy link
Member

@r0bj is there any specific reason to why you need two workspaces in the same Task?

It is possible to have a single workspace volume but mount different parts of it using subPath, there is an example of that: https://github.com/tektoncd/pipeline/blob/master/examples/v1beta1/pipelineruns/pipelinerun-using-different-subpaths-of-workspace.yaml

Is that a way to solve your use case?

@r0bj
Copy link
Author

r0bj commented Jun 18, 2020

@jlpettersson thanks for explanation. In my case using subPath resolves issue. Using two workspaces is not a strong requirement, just an option I was considering.

jlpettersson added a commit to jlpettersson/pipeline that referenced this issue Jul 1, 2020
A TaskRun that mount more than one PVC-backed workspace is incompatible
with the Affinity Assistant. But there is no validation if the TaskRun
is compatible - so the TaskRun Pod is stuck with little information on why
to the user.

This commit adds validation of TaskRuns. When a TaskRun is associated with
an Affinity Assistant, it is checked that not more than one PVC workspace
is used - if so, the TaskRun will fail with a TaskRunValidationFailed condition.

Proposed in tektoncd#2829 (comment)
Closes tektoncd#2864
jlpettersson added a commit to jlpettersson/pipeline that referenced this issue Jul 1, 2020
A TaskRun that mount more than one PVC-backed workspace is incompatible
with the Affinity Assistant. But there is no validation if the TaskRun
is compatible - so the TaskRun Pod is stuck with little information on why
to the user.

This commit adds validation of TaskRuns. When a TaskRun is associated with
an Affinity Assistant, it is checked that not more than one PVC workspace
is used - if so, the TaskRun will fail with a TaskRunValidationFailed condition.

Proposed in tektoncd#2829 (comment)
Closes tektoncd#2864
jlpettersson added a commit to jlpettersson/pipeline that referenced this issue Jul 1, 2020
A TaskRun that mount more than one PVC-backed workspace is incompatible
with the Affinity Assistant. But there is no validation if the TaskRun
is compatible - so the TaskRun Pod is stuck with little information on why
to the user.

This commit adds validation of TaskRuns. When a TaskRun is associated with
an Affinity Assistant, it is checked that not more than one PVC workspace
is used - if so, the TaskRun will fail with a TaskRunValidationFailed condition.

Proposed in tektoncd#2829 (comment)
Closes tektoncd#2864
jlpettersson added a commit to jlpettersson/pipeline that referenced this issue Jul 17, 2020
A TaskRun that mount more than one PVC-backed workspace is incompatible
with the Affinity Assistant. But there is no validation if the TaskRun
is compatible - so the TaskRun Pod is stuck with little information on why
to the user.

This commit adds validation of TaskRuns. When a TaskRun is associated with
an Affinity Assistant, it is checked that not more than one PVC workspace
is used - if so, the TaskRun will fail with a TaskRunValidationFailed condition.

Proposed in tektoncd#2829 (comment)
Closes tektoncd#2864
jlpettersson added a commit to jlpettersson/pipeline that referenced this issue Jul 27, 2020
A TaskRun that mount more than one PVC-backed workspace is incompatible
with the Affinity Assistant. But there is no validation if the TaskRun
is compatible - so the TaskRun Pod is stuck with little information on why
to the user.

This commit adds validation of TaskRuns. When a TaskRun is associated with
an Affinity Assistant, it is checked that not more than one PVC workspace
is used - if so, the TaskRun will fail with a TaskRunValidationFailed condition.

Proposed in tektoncd#2829 (comment)
Closes tektoncd#2864
tekton-robot pushed a commit that referenced this issue Jul 28, 2020
A TaskRun that mount more than one PVC-backed workspace is incompatible
with the Affinity Assistant. But there is no validation if the TaskRun
is compatible - so the TaskRun Pod is stuck with little information on why
to the user.

This commit adds validation of TaskRuns. When a TaskRun is associated with
an Affinity Assistant, it is checked that not more than one PVC workspace
is used - if so, the TaskRun will fail with a TaskRunValidationFailed condition.

Proposed in #2829 (comment)
Closes #2864
@ghost
Copy link

ghost commented Jul 29, 2020

Now that we have #2885 merged, should we close this issue?

@vdemeester
Copy link
Member

I would think so yes. If anyone feels it should be re-open, please comment 👼
/close

@tekton-robot
Copy link
Collaborator

@vdemeester: Closing this issue.

In response to this:

I would think so yes. If anyone feels it should be re-open, please comment 👼
/close

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.

Peaorl pushed a commit to Peaorl/pipeline that referenced this issue Aug 10, 2020
A TaskRun that mount more than one PVC-backed workspace is incompatible
with the Affinity Assistant. But there is no validation if the TaskRun
is compatible - so the TaskRun Pod is stuck with little information on why
to the user.

This commit adds validation of TaskRuns. When a TaskRun is associated with
an Affinity Assistant, it is checked that not more than one PVC workspace
is used - if so, the TaskRun will fail with a TaskRunValidationFailed condition.

Proposed in tektoncd#2829 (comment)
Closes tektoncd#2864
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.
Projects
None yet
Development

No branches or pull requests

4 participants