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

Cannot use parameter substitution for volume size #1514

Closed
NicolasRouquette opened this issue Nov 3, 2019 · 6 comments
Closed

Cannot use parameter substitution for volume size #1514

NicolasRouquette opened this issue Nov 3, 2019 · 6 comments
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@NicolasRouquette
Copy link

Expected Behavior

Apply the following resource:

apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
  name: buildah
spec:
  inputs:
    params:
      - name: BUILDER_IMAGE
        type: string
        description: The location of the buildah builder image.
        default: quay.io/buildah/stable
      - name: DOCKERFILE
        type: string
        description: Name of the dockerfile relative to the context directory.
        default: Dockerfile
      - name: CONTEXT
        type: string
        description: Path to the dockerfile directory relative to the root of the repository.
        default: .
      - name: FORMAT
        type: string
        description: one of oci, v2s1, v2s2.
        default: v2s1
      - name: TLSVERIFY
        type: string
        description: Verify the TLS on the registry endpoint (for push/pull to a non-TLS registry)
        default: "true"
      - name: MEMORY
        type: string
        description: Size of /var/lib/containers in G units.
        default: 5G
    resources:
      - name: source
        type: git

  outputs:
    resources:
      - name: image
        type: image

  steps:
    - name: build
      image: $(inputs.params.BUILDER_IMAGE)
      workingDir: /workspace/source/$(inputs.params.CONTEXT)
      # See: https://github.com/containers/buildah/issues/1481#issuecomment-480629425
      command: ['buildah', 'bud', '--isolation', 'chroot', '--tls-verify=$(inputs.params.TLSVERIFY)', '-f', '$(inputs.params.DOCKERFILE)', '-t', '$(outputs.resources.image.url)', '.']
      volumeMounts:
        - name: varlibcontainers
          mountPath: /var/lib/containers

    - name: images
      image: $(inputs.params.BUILDER_IMAGE)
      workingDir: /workspace/source
      command: ['buildah', 'images', '--all', '--format', '{{.Digest}} {{.Size}} {{.CreatedAt}} {{.Name}}']
      volumeMounts:
        - name: varlibcontainers
          mountPath: /var/lib/containers

    - name: push
      image: $(inputs.params.BUILDER_IMAGE)
      workingDir: /workspace/source
      command: ['buildah', 'push', '--debug', '--format', '$(inputs.params.FORMAT)', '--tls-verify=$(inputs.params.TLSVERIFY)', '$(outputs.resources.image.url)', 'docker://$(outputs.resources.image.url)']
      volumeMounts:
        - name: varlibcontainers
          mountPath: /var/lib/containers

  volumes:
    - name: varlibcontainers
      emptyDir:
        sizeLimit: $(inputs.params.MEMORY)
        medium: Memory

We should get:

tkn tasks ls
NAME       AGE
buildah     ...

Actual Behavior

tkn tasks ls
Failed to list tasks from ... namespace 
Error: v1alpha1.TaskList.ListMeta: v1.ListMeta.TypeMeta: Kind: Items: []v1alpha1.Task: v1alpha1.Task.Spec: v1alpha1.TaskSpec.Volumes: []v1.Volume: v1.Volume.Name: VolumeSource: EmptyDir: v1.EmptyDirVolumeSource.SizeLimit: unmarshalerDecoder: quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$', error found in #10 byte of ...|s.MEMORY)"},"name":"|..., bigger context ...|um":"Memory","sizeLimit":"$(inputs.params.MEMORY)"},"name":"varlibcontainers"}]}}],"kind":"TaskList"|...

Steps to Reproduce the Problem

  1. kubectl apply -f <file> where ` is the task described above
  2. tkn tasks ls

Additional Info

This behavior suggests that it is currently not possible to define tekton parameters for cpu or memory characteristics (quota or limits). Are there other similar limitations?

@vdemeester
Copy link
Member

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 4, 2019
@vdemeester vdemeester added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Nov 4, 2019
@dibyom
Copy link
Member

dibyom commented Jan 29, 2020

Is this more of a bug than a feature?

@NicolasRouquette
Copy link
Author

It depends on how you interpret the doc, specifically: https://github.com/tektoncd/pipeline/blob/master/docs/tasks.md#variable-substitution

and:

https://github.com/tektoncd/pipeline/blob/master/docs/tasks.md#variable-substitution-within-volumes

Nothing in the doc currently says that one can use variable substitution for volume characteristics.
So, in a strict sense, this will be a new feature.

@bobcatfish bobcatfish added this to Needs triage in Tekton Pipelines Feb 6, 2020
@afrittoli
Copy link
Member

Thanks for reporting this!
Hopefully the need of this feature is reduced by the work on workspaces.
In any case I will leave this one in the backlog.

@afrittoli afrittoli moved this from Needs triage to Backlog in Tekton Pipelines Mar 11, 2020
@dibyom
Copy link
Member

dibyom commented Mar 12, 2020

Related to #1530

@bobcatfish
Copy link
Collaborator

I think we're tending toward moving away from specifying volumes in Tasks now that we have workspaces (and #2326 adds the ability to create volumes w/in a Run) - we even considered removing volumes altogether #2058. So I'm going to close this for now but please re-open if you feel like workspaces can't meet your needs (and/or open another issue with required features for workspaces!)

Thanks @NicolasRouquette 🙏

Tekton Pipelines automation moved this from Backlog to Closed Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
No open projects
Tekton Pipelines
  
Closed
Development

No branches or pull requests

6 participants