Pipeline: Resource name too long, cannot create taskrun

Created on 7 Feb 2019  路  11Comments  路  Source: tektoncd/pipeline

Expected Behavior

The pipelinerun automatically creates taskruns for every task. It sets up the taskrun name using -. The pod name will be even longer with --pod. When then name is longer then 63 characters it fails to setup the taskrun.

I think we should have some logic to automatically truncated the names, or at least we should create shorter names, e.g. instead of including the whole pipeline name include the uuid.

This applies to multiple "names" in our system, including:

  • CRD names (i.e. TaskRun, Task, Pipeline, PipelineRun, PipelineResource)

    • Generated CRD names (e.g. TaskRuns created by PipelineRuns)

  • Names that get translated into resource names, e.g. Build steps become pods

Actual Behavior

Pipeline fails to reconcile.

Events:
  Type     Reason                 Age                    From                 Message
  ----     ------                 ----                   ----                 -------
  Normal   PipelineRunSucceeded   7m20s (x20 over 14m)   pipeline-controller  PipelineRun reconciled successfully
  Warning  TaskRunCreationFailed  6m50s (x3 over 6m50s)  pipeline-controller  Failed to create TaskRun "health-helm-cd-pipeline-run-28jrg-source-to-image-health-frontend": Internal error occurred: admission webhook "webhook.pipeline.knative.dev" denied the request: mutation failed: Invalid resource name: length must be no more than 63 characters: metadata.name
  Warning  PipelineRunFailed      6m50s (x3 over 6m50s)  pipeline-controller  PipelineRun failed to reconcile

Steps to Reproduce the Problem

  1. Define a pipelinerun so that pipelinerun name + task name are longer than 63chars

Additional Info

I initially didn't hit this as I was using static pipelinerun names. When I switched to generateName, it added enough characters to go over 63.

design good first issue help wanted kinbug

All 11 comments

health-helm-cd-pipeline-run-28jrg-source-to-image-health-frontend

interesting :thinking:

specifically talking about the automatically created taskruns (generated by a pipelinerun) we could probably give them way less meaningful names and get away with it. but we also need a solution names ppl explicitly set :thinking: :thinking::thinking:, tho maybe it's better to tell the user their name is too long and let them pick something else if they are creating a taskrun or pipelinerun manually?

FWIW we've run into similar issues in the context of Jenkins X integrating with Build Pipeline. For now we are leaning towards generating machine-friendly unique names for the CRDs, and then storing metadata somewhere else to associate the user-specified names with those generated names.

Perhaps an additional label or description field on the CRDs that users can set to whatever they'd like would be useful? If the full name is stored somewhere, then maybe truncating if it's too long for the name field is a decent compromise? Otherwise an explicit error message seems fine.

Yeah, I'm a +1 on distinguishing between "name of the actual CRD" and "display name for human beings".

Perhaps an additional label or description field on the CRDs that users can set to whatever they'd like would be useful?

That's a good idea!

This actually gets hairier - the step names for things like copying from a bucket or checking out git source etc result in containers with really long names as well.

This actually gets hairier - the step names for things like copying from a bucket or checking out git source etc result in containers with really long names as well.

hm interesting point - okay controversial idea, do steps actually need names? what if we numbered them sequentially instead :thinking: (+ @ImJasonH @shashwathi @pivotal-nader-ziada @tejal29 @vdemeester @dlorenc )

I like step names because it makes debugging easy. We can consider truncating resource names if it's too long.

I like step names because it makes debugging easy. We can consider truncating resource names if it's too long.

If the steps had clear names like step-1, maybe it would still be easy to debug?

we can make sure generated name, for steps or taskruns, have a max number of characters

(Added some more detail in the description re. the "names" and "resources" effected by this issue)

/assign

worked with @bobcatfish on idea on how to fix this issue, PR coming soon

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sbwsg picture sbwsg  路  3Comments

pritidesai picture pritidesai  路  4Comments

chmouel picture chmouel  路  3Comments

nader-ziada picture nader-ziada  路  4Comments

castlemilk picture castlemilk  路  4Comments