Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Charts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
魏国强
Charts
Commits
e52e28fa
Commit
e52e28fa
authored
Dec 13, 2020
by
Waqar Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use unique name for backup
parent
8d8fe11e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
17 deletions
+32
-17
test/nextcloud/1.0.0/templates/_postgres.tpl
test/nextcloud/1.0.0/templates/_postgres.tpl
+8
-0
test/nextcloud/1.0.0/templates/backup-postgres-config.yaml
test/nextcloud/1.0.0/templates/backup-postgres-config.yaml
+15
-0
test/nextcloud/1.0.0/templates/backup-postgres-hook.yaml
test/nextcloud/1.0.0/templates/backup-postgres-hook.yaml
+5
-16
test/nextcloud/1.0.0/templates/deployment.yaml
test/nextcloud/1.0.0/templates/deployment.yaml
+1
-1
test/nextcloud/1.0.0/templates/nuke-deployments-hook.yaml
test/nextcloud/1.0.0/templates/nuke-deployments-hook.yaml
+3
-0
No files found.
test/nextcloud/1.0.0/templates/_postgres.tpl
View file @
e52e28fa
...
...
@@ -13,4 +13,12 @@ app.kubernetes.io/name: {{ include "nextcloud.name" . }}-postgres
app.kubernetes.io/instance: {{ .Release.Name }}-postgres
{{- end }}
{
{
/*
Retrieve
postgres
backup
name
This
will
return
a
unique
name
based
on
revision
and
chart
numbers
specified
.
*/
}
}
{{- define "postgres.backupName" -}}
{{- $upgradeDict := .Values.ixChartContext.upgradeMetadata -}}
{{- printf "postgres-backup-from-%s-to-%s-revision-%d" $upgradeDict.oldChartVersion $upgradeDict.newChartVersion (int64 $upgradeDict.preUpgradeRevision) -}}
{{- end }}
test/nextcloud/1.0.0/templates/backup-postgres-config.yaml
0 → 100644
View file @
e52e28fa
apiVersion
:
v1
kind
:
ConfigMap
metadata
:
name
:
"
postgres-backup-hook-config-map"
annotations
:
rollme
:
{{
randAlphaNum 5 | quote
}}
data
:
entrypoint.sh
:
|-
#!/bin/sh
cmd="/docker-entrypoint.sh postgres"
eval "${cmd}" & disown;
until pg_isready; do
sleep 5;
done;
pg_dump -U $POSTGRES_USER -d {{ template "postgres.DatabaseName" . }} > /postgres_backups/$BACKUP_NAME;
test/nextcloud/1.0.0/templates/backup-postgres-hook.yaml
View file @
e52e28fa
apiVersion
:
v1
kind
:
ConfigMap
metadata
:
name
:
"
postgres-backup-hook-config-map"
data
:
entrypoint.sh
:
|-
#!/bin/sh
cmd="/docker-entrypoint.sh postgres"
eval "${cmd}" & disown;
until pg_isready; do
sleep 5;
done;
pg_dump -U $POSTGRES_USER -d {{ template "postgres.DatabaseName"}} > /postgres_backups/update_dump;
---
{{
- if .Values.ixChartContext.isUpgrade -
}}
apiVersion
:
batch/v1
kind
:
Job
metadata
:
...
...
@@ -22,6 +7,7 @@ metadata:
"
helm.sh/hook"
:
pre-upgrade
"
helm.sh/hook-weight"
:
"
1"
"
helm.sh/hook-delete-policy"
:
hook-succeeded
rollme
:
{{
randAlphaNum 5 | quote
}}
spec
:
template
:
metadata
:
...
...
@@ -44,6 +30,8 @@ spec:
secretKeyRef
:
name
:
db-details
key
:
db-password
-
name
:
BACKUP_NAME
value
:
{{
template "postgres.backupName" .
}}
volumeMounts
:
-
name
:
postgres-data
mountPath
:
/var/lib/postgresql/data
...
...
@@ -66,3 +54,4 @@ spec:
configMap
:
defaultMode
:
0700
name
:
"
postgres-backup-hook-config-map"
{{
- end -
}}
test/nextcloud/1.0.0/templates/deployment.yaml
View file @
e52e28fa
...
...
@@ -49,7 +49,7 @@ spec:
-
name
:
POSTGRES_HOST
value
:
{{
template "nextcloud.fullname" .
}}
-postgres:5432
-
name
:
POSTGRES_DB
value
:
{{
template "postgres.DatabaseName"
}}
value
:
{{
template "postgres.DatabaseName"
.
}}
-
name
:
POSTGRES_USER
valueFrom
:
secretKeyRef
:
...
...
test/nextcloud/1.0.0/templates/nuke-deployments-hook.yaml
View file @
e52e28fa
{{
- if .Values.ixChartContext.isUpgrade -
}}
apiVersion
:
batch/v1
kind
:
Job
metadata
:
...
...
@@ -6,6 +7,7 @@ metadata:
"
helm.sh/hook"
:
pre-upgrade
"
helm.sh/hook-weight"
:
"
-1"
"
helm.sh/hook-delete-policy"
:
hook-succeeded
rollme
:
{{
randAlphaNum 5 | quote
}}
spec
:
template
:
metadata
:
...
...
@@ -17,3 +19,4 @@ spec:
-
name
:
kubectl
image
:
"
bitnami/kubectl:1.19"
command
:
[
"
kubectl"
,
"
delete"
,
"
deployment"
,
"
{{
template
"
nextcloud.fullname" .
}}
"
,
"
{{
template "nextcloud.fullname" .
}}
-postgres"
]
{{
- end -
}}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment