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
142c8354
Commit
142c8354
authored
Dec 12, 2020
by
Waqar Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a configmap for a script to take backup of postgres
parent
1f15d72c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
9 deletions
+41
-9
test/nextcloud/1.0.0/templates/backup-postgres-hook.yaml
test/nextcloud/1.0.0/templates/backup-postgres-hook.yaml
+34
-2
test/nextcloud/1.0.0/templates/nuke-deployments-hook.yaml
test/nextcloud/1.0.0/templates/nuke-deployments-hook.yaml
+2
-2
test/nextcloud/1.0.0/templates/serviceaccount.yaml
test/nextcloud/1.0.0/templates/serviceaccount.yaml
+5
-5
No files found.
test/nextcloud/1.0.0/templates/backup-postgres-hook.yaml
View file @
142c8354
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;
---
apiVersion
:
batch/v1
apiVersion
:
batch/v1
kind
:
Job
kind
:
Job
metadata
:
metadata
:
...
@@ -12,7 +28,7 @@ spec:
...
@@ -12,7 +28,7 @@ spec:
name
:
"
pre-upgrade-hook2"
name
:
"
pre-upgrade-hook2"
spec
:
spec
:
restartPolicy
:
Never
restartPolicy
:
Never
serviceAccountName
:
{{
template "nextcloud.serviceAccountName"
}}
serviceAccountName
:
"
{{
template
"nextcloud.serviceAccountName" . }}"
containers
:
containers
:
-
name
:
{{
.Chart.Name
}}
-postgres-backup
-
name
:
{{
.Chart.Name
}}
-postgres-backup
image
:
"
postgres:13.1"
image
:
"
postgres:13.1"
...
@@ -33,4 +49,20 @@ spec:
...
@@ -33,4 +49,20 @@ spec:
mountPath
:
/var/lib/postgresql/data
mountPath
:
/var/lib/postgresql/data
-
name
:
postgres-backup
-
name
:
postgres-backup
mountPath
:
/postgres_backups
mountPath
:
/postgres_backups
command
:
[
'
sh'
,
'
-c'
,
"
/docker-entrypoint.sh;
pg_dump
-U
$POSTGRES_USER
-d
{{
template
"
postgres.DatabaseName"
}}
>
/postgres_backups/update_dump;"
]
-
name
:
backup-script-configmap
mountPath
:
/bin/backup_entrypoint.sh
readOnly
:
true
subPath
:
entrypoint.sh
command
:
-
"
/bin/backup_entrypoint.sh"
volumes
:
-
name
:
postgres-data
hostPath
:
path
:
{{
template "configuredPostgresHostPath" .
}}
-
name
:
postgres-backup
hostPath
:
path
:
{{
template "configuredBackupPostgresHostPath" .
}}
-
name
:
backup-script-configmap
configMap
:
defaultMode
:
0700
name
:
"
postgres-backup-hook-config-map"
test/nextcloud/1.0.0/templates/nuke-deployments-hook.yaml
View file @
142c8354
...
@@ -12,8 +12,8 @@ spec:
...
@@ -12,8 +12,8 @@ spec:
name
:
"
pre-upgrade-hook1"
name
:
"
pre-upgrade-hook1"
spec
:
spec
:
restartPolicy
:
Never
restartPolicy
:
Never
serviceAccountName
:
{{
template "nextcloud.serviceAccountName"
}}
serviceAccountName
:
"
{{
template
"nextcloud.serviceAccountName" . }}"
containers
:
containers
:
-
name
:
kubectl
-
name
:
kubectl
image
:
"
bitnami/kubectl:1.19"
image
:
"
bitnami/kubectl:1.19"
command
:
[
"
delete"
,
"
deployment"
,
"
{{
template
"
nextcloud.fullname" .
}}
"
,
"
{{
template "nextcloud.fullname" .
}}
-postgres"
]
command
:
[
"
kubectl"
,
"
delete"
,
"
deployment"
,
"
{{
template
"
nextcloud.fullname" .
}}
"
,
"
{{
template "nextcloud.fullname" .
}}
-postgres"
]
test/nextcloud/1.0.0/templates/serviceaccount.yaml
View file @
142c8354
apiVersion
:
v1
apiVersion
:
v1
kind
:
ServiceAccount
kind
:
ServiceAccount
metadata
:
metadata
:
name
:
{{
template "nextcloud.serviceAccountName"
}}
name
:
"
{{
template
"nextcloud.serviceAccountName" . }}"
namespace
:
{{
.Release.Namespace
}}
namespace
:
{{
.Release.Namespace
}}
---
---
...
@@ -9,14 +9,14 @@ metadata:
...
@@ -9,14 +9,14 @@ metadata:
apiVersion
:
rbac.authorization.k8s.io/v1
apiVersion
:
rbac.authorization.k8s.io/v1
kind
:
RoleBinding
kind
:
RoleBinding
metadata
:
metadata
:
name
:
{{
.Release.Name
}}
-service-account-role-binding
name
:
"
{{
.Release.Name
}}-service-account-role-binding"
subjects
:
subjects
:
-
kind
:
ServiceAccount
-
kind
:
ServiceAccount
name
:
{{
template "nextcloud.serviceAccountName"
}}
name
:
"
{{
template
"nextcloud.serviceAccountName" . }}"
namespace
:
{{
.Release.Namespace
}}
namespace
:
{{
.Release.Namespace
}}
roleRef
:
roleRef
:
kind
:
Role
kind
:
Role
name
:
spinupcontainers
name
:
"
{{
.Release.Name
}}-service-account-role"
apiGroup
:
rbac.authorization.k8s.io
apiGroup
:
rbac.authorization.k8s.io
---
---
...
@@ -24,7 +24,7 @@ roleRef:
...
@@ -24,7 +24,7 @@ roleRef:
apiVersion
:
rbac.authorization.k8s.io/v1
apiVersion
:
rbac.authorization.k8s.io/v1
kind
:
Role
kind
:
Role
metadata
:
metadata
:
name
:
{{
.Release.Name
}}
-service-account-role
name
:
"
{{
.Release.Name
}}-service-account-role"
namespace
:
{{
.Release.Namespace
}}
namespace
:
{{
.Release.Namespace
}}
rules
:
rules
:
-
apiGroups
:
-
apiGroups
:
...
...
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