This repository has been archived on 2026-04-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
core/chart/templates/cronjob-backup.yaml
Jeffrey Smith f0dd43144e rebrand: Switchboard Core → Armature
- Rename Go module switchboard-core → armature (155+ files)
- Rename Docker image → gobha/armature
- Rename K8s resources, secrets, deployments
- Rename Prometheus metrics switchboard_* → armature_*
- Rename env vars SWITCHBOARD_ADMIN_* → ARMATURE_ADMIN_*
- Rename DB names switchboard_core* → armature*
- Update all frontend branding, notification templates, docs
- Update CI scripts, e2e tests, Keycloak realm, nginx conf
- Rename scripts/switchboard-ca.sh → scripts/armature-ca.sh
- Rename k8s/switchboard.yaml → k8s/armature.yaml
- Rename chart alerting/dashboard files
- Fix: DockerHub push uses env: binding for secret injection
- Helm chart updated (name, labels, template functions, dashboard, alerting)
- Replace favicon/icon assets with Armature brand

No functional changes. Pure mechanical rename + CI fix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 21:39:58 +00:00

96 lines
3.8 KiB
YAML

{{- if and .Values.backup.enabled (eq .Values.database.driver "postgres") }}
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ .Release.Name }}-backup
labels:
{{- include "armature.labels" . | nindent 4 }}
app.kubernetes.io/component: backup
spec:
schedule: {{ .Values.backup.schedule | quote }}
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: {{ .Values.backup.historyLimit | default 3 }}
failedJobsHistoryLimit: {{ .Values.backup.failedHistoryLimit | default 1 }}
jobTemplate:
spec:
activeDeadlineSeconds: {{ .Values.backup.activeDeadlineSeconds | default 3600 }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: backup
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 12 }}
{{- end }}
restartPolicy: OnFailure
containers:
- name: backup
image: postgres:16-alpine
command:
- /bin/sh
- -c
- |
set -e
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
FILENAME="armature-${TIMESTAMP}.sql.gz"
echo "Starting backup: ${FILENAME}"
pg_dump "${DATABASE_URL}" | gzip > "/backup/${FILENAME}"
echo "Backup written: /backup/${FILENAME} ($(du -h /backup/${FILENAME} | cut -f1))"
{{- if .Values.backup.s3.enabled }}
# Upload to S3-compatible storage
apk add --no-cache aws-cli >/dev/null 2>&1
export AWS_ACCESS_KEY_ID="${S3_ACCESS_KEY}"
export AWS_SECRET_ACCESS_KEY="${S3_SECRET_KEY}"
S3_PATH="s3://{{ .Values.backup.s3.bucket }}/{{ .Values.backup.s3.prefix }}${FILENAME}"
aws s3 cp "/backup/${FILENAME}" "${S3_PATH}" \
--endpoint-url "{{ .Values.backup.s3.endpoint }}" \
{{- if .Values.backup.s3.forcePathStyle }}
--no-verify-ssl \
{{- end }}
--region "{{ .Values.backup.s3.region }}"
echo "Uploaded to ${S3_PATH}"
{{- end }}
# Prune old local backups beyond retention
cd /backup
ls -t armature-*.sql.gz 2>/dev/null | tail -n +{{ add1 .Values.backup.retention }} | xargs -r rm -v
echo "Backup complete"
env:
- name: DATABASE_URL
value: {{ include "armature.databaseURL" . | quote }}
{{- if .Values.backup.s3.enabled }}
- name: S3_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ include "armature.secretName" . }}
key: BACKUP_S3_ACCESS_KEY
optional: true
- name: S3_SECRET_KEY
valueFrom:
secretKeyRef:
name: {{ include "armature.secretName" . }}
key: BACKUP_S3_SECRET_KEY
optional: true
{{- end }}
{{- if .Values.backup.resources }}
resources:
{{- toYaml .Values.backup.resources | nindent 16 }}
{{- end }}
volumeMounts:
- name: backup-data
mountPath: /backup
volumes:
- name: backup-data
{{- if .Values.backup.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Release.Name }}-backup
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}