Cleanup kustomize templates and add batch

This commit is contained in:
JLP 2025-02-26 17:02:56 -05:00
parent e97111a775
commit 11f65da54d
No known key found for this signature in database
GPG key ID: 414E00D1FF7519DC
9 changed files with 57 additions and 63 deletions

View file

@ -0,0 +1,48 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: backup
spec:
schedule: "0 3 * * *"
jobTemplate:
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: backup
image: busybox
command:
- /bin/bash
- -c
- |
echo $HEALTHCHECK_BASE_URL/${HEALTHCHECK_ID}
# Start signal
curl -fsS -m 10 --retry 5 ${HEALTHCHECK_BASE_URL}/${HEALTHCHECK_ID}/start
# Perform backup
if ! ${BACKUP_COMMAND} | gzip > /backup/${ROTATE_PREFIX}-$(date +%Y%m%d).sql.gz; then
curl -fsS -m 10 --retry 5 ${HEALTHCHECK_BASE_URL}/${HEALTHCHECK_ID}/fail
exit 1
fi
# list backups
ls /backup
# Rotate old backups
find /backup -name "${ROTATE_PREFIX}-*.sql.gz" -mtime +7 -delete
# Success signal
curl -fsS -m 10 --retry 5 ${HEALTHCHECK_BASE_URL}/${HEALTHCHECK_ID}
envFrom:
- configMapRef:
name: backup-config
- secretRef:
name: core-secrets
volumeMounts:
- mountPath: /backup
name: backup
subPath: "data"
volumes:
- name: backup
persistentVolumeClaim:
claimName: backup-pvc

View file

@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- batch.yaml
labels:
- includeSelectors: true
pairs:
app.kubernetes.io/managed-by: kustomize

View file

@ -1,5 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: config
data:

View file

@ -9,7 +9,6 @@ resources:
- secret.yaml - secret.yaml
- httproute-http.yaml - httproute-http.yaml
- httproute-https.yaml - httproute-https.yaml
# - configmap.yaml
labels: labels:
- includeSelectors: true - includeSelectors: true

View file

@ -1,5 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: config
data:

View file

@ -1,20 +0,0 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: http
spec:
parentRefs:
- name: homelab-gateway
sectionName: web
kind: Gateway
namespace: homelab
hostnames:
- web.leechpepin.com
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: web
port: 80

View file

@ -1,20 +0,0 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: https
spec:
parentRefs:
- name: homelab-gateway
sectionName: websecure
kind: Gateway
namespace: homelab
hostnames:
- web.leechpepin.com
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: web
port: 80

View file

@ -6,7 +6,6 @@ resources:
- deployment.yaml - deployment.yaml
- pvc.yaml - pvc.yaml
- secret.yaml - secret.yaml
# - configmap.yaml
labels: labels:
- includeSelectors: true - includeSelectors: true

View file

@ -1,11 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: svc
spec:
type: ClusterIP
ports:
- port: 80
name: test
targetPort: test
protocol: TCP