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

Resource name too long, cannot create taskrun #481

Closed
afrittoli opened this issue Feb 7, 2019 · 11 comments · Fixed by #491
Closed

Resource name too long, cannot create taskrun #481

afrittoli opened this issue Feb 7, 2019 · 11 comments · Fixed by #491
Labels
design This task is about creating and discussing a design good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.

Comments

@afrittoli
Copy link
Member

afrittoli commented Feb 7, 2019

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.

afrittoli added a commit to afrittoli/health-helm that referenced this issue Feb 7, 2019
Use generateName for the pipeline run. This must be used in combination 
with kubectl create (instead of apply) so that the name is generated. 
Shorten the name to avoid hitting 
tektoncd/pipeline#481.
@bobcatfish
Copy link
Collaborator

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

interesting 🤔

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 🤔 🤔🤔, 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?

@bobcatfish bobcatfish added kind/bug Categorizes issue or PR as related to a bug. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. design This task is about creating and discussing a design labels Feb 7, 2019
@dwnusbaum
Copy link
Contributor

dwnusbaum commented Feb 7, 2019

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.

@abayer
Copy link
Contributor

abayer commented Feb 7, 2019

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

@bobcatfish
Copy link
Collaborator

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!

@abayer
Copy link
Contributor

abayer commented Feb 8, 2019

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.

@bobcatfish
Copy link
Collaborator

bobcatfish commented Feb 8, 2019

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 🤔 (+ @imjasonh @shashwathi @pivotal-nader-ziada @tejal29 @vdemeester @dlorenc )

@shashwathi
Copy link
Contributor

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

@bobcatfish
Copy link
Collaborator

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?

@nader-ziada
Copy link
Member

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

@bobcatfish
Copy link
Collaborator

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

@nader-ziada
Copy link
Member

/assign

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

chmouel pushed a commit to chmouel/tektoncd-pipeline that referenced this issue Aug 6, 2020
pradeepitm12 pushed a commit to pradeepitm12/pipeline that referenced this issue Jan 28, 2021
- Update examples to use v1beta1 by default.
- Add an explicit v1alpha1 example.
- Use v1beta1 Pipeline types for Params and tests.

Fixes tektoncd#481

Signed-off-by: Dibyo Mukherjee <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design This task is about creating and discussing a design good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants