-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
salt: Schedule daily backup on bootstrap node
- Loading branch information
1 parent
2d87ae6
commit 3fa4a32
Showing
13 changed files
with
180 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Schedule daily backup: | ||
schedule.present: | ||
- function: metalk8s.backup_node | ||
- seconds: 86400 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: backup-replication-{{ node }} | ||
namespace: kube-system | ||
labels: | ||
app.kubernetes.io/name: backup-replication | ||
app.kubernetes.io/part-of: metalk8s | ||
app.kubernetes.io/managed-by: salt | ||
spec: | ||
backoffLimit: 4 | ||
parallelism: 1 | ||
ttlSecondsAfterFinished: 120 | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: backup-replication | ||
app.kubernetes.io/part-of: metalk8s | ||
app.kubernetes.io/managed-by: salt | ||
spec: | ||
nodeName: {{ node }} | ||
containers: | ||
- name: backup-replication | ||
image: {{ image }} | ||
command: | ||
- wget | ||
- --accept="*.tar.gz" | ||
- --no-host-directories | ||
- --mirror | ||
- --ca-certificate=/certificate/ca.crt | ||
- --user=$(BACKUP_USERNAME) | ||
- --password=$(BACKUP_PASSWORD) | ||
- https://backup/ | ||
env: | ||
- name: BACKUP_USERNAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: backup-credentials | ||
key: username | ||
- name: BACKUP_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: backup-credentials | ||
key: password | ||
volumeMounts: | ||
- name: backups | ||
mountPath: /backups | ||
- name: ca-cert | ||
mountPath: /certificate | ||
workingDir: /backups | ||
restartPolicy: Never | ||
volumes: | ||
- name: backups | ||
hostPath: | ||
path: /var/lib/metalk8s/backups | ||
type: DirectoryOrCreate | ||
- name: ca-cert | ||
configMap: | ||
name: backup-ca-cert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{%- from "metalk8s/repo/macro.sls" import build_image_name with context %} | ||
{%- set master_nodes = salt.metalk8s.minions_by_role('master') %} | ||
{%- set image = build_image_name("metalk8s-utils") %} | ||
{%- for node in master_nodes | sort %} | ||
Schedule backup replication Job on {{ node }}: | ||
metalk8s_kubernetes.object_present: | ||
- name: salt://{{ slspath }}/files/job.yaml.j2 | ||
- template: jinja | ||
- defaults: | ||
node: {{ node }} | ||
image: {{ image }} | ||
{%- endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ include: | |
- metalk8s.kubernetes.kubelet | ||
- metalk8s.salt.master | ||
- metalk8s.utils | ||
- metalk8s.backup.configured |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters