Cleanup kustomize templates and add batch
This commit is contained in:
parent
e97111a775
commit
11f65da54d
9 changed files with 57 additions and 63 deletions
48
kustomize/backups/batch.yaml
Normal file
48
kustomize/backups/batch.yaml
Normal 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
|
9
kustomize/backups/kustomization.yaml
Normal file
9
kustomize/backups/kustomization.yaml
Normal 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
|
|
@ -1,5 +0,0 @@
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: config
|
|
||||||
data:
|
|
|
@ -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
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: config
|
|
||||||
data:
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: svc
|
|
||||||
spec:
|
|
||||||
type: ClusterIP
|
|
||||||
ports:
|
|
||||||
- port: 80
|
|
||||||
name: test
|
|
||||||
targetPort: test
|
|
||||||
protocol: TCP
|
|
Loading…
Add table
Reference in a new issue