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

[v15] teleport-kube-agent: Propagate resources to post-install and post-delete Jobs #47747

Merged
merged 2 commits into from
Oct 21, 2024
Merged
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
3 changes: 3 additions & 0 deletions examples/chart/teleport-kube-agent/templates/delete_hook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,6 @@ spec:
{{- if .Values.securityContext }}
securityContext: {{- toYaml .Values.securityContext | nindent 10 }}
{{- end }}
{{- if .Values.resources }}
resources: {{- toYaml .Values.resources | nindent 10 }}
{{- end }}
3 changes: 3 additions & 0 deletions examples/chart/teleport-kube-agent/templates/hook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,7 @@ spec:
{{- if .Values.securityContext }}
securityContext: {{- toYaml .Values.securityContext | nindent 10 }}
{{- end }}
{{- if .Values.resources }}
resources: {{- toYaml .Values.resources | nindent 10 }}
{{- end }}
{{- end}}
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,41 @@ should set nodeSelector in post-delete hook:
gravitational.io/k8s-role: node
restartPolicy: OnFailure
serviceAccountName: RELEASE-NAME-delete-hook
should set resources in the Job's pod spec if resources is set in values:
1: |
containers:
- args:
- kube-state
- delete
command:
- teleport
env:
- name: KUBE_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: RELEASE_NAME
value: RELEASE-NAME
image: public.ecr.aws/gravitational/teleport-distroless:15.4.20
imagePullPolicy: IfNotPresent
name: post-delete-job
resources:
limits:
cpu: 2
memory: 4Gi
requests:
cpu: 1
memory: 2Gi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- all
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 9807
restartPolicy: OnFailure
serviceAccountName: RELEASE-NAME-delete-hook
should set securityContext in post-delete hook:
1: |
containers:
Expand Down
33 changes: 32 additions & 1 deletion examples/chart/teleport-kube-agent/tests/job_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -275,4 +275,35 @@ tests:
value:
app: RELEASE-NAME
testLabel: testValue


- it: should set resources in the Job's pod spec if resources is set in values
template: delete_hook.yaml
# documentIndex: 0=ServiceAccount 1=Role 2=RoleBinding 3=Job
documentIndex: 3
values:
- ../.lint/backwards-compatibility.yaml
set:
# These are just sample values to test the chart.
# They are not intended to be guidelines or suggestions for running teleport.
resources:
limits:
cpu: 2
memory: 4Gi
requests:
cpu: 1
memory: 2Gi
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
- matchSnapshot:
path: spec.template.spec
Loading