Skip to content

Commit

Permalink
Added backup template and values (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
AsfaMumtaz authored May 29, 2024
2 parents 0998e63 + f96f82c commit 09afd7a
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

All notable changes to this project will be documented here.

### v4.1.0
- Feature: Add Backup template [PR-296](https://github.com/stakater/application/pull/296)

### v3.0.0
- Feature: Updates the GrafanaDashboard api version to v1beta1.

Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,17 @@ Stakater [IngressMonitorController](https://github.com/stakater/IngressMonitorCo
| networkPolicy.ingress | Ingress ruels for NetworkPolicy | `[]` |
| networkPolicy.egress | egress rules for NetworkPolicy | `[]` |

### Backup Paramaters
| Name | Description | Value |
| ---- | ----------- | ----- |
| backup.enabled | Enable Backup | `false` |
| backup.namespace | Backup Namespace | `""` |
| backup.storageLocation | StorageLocation for Backup | `""` |
| backup.includedNamespaces | Namespaces to be included in Backup | `[]` |
| backup.excludedResources | Resources to be excluded in Backup | `[]` |
| backup.ttl | Time Duration for Backup | `1h0m0s` |
| backup.snapshotVolumes | Weather SnapshotVolumes in Backup | `true` |

### Grafana Dashboard Paramaters

| Name | Description | Value |
Expand Down
24 changes: 24 additions & 0 deletions application/templates/backup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if (.Values.backup).enabled }}
apiVersion: velero.io/v1
kind: Backup
metadata:
name: {{ printf "%s-backup" .Values.applicationName | trunc 63 | quote }}
namespace: {{ .Values.backup.namespace | default ( include "application.namespace" . ) | quote }}
spec:
labelSelector:
matchLabels:
{{ include "application.selectorLabels" . | indent 6 }}
includedNamespaces:
- {{ include "application.namespace" . }}
snapshotVolumes: {{ .Values.backup.snapshotVolumes | default true }}
storageLocation: {{ .Values.backup.storageLocation | quote }}
ttl: {{ .Values.backup.ttl | default "1h0m0s" }}
{{- if .Values.backup.includedResources }}
includedResources:
{{ toYaml .Values.backup.includedResources | indent 4 }}
{{- end -}}
{{- if .Values.backup.excludedResources }}
excludedResources:
{{ toYaml .Values.backup.excludedResources | indent 4 }}
{{- end -}}
{{- end }}
22 changes: 22 additions & 0 deletions application/values-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1305,3 +1305,25 @@ cronJob:
requests:
memory: 5Gi
cpu: 1

# Take backup of application namespace
backup:
namespace: openshift-adp
enabled: true
snapshotVolumes: true
storageLocation: "dpa-1"
ttl: "1h0m0s"
includedResources:
- deployments
- services
- persistentvolumeclaims
- secrets
- configmaps
excludedResources:
- daemonsets
- statefulsets
- nodes
- apiservices
- events
- resourcequotas
- controllerrevisions.apps
10 changes: 9 additions & 1 deletion application/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,7 @@ grafanaDashboard:
# "data"
# }
# url: http://hostname/path/to/file.json

# dashboard-test-name-2:
# allowCrossNamespaceImport: true
# configMapRef:
Expand All @@ -902,4 +903,11 @@ grafanaDashboard:
# folder: Storage Observability
# instanceSelector:
# matchLabels:
# app: test-2
# app: test-2

##########################################################
# Backup object for creating back using OADP/Velero
##########################################################
backup:
enabled: false

0 comments on commit 09afd7a

Please sign in to comment.