Skip to content

Commit

Permalink
Merge pull request #114 from codecademy-engineering/lindsay-cron-volumes
Browse files Browse the repository at this point in the history
add volumes to cron jobs
  • Loading branch information
lindsaylandry authored Jan 31, 2024
2 parents e08c36a + 9cea9ae commit 4ee43c3
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand All @@ -31,7 +31,7 @@ jobs:
run: |
changed=$(ct list-changed --config ct.yaml)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Run chart-testing (lint)
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Helm chart automated files
/*/charts
/*/requirements.lock

# VIM
*.swp
2 changes: 1 addition & 1 deletion charts/service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: service
description: A generic k8s service chart
type: application
version: 1.8.10
version: 1.8.11
maintainers:
- email: [email protected]
name: devops
32 changes: 28 additions & 4 deletions charts/service/ci/custom-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ cronJobs:
limits:
cpu: 10m
memory: 50Mi
schedule: "* * * * *"
schedule: '* * * * *'
- name: bar
image: alpine
tag: "3.16"
command: ["echo", "FOOBAR"]
tag: '3.16'
command: ['echo', 'FOOBAR']
useParentEnv: false
resources:
requests:
Expand All @@ -100,7 +100,31 @@ cronJobs:
limits:
cpu: 10m
memory: 50Mi
schedule: "* * * * *"
schedule: '* * * * *'
volumeMounts:
- name: test-cron
mountPath: /tmp/
volumes:
- name: test-cron
emptyDir: {}

jobs:
- name: 'predeploy-job'
command: ['nginx', '-v']
resources:
requests:
cpu: 10m
memory: 50Mi
limits:
cpu: 10m
memory: 50Mi
volumeMounts:
- name: test-job
mountPath: /tmp/
volumes:
- name: test-job
emptyDir: {}
ttlSecondsAfterFinished: 30

hostAliases:
- ip: 0.0.0.0
Expand Down
Binary file removed charts/service/templates/.deployment.yaml.swp
Binary file not shown.
8 changes: 8 additions & 0 deletions charts/service/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ spec:
{{- end }}
resources:
{{- toYaml .resources | nindent 14 }}
{{- with .volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 14 }}
{{- end }}
restartPolicy: {{ .restartPolicy | default "OnFailure" }}
{{- with .volumes }}
volumes:
{{- toYaml . | nindent 12 }}
{{- end }}
schedule: {{ .schedule | quote }}
{{- end }}

0 comments on commit 4ee43c3

Please sign in to comment.