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

Provide params to control resource constraints #196

Closed
wants to merge 1 commit into from
Closed
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
32 changes: 30 additions & 2 deletions deploy/central/tasks-chart/templates/task-ods-build-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ spec:
description: Whether to skip SonarQube analysis or not.
type: string
default: "false"
- name: cpu-request
description: Minimum amount of CPU compute resources required, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "100m"
- name: cpu-limit
description: Maximum amount of CPU compute resources allowed, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "1"
- name: memory-request
description: Minimum amount of memory compute resources required, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "512Mi"
- name: memory-limit
description: Maximum amount of memory compute resources allowed, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "1Gi"
steps:
- name: build-go-binary
# Image is built from build/package/Dockerfile.go-toolset.
Expand All @@ -67,7 +83,13 @@ spec:
configMapKeyRef:
key: debug
name: ods-pipeline
resources: {}
resources:
requests:
memory: '$(params.memory-request)'
cpu: '$(params.cpu-request)'
limits:
memory: '$(params.memory-limit)'
cpu: '$(params.cpu-limit)'
script: |

# build-go is build/package/scripts/build-go.sh.
Expand All @@ -93,7 +115,13 @@ spec:
secretKeyRef:
key: password
name: ods-sonar-auth
resources: {}
resources:
requests:
memory: '$(params.memory-request)'
cpu: '$(params.cpu-request)'
limits:
memory: '$(params.memory-limit)'
cpu: '$(params.cpu-limit)'
script: |
if [ "$(params.sonar-skip)" = "true" ]; then
echo "Skipping SonarQube analysis"
Expand Down
32 changes: 30 additions & 2 deletions deploy/central/tasks-chart/templates/task-ods-build-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ spec:
description: Whether to skip the SonarQube analysis or not.
type: string
default: "false"
- name: cpu-request
description: Minimum amount of CPU compute resources required, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "100m"
- name: cpu-limit
description: Maximum amount of CPU compute resources allowed, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "1"
- name: memory-request
description: Minimum amount of memory compute resources required, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "512Mi"
- name: memory-limit
description: Maximum amount of memory compute resources allowed, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "1Gi"
steps:
- name: build-python
# Image is built from build/package/Dockerfile.python-toolset.
Expand All @@ -54,7 +70,13 @@ spec:
configMapKeyRef:
key: debug
name: ods-pipeline
resources: {}
resources:
requests:
memory: '$(params.memory-request)'
cpu: '$(params.cpu-request)'
limits:
memory: '$(params.memory-limit)'
cpu: '$(params.cpu-limit)'
script: |

# build-python is build/package/scripts/build-python.sh.
Expand All @@ -78,7 +100,13 @@ spec:
secretKeyRef:
key: password
name: ods-sonar-auth
resources: {}
resources:
requests:
memory: '$(params.memory-request)'
cpu: '$(params.cpu-request)'
limits:
memory: '$(params.memory-limit)'
cpu: '$(params.cpu-limit)'
script: |
if [ "$(params.sonar-skip)" = "true" ]; then
echo "Skipping SonarQube analysis"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ spec:
description: Whether to skip the SonarQube analysis or not.
type: string
default: "false"
- name: cpu-request
description: Minimum amount of CPU compute resources required, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "100m"
- name: cpu-limit
description: Maximum amount of CPU compute resources allowed, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "1"
- name: memory-request
description: Minimum amount of memory compute resources required, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "2Gi"
- name: memory-limit
description: Maximum amount of memory compute resources allowed, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "3Gi"
steps:
- name: build-typescript
# Image is built from build/package/Dockerfile.typescript-toolset.
Expand All @@ -50,7 +66,13 @@ spec:
configMapKeyRef:
key: debug
name: ods-pipeline
resources: {}
resources:
requests:
memory: '$(params.memory-request)'
cpu: '$(params.cpu-request)'
limits:
memory: '$(params.memory-limit)'
cpu: '$(params.cpu-limit)'
script: |

# build-typescript is build/package/scripts/build-typescript.sh.
Expand All @@ -73,7 +95,13 @@ spec:
secretKeyRef:
key: password
name: ods-sonar-auth
resources: {}
resources:
requests:
memory: '$(params.memory-request)'
cpu: '$(params.cpu-request)'
limits:
memory: '$(params.memory-limit)'
cpu: '$(params.cpu-limit)'
script: |
if [ "$(params.sonar-skip)" = "true" ]; then
echo "Skipping SonarQube analysis"
Expand Down
28 changes: 22 additions & 6 deletions deploy/central/tasks-chart/templates/task-ods-deploy-helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,33 @@ spec:
description: The Helm release name. If empty, the release name is simply the name of the chart.
type: string
default: ''
- name: overwrite-values
description: >-
Specify the values you want to overwrite, comma separated.
Example: `autoscaling.enabled=true,replicas=1`
- name: cpu-request
description: Minimum amount of CPU compute resources required, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: ''
default: "100m"
- name: cpu-limit
description: Maximum amount of CPU compute resources allowed, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "500m"
- name: memory-request
description: Minimum amount of memory compute resources required, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "128Mi"
- name: memory-limit
description: Maximum amount of memory compute resources allowed, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "256Mi"
steps:
- name: helm-upgrade-from-repo
# Image is built from build/package/Dockerfile.helm.
image: '{{ .Values.registry }}/{{ .Values.namespace }}/ods-helm:{{ .Values.imageTag }}'
resources: {}
resources:
requests:
memory: '$(params.memory-request)'
cpu: '$(params.cpu-request)'
limits:
memory: '$(params.memory-limit)'
cpu: '$(params.cpu-limit)'
script: |
# deploy-with-helm is built from /cmd/deploy-with-helm/main.go.
deploy-with-helm \
Expand Down
24 changes: 23 additions & 1 deletion deploy/central/tasks-chart/templates/task-ods-finish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ spec:
- name: aggregate-tasks-status
description: Aggregate status of all tasks.
default: "None"
- name: cpu-request
description: Minimum amount of CPU compute resources required, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "100m"
- name: cpu-limit
description: Maximum amount of CPU compute resources allowed, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "500m"
- name: memory-request
description: Minimum amount of memory compute resources required, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "128Mi"
- name: memory-limit
description: Maximum amount of memory compute resources allowed, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "256Mi"
steps:
- name: ods-finish
# Image is built from build/package/Dockerfile.finish.
Expand Down Expand Up @@ -63,7 +79,13 @@ spec:
configMapKeyRef:
key: consoleUrl
name: ods-cluster
resources: {}
resources:
requests:
memory: '$(params.memory-request)'
cpu: '$(params.cpu-request)'
limits:
memory: '$(params.memory-limit)'
cpu: '$(params.cpu-limit)'
workingDir: $(workspaces.source.path)
script: |

Expand Down
24 changes: 23 additions & 1 deletion deploy/central/tasks-chart/templates/task-ods-package-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ spec:
description: Whether the Aqua security scan needs to pass for the task to succeed.
type: string
default: "false"
- name: cpu-request
description: Minimum amount of CPU compute resources required, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "100m"
- name: cpu-limit
description: Maximum amount of CPU compute resources allowed, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "1"
- name: memory-request
description: Minimum amount of memory compute resources required, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "1Gi"
- name: memory-limit
description: Maximum amount of memory compute resources allowed, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "2Gi"
results:
- description: Digest of the image just built.
name: image-digest
Expand Down Expand Up @@ -97,7 +113,13 @@ spec:
configMapKeyRef:
key: debug
name: ods-pipeline
resources: {}
resources:
requests:
memory: '$(params.memory-request)'
cpu: '$(params.cpu-request)'
limits:
memory: '$(params.memory-limit)'
cpu: '$(params.cpu-limit)'
script: |

# ods-build-push-image is built from cmd/build-push-image/main.go.
Expand Down
24 changes: 23 additions & 1 deletion deploy/central/tasks-chart/templates/task-ods-start.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,22 @@ spec:
- name: pipeline-run-name
description: Name of pipeline run.
type: string
- name: cpu-request
description: Minimum amount of CPU compute resources required, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "100m"
- name: cpu-limit
description: Maximum amount of CPU compute resources allowed, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "500m"
- name: memory-request
description: Minimum amount of memory compute resources required, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "128Mi"
- name: memory-limit
description: Maximum amount of memory compute resources allowed, as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers.
type: string
default: "256Mi"
results:
- description: The commit SHA that was fetched by this task.
name: commit
Expand Down Expand Up @@ -144,7 +160,13 @@ spec:
configMapKeyRef:
key: consoleUrl
name: ods-cluster
resources: {}
resources:
requests:
memory: '$(params.memory-request)'
cpu: '$(params.cpu-request)'
limits:
memory: '$(params.memory-limit)'
cpu: '$(params.cpu-limit)'
workingDir: $(workspaces.source.path)
script: |

Expand Down
2 changes: 1 addition & 1 deletion internal/docs/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func parseTasks(helmTemplateOutput []byte) ([]*tekton.ClusterTask, error) {
var t tekton.ClusterTask
err := yaml.Unmarshal(taskBytes, &t)
if err != nil {
return nil, err
return nil, fmt.Errorf("cannot unmarshal tasks: %w", err)
}
if len(t.Name) > 0 {
tasks = append(tasks, &t)
Expand Down