Skip to content

Commit

Permalink
feat: add cron job template to renew https certificate
Browse files Browse the repository at this point in the history
This will be coupled with an airflow DAG that will trigger
this job on a daily schedule
  • Loading branch information
matthieu-foucault committed Jul 24, 2020
1 parent 2c81cc9 commit b2b9efa
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
2 changes: 1 addition & 1 deletion helm/cas-ciip-portal/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: cas-ciip-portal
description: A Helm chart for the CIIP portal
type: application
version: 0.1.17
version: 0.1.18
appVersion: 1.1.0
dependencies:
- name: cas-postgres
Expand Down
54 changes: 54 additions & 0 deletions helm/cas-ciip-portal/templates/cron-acme-renewal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ template "cas-ciip-portal.fullname" . }}-acme-issue
labels:
{{ include "cas-ciip-portal.labels" . | indent 4 }}
annotations:
"helm.sh/hook": "post-upgrade,post-install"
"helm.sh/hook-delete-policy": "before-hook-creation"
"helm.sh/hook-weight": "-5"

spec:
suspend: true # This cron job is intended to be triggered manually
schedule: "* * * * *"
jobTemplate:
spec:
backoffLimit: 0
activeDeadlineSeconds: 600
template:
metadata:
labels:
{{ include "cas-ciip-portal.labels" . | indent 14 }}
spec:
restartPolicy: Never
containers:
- name: {{ template "cas-ciip-portal.fullname" . }}-acme-issue
image: {{ .Values.image.app.repository }}:{{ .Values.image.app.tag }}
resources:
limits:
cpu: 1000m
memory: 128Mi
requests:
cpu: 100m
memory: 64Mi
command:
- /usr/bin/env
- bash
- -c
- |
set -euxo pipefail;
# renews the certificate if needed
/root/.acme.sh/acme.sh --cron --home /root/.acme.sh
volumeMounts:
- mountPath: /root/.acme.sh
name: acme-home
- mountPath: /root/.well-known/acme-challenge
name: acme-challenge
volumes:
- name: acme-home
persistentVolumeClaim:
claimName: {{ template "cas-ciip-portal.fullname" . }}-acme-home
- name: acme-challenge
persistentVolumeClaim:
claimName: {{ template "cas-ciip-portal.fullname" . }}-acme-challenge

0 comments on commit b2b9efa

Please sign in to comment.