dotfiles/devops/k8s/k8s-devops.yaml

83 lines
2.1 KiB
YAML
Raw Normal View History

2021-01-15 03:57:38 +00:00
# update cloudflare dns record if ip changed on minutely basis
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: ddns
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: renew-cf-dns-record
image: devops
imagePullPolicy: IfNotPresent
args:
- renew-cf-dns-record.sh
- {EMAIL}
- {APP_KEY}
- {ZONE_ID}
- {RECORD_ID}
- {DOMAIN}
volumeMounts:
- name: tmp
mountPath: /tmp
restartPolicy: OnFailure
volumes:
- name: tmp
hostPath:
path: /tmp
---
# backup local data and remote postgres database at 6:00am everyday
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: backup
spec:
schedule: "0 6 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: backup-local-dir
image: devops
imagePullPolicy: IfNotPresent
args:
- backup-local-dir
- {BLD_ROTATE}
- {BLD_SRC_DIR}
- {BLD_DEST_DIR}
volumeMounts:
- name: bldsrcdir
mountPath: {BLD_SRC_DIR}
- name: blddestdir
mountPath: {BLD_DEST_DIR}
- name: backup-k8s-pgdbs
image: devops
imagePullPolicy: IfNotPresent
args:
- backup-k8s-pgdbs
- {BKP_ROTATE}
- {POD_APP_LABEL}
- {CONTAINER_NAME}
- {BKP_DEST_DIR}
volumeMounts:
- name: bkpdestdir
mountPath: {BKP_DEST_DIR}
restartPolicy: OnFailure
volumes:
- name: bldsrcdir
hostPath:
path: {BLD_SRC_DIR}
type: Directory
- name: blddestdir
hostPath:
path: {BLD_DEST_DIR}
type: DirectoryOrCreate
- name: bkpdestdir
hostPath:
path: {BKP_DEST_DIR}
type: DirectoryOrCreate