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

feat(KONFLUX-5670): Define computeResources for prefetch-dependencies* tasks #1763

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion task-generator/trusted-artifacts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/tektoncd/pipeline v0.66.0
github.com/zregvart/tkn-fmt v0.0.0-20240614122620-a2995427266c
k8s.io/api v0.30.1
k8s.io/apimachinery v0.30.1
mvdan.cc/sh/v3 v3.10.0
sigs.k8s.io/kustomize/api v0.18.0
sigs.k8s.io/kustomize/kyaml v0.18.1
Expand Down Expand Up @@ -87,7 +88,6 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apimachinery v0.30.1 // indirect
k8s.io/client-go v0.30.1 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.0.0-20240521193020-835d969ad83a // indirect
Expand Down
7 changes: 7 additions & 0 deletions task-generator/trusted-artifacts/golden/git-clone/ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,13 @@ spec:
env:
- name: IMAGE_EXPIRES_AFTER
value: $(params.ociArtifactExpiresAfter)
computeResources:
limits:
cpu: "1"
memory: 3Gi
requests:
cpu: "1"
memory: 3Gi
volumeMounts:
- name: workdir
mountPath: /var/workdir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ spec:
env:
- name: IMAGE_EXPIRES_AFTER
value: $(params.ociArtifactExpiresAfter)
computeResources:
limits:
cpu: "1"
memory: 3Gi
requests:
cpu: "1"
memory: 3Gi
args:
- create
- --store
Expand Down
11 changes: 11 additions & 0 deletions task-generator/trusted-artifacts/ta.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/google/go-containerregistry/pkg/v1/remote"
pipeline "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
core "k8s.io/api/core/v1"
resource "k8s.io/apimachinery/pkg/api/resource"
)

var (
Expand Down Expand Up @@ -334,6 +335,16 @@ func perform(task *pipeline.Task, recipe *Recipe) error {
},
},
Args: args,
ComputeResources: core.ResourceRequirements{
Requests: core.ResourceList{
core.ResourceCPU: resource.MustParse("1"),
core.ResourceMemory: resource.MustParse("3Gi"),
},
Limits: core.ResourceList{
core.ResourceCPU: resource.MustParse("1"),
core.ResourceMemory: resource.MustParse("3Gi"),
},
},
Comment on lines +338 to +347
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally the values here would be part of the recipe, nothing that would block this change, this can be added if/when there is a need to modify this in the future

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree (as far as I understand the architecture here) but that would require bigger code change and I did not wanted to go too deep to it for now. But, let me know and I will happily work on it in different PR.

}

if task.Spec.StepTemplate == nil && !recipe.PreferStepTemplate {
Expand Down
7 changes: 7 additions & 0 deletions task/git-clone-oci-ta/0.1/git-clone-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,10 @@ spec:
env:
- name: IMAGE_EXPIRES_AFTER
value: $(params.ociArtifactExpiresAfter)
computeResources:
limits:
cpu: "1"
memory: 3Gi
requests:
cpu: "1"
memory: 3Gi
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,13 @@ spec:

cachi2 --log-level="$LOG_LEVEL" inject-files /var/workdir/cachi2/output \
--for-output-dir=/cachi2/output
computeResources:
limits:
cpu: "1"
memory: 3Gi
requests:
cpu: "1"
memory: 3Gi
- name: unregister-rhsm
image: quay.io/redhat-appstudio/cachi2:0.15.0@sha256:b141cb5cf4d98e6c5f668f1fe172e1d68f2a44ac1027403fbcff94ce1e68185d
script: |
Expand All @@ -417,3 +424,10 @@ spec:
env:
- name: IMAGE_EXPIRES_AFTER
value: $(params.ociArtifactExpiresAfter)
computeResources:
limits:
cpu: "1"
memory: 3Gi
requests:
cpu: "1"
memory: 3Gi
7 changes: 7 additions & 0 deletions task/prefetch-dependencies/0.1/prefetch-dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,13 @@ spec:
readOnly: true
- mountPath: /activation-key
name: activation-key
computeResources:
limits:
cpu: '1'
memory: 3Gi
requests:
cpu: '1'
memory: 3Gi
script: |
#!/bin/bash

Expand Down
Loading