diff --git a/.github/workflows/format-code.yml b/.github/workflows/format-code.yml index a9a4516..0ac7fe3 100644 --- a/.github/workflows/format-code.yml +++ b/.github/workflows/format-code.yml @@ -9,6 +9,6 @@ jobs: - uses: actions/checkout@main - uses: ministryofjustice/github-actions/code-formatter@main with: - ignore-files: "docker-compose.override.yml,values-dev.yaml,values-test.yaml,values-staging.yaml,values-uat.yaml,values-prod.yaml,ingress.yaml" + ignore-files: "docker-compose.override.yml,values-dev.yaml,values-test.yaml,values-staging.yaml,values-uat.yaml,values-prod.yaml,ingress.yaml,scheduled-downtime-cronjob.yaml" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/helm_deploy/laa-crime-evidence/templates/scheduled-downtime-cronjob.yaml b/helm_deploy/laa-crime-evidence/templates/scheduled-downtime-cronjob.yaml new file mode 100644 index 0000000..d0d4fd7 --- /dev/null +++ b/helm_deploy/laa-crime-evidence/templates/scheduled-downtime-cronjob.yaml @@ -0,0 +1,64 @@ +{{- if .Values.scheduledDowntime.enabled -}} +apiVersion: batch/v1 +kind: CronJob +metadata: + name: {{ include "laa-crime-evidence.fullname" . }}-shutdown + labels: + {{- include "laa-crime-evidence.labels" . | nindent 4 }} +spec: + schedule: {{ .Values.scheduledDowntime.shutdown }} + concurrencyPolicy: Forbid + successfulJobsHistoryLimit: 1 + failedJobsHistoryLimit: 5 + jobTemplate: + spec: + ttlSecondsAfterFinished: 345600 # 4 days + template: + spec: + containers: + - name: cloud-platform-tools + securityContext: + runAsNonRoot: true + runAsUser: 1000 + image: ministryofjustice/cloud-platform-tools + args: + - kubectl + - scale + - deploy + - {{ include "laa-crime-evidence.fullname" . }} + - --replicas=0 + restartPolicy: OnFailure + serviceAccountName: {{ .Values.scheduledDowntime.serviceAccountName }} +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: {{ include "laa-crime-evidence.fullname" . | trunc 43 }}-startup + labels: + {{- include "laa-crime-evidence.labels" . | nindent 4 }} +spec: + schedule: {{ .Values.scheduledDowntime.startup }} + concurrencyPolicy: Forbid + successfulJobsHistoryLimit: 1 + failedJobsHistoryLimit: 5 + jobTemplate: + spec: + ttlSecondsAfterFinished: 345600 # 4 days + template: + spec: + containers: + - name: cloud-platform-tools + securityContext: + runAsNonRoot: true + runAsUser: 1000 + image: ministryofjustice/cloud-platform-tools + args: + - kubectl + - scale + - deploy + - {{ include "laa-crime-evidence.fullname" . }} + - --current-replicas=0 + - --replicas={{ .Values.replicaCount }} + restartPolicy: OnFailure + serviceAccountName: {{ .Values.scheduledDowntime.serviceAccountName }} +{{- end }} \ No newline at end of file diff --git a/helm_deploy/laa-crime-evidence/values-dev.yaml b/helm_deploy/laa-crime-evidence/values-dev.yaml index 787a6d8..846caaf 100644 Binary files a/helm_deploy/laa-crime-evidence/values-dev.yaml and b/helm_deploy/laa-crime-evidence/values-dev.yaml differ diff --git a/helm_deploy/laa-crime-evidence/values-prod.yaml b/helm_deploy/laa-crime-evidence/values-prod.yaml index 70642c9..6de37fe 100644 Binary files a/helm_deploy/laa-crime-evidence/values-prod.yaml and b/helm_deploy/laa-crime-evidence/values-prod.yaml differ diff --git a/helm_deploy/laa-crime-evidence/values-staging.yaml b/helm_deploy/laa-crime-evidence/values-staging.yaml index 2a100af..affe142 100644 Binary files a/helm_deploy/laa-crime-evidence/values-staging.yaml and b/helm_deploy/laa-crime-evidence/values-staging.yaml differ diff --git a/helm_deploy/laa-crime-evidence/values-test.yaml b/helm_deploy/laa-crime-evidence/values-test.yaml index ec20c8f..db7c954 100644 Binary files a/helm_deploy/laa-crime-evidence/values-test.yaml and b/helm_deploy/laa-crime-evidence/values-test.yaml differ diff --git a/helm_deploy/laa-crime-evidence/values-uat.yaml b/helm_deploy/laa-crime-evidence/values-uat.yaml index 2415213..c8661ce 100644 Binary files a/helm_deploy/laa-crime-evidence/values-uat.yaml and b/helm_deploy/laa-crime-evidence/values-uat.yaml differ