generated from wittdennis/repo-template-yaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95c45df
commit 21e4e26
Showing
6 changed files
with
224 additions
and
18 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
155 changes: 155 additions & 0 deletions
155
cloud/custom-resources/argo-workflows/foundry-backup-template.yaml
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,155 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/argoproj/argo-workflows/main/api/jsonschema/schema.json | ||
--- | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: WorkflowTemplate | ||
metadata: | ||
name: foundry-backup-template | ||
spec: | ||
entrypoint: main | ||
onExit: exit-handler | ||
artifactGC: | ||
strategy: OnWorkflowDeletion | ||
serviceAccountName: foundry-workflows | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
readOnlyRootFilesystem: true | ||
runAsNonRoot: true | ||
seccompProfile: | ||
type: RuntimeDefault | ||
arguments: | ||
parameters: | ||
- name: instance | ||
- name: restic-hostname | ||
- name: pvc-name | ||
volumes: | ||
- name: foundry-data | ||
persistentVolumeClaim: | ||
claimName: "{{inputs.parameters.pvc-name}}" | ||
- name: tmp | ||
emptyDir: {} | ||
templates: | ||
- name: main | ||
inputs: | ||
parameters: | ||
- name: instance | ||
steps: | ||
- - name: scale-down | ||
arguments: | ||
parameters: | ||
- name: name | ||
value: "{{inputs.parameters.instance}}" | ||
- name: replicaCount | ||
value: "0" | ||
- name: type | ||
value: deployment | ||
templateRef: | ||
template: scale-workload | ||
name: scale-workload | ||
- - name: create-backup | ||
template: archive-data | ||
- - name: upload-backup | ||
template: upload-backup | ||
arguments: | ||
parameters: | ||
- name: restic-hostname | ||
artifacts: | ||
- name: backup-archive | ||
from: "{{steps.create-backup.outputs.artifacts.backup-archive}}" | ||
|
||
- name: exit-handler | ||
inputs: | ||
parameters: | ||
- name: instance | ||
steps: | ||
- - name: scale-up | ||
arguments: | ||
parameters: | ||
- name: name | ||
value: "{{inputs.parameters.instance}}" | ||
- name: replicaCount | ||
value: "1" | ||
- name: type | ||
value: deployment | ||
templateRef: | ||
template: scale-workload | ||
name: scale-workload | ||
|
||
- name: archive-data | ||
serviceAccountName: foundry-workflows | ||
outputs: | ||
artifacts: | ||
- name: backup-archive | ||
path: /tmp/foundry-data.tar.xz | ||
s3: | ||
key: "{{workflow.name}}/foundry-data.tar.xz" | ||
container: | ||
image: denniswitt/tar:0.1.2 # renovate | ||
workingDir: /tmp | ||
command: | ||
- sh | ||
- -c | ||
args: | ||
- | | ||
set -eux | ||
tar cfJv foundry-data.tar.xz /foundry-data/Data | ||
du -sch foundry-data.tar.xz | ||
volumeMounts: | ||
- mountPath: /tmp | ||
name: tmp | ||
- mountPath: /foundry-data | ||
name: foundry-data | ||
securityContext: | ||
runAsUser: 1000 | ||
runAsGroup: 1000 | ||
allowPrivilegeEscalation: false | ||
readOnlyRootFilesystem: true | ||
runAsNonRoot: true | ||
seccompProfile: | ||
type: RuntimeDefault | ||
|
||
- name: upload-backup | ||
serviceAccountName: foundry-workflows | ||
inputs: | ||
parameters: | ||
- name: restic-hostname | ||
artifacts: | ||
- name: backup-archive | ||
path: /tmp/foundry-data.tar.xz | ||
container: | ||
image: restic/restic:0.17.3 # renovate | ||
command: [sh, -c] | ||
args: | ||
- | | ||
restic init --no-cache || true | ||
restic backup --no-cache --host {{inputs.parameters.restic-hostname}} /tmp/foundry-data.tar.xz | ||
restic forget --no-cache --keep-last 90 --prune | ||
env: | ||
- name: AZURE_ACCOUNT_NAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: backup-settings | ||
key: azure-account-name | ||
- name: AZURE_ACCOUNT_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: backup-settings | ||
key: azure-account-key | ||
- name: RESTIC_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: backup-settings | ||
key: restic-password | ||
- name: RESTIC_REPOSITORY | ||
value: azure:foundry:/ | ||
volumeMounts: | ||
- mountPath: /tmp | ||
name: tmp | ||
securityContext: | ||
runAsUser: 1000 | ||
runAsGroup: 1000 | ||
allowPrivilegeEscalation: false | ||
readOnlyRootFilesystem: true | ||
runAsNonRoot: true | ||
seccompProfile: | ||
type: RuntimeDefault |
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
38 changes: 38 additions & 0 deletions
38
cloud/custom-resources/argo-workflows/saltysausage-offsite-backup.yaml
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,38 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/argoproj/argo-workflows/main/api/jsonschema/schema.json | ||
--- | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: CronWorkflow | ||
metadata: | ||
name: saltysausage-offsite-backup | ||
spec: | ||
schedule: "30 3 * * *" | ||
concurrencyPolicy: "Replace" | ||
startingDeadlineSeconds: 0 | ||
successfulJobsHistoryLimit: 7 | ||
workflowSpec: | ||
entrypoint: main | ||
onExit: exit-handler | ||
artifactGC: | ||
strategy: OnWorkflowDeletion | ||
serviceAccountName: foundry-workflows | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
readOnlyRootFilesystem: true | ||
runAsNonRoot: true | ||
seccompProfile: | ||
type: RuntimeDefault | ||
templates: | ||
- name: main | ||
steps: | ||
- - name: scale-down | ||
arguments: | ||
parameters: | ||
- name: instance | ||
value: foundry-saltysausage | ||
- name: restic-hostname | ||
value: foundry-saltysausage | ||
- name: pvc-name | ||
value: foundry-saltysausage-data-pvc | ||
templateRef: | ||
template: foundry-backup-template | ||
name: backup |
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