Skip to content

Commit

Permalink
Allow for resource limits and requests for pre-deployment jobs (#23077)
Browse files Browse the repository at this point in the history
* Update predeploy_job.yaml

Adding the ability to allow for requests and limits to be added to the predeploy_job like already done for deployments.

* Update predeploy_job.yaml

Add the ability for the proxy predeploy_job to have limits and requests like the deployment. Using same values from Values file.

* Update predeploy_test.yaml

Adding tests for resource limits on predeploy job for auth and proxy.

* Update examples/chart/teleport-cluster/tests/predeploy_test.yaml

Co-authored-by: Hugo Shaka <hugo.hervieux@goteleport.com>

* Update examples/chart/teleport-cluster/tests/predeploy_test.yaml

Co-authored-by: Hugo Shaka <hugo.hervieux@goteleport.com>

* Update examples/chart/teleport-cluster/tests/predeploy_test.yaml

Co-authored-by: Hugo Shaka <hugo.hervieux@goteleport.com>

* Update examples/chart/teleport-cluster/tests/predeploy_test.yaml

Co-authored-by: Hugo Shaka <hugo.hervieux@goteleport.com>

---------

Co-authored-by: Hugo Shaka <hugo.hervieux@goteleport.com>
  • Loading branch information
yjperez and hugoShaka authored Mar 15, 2023
1 parent 523e61f commit 54951cf
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ spec:
- name: "teleport-config-check"
image: '{{ if $auth.enterprise }}{{ $auth.enterpriseImage }}{{ else }}{{ $auth.image }}{{ end }}:{{ include "teleport-cluster.version" . }}'
imagePullPolicy: {{ $auth.imagePullPolicy }}
{{- if $auth.resources }}
resources:
{{- toYaml $auth.resources | nindent 10 }}
{{- end }}
{{- if or $auth.extraEnv $auth.tls.existingCASecretName }}
env:
{{- if (gt (len $auth.extraEnv) 0) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ spec:
- name: "teleport"
image: '{{ if $proxy.enterprise }}{{ $proxy.enterpriseImage }}{{ else }}{{ $proxy.image }}{{ end }}:{{ include "teleport-cluster.version" . }}'
imagePullPolicy: {{ $proxy.imagePullPolicy }}
{{- if $proxy.resources }}
resources:
{{- toYaml $proxy.resources | nindent 10 }}
{{- end }}
{{- if or $proxy.extraEnv $proxy.tls.existingCASecretName }}
env:
{{- if (gt (len $proxy.extraEnv) 0) }}
Expand Down
34 changes: 34 additions & 0 deletions examples/chart/teleport-cluster/tests/predeploy_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,37 @@ tests:
asserts:
- hasDocuments:
count: 0
- it: should set resources on auth predeploy job when set in values
template: auth/predeploy_job.yaml
values:
- ../.lint/resources.yaml
asserts:
- equal:
path: spec.template.spec.containers[0].resources.limits.cpu
value: 2
- equal:
path: spec.template.spec.containers[0].resources.limits.memory
value: 4Gi
- equal:
path: spec.template.spec.containers[0].resources.requests.cpu
value: 1
- equal:
path: spec.template.spec.containers[0].resources.requests.memory
value: 2Gi
- it: should set resources on proxy predeploy job when set in values
template: proxy/predeploy_job.yaml
values:
- ../.lint/resources.yaml
asserts:
- equal:
path: spec.template.spec.containers[0].resources.limits.cpu
value: 2
- equal:
path: spec.template.spec.containers[0].resources.limits.memory
value: 4Gi
- equal:
path: spec.template.spec.containers[0].resources.requests.cpu
value: 1
- equal:
path: spec.template.spec.containers[0].resources.requests.memory
value: 2Gi

0 comments on commit 54951cf

Please sign in to comment.