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
e659fc1d
Commit
e659fc1d
authored
Jan 30, 2021
by
Waqar Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update postgres backup configuration to use library chart
parent
2733aab5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
44 deletions
+39
-44
test/nextcloud/1.1.0/templates/_postgres.tpl
test/nextcloud/1.1.0/templates/_postgres.tpl
+22
-7
test/nextcloud/1.1.0/templates/backup-postgres-hook.yaml
test/nextcloud/1.1.0/templates/backup-postgres-hook.yaml
+11
-25
test/nextcloud/1.1.0/templates/nuke-deployments-hook.yaml
test/nextcloud/1.1.0/templates/nuke-deployments-hook.yaml
+4
-2
test/nextcloud/1.1.0/templates/postgres-deployment.yaml
test/nextcloud/1.1.0/templates/postgres-deployment.yaml
+2
-10
No files found.
test/nextcloud/1.1.0/templates/_postgres.tpl
View file @
e659fc1d
...
@@ -5,18 +5,12 @@ Get Nextloud Postgres Database Name
...
@@ -5,18 +5,12 @@ Get Nextloud Postgres Database Name
{{- print "nextcloud" -}}
{{- print "nextcloud" -}}
{{- end -}}
{{- end -}}
{
{
/*
Postgres
Selector
labels
*/
}
}
{{- define "nextcloud.postgres.selectorLabels" -}}
app.kubernetes.io/name: {{ include "nextcloud.name" . }}-postgres
app.kubernetes.io/instance: {{ .Release.Name }}-postgres
{{- end }}
{{- define "postgres.imageName" -}}
{{- define "postgres.imageName" -}}
{{- print "postgres:13.1" -}}
{{- print "postgres:13.1" -}}
{{- end -}}
{{- end -}}
{
{
/*
{
{
/*
Retrieve
postgres
backup
name
Retrieve
postgres
backup
name
This
will
return
a
unique
name
based
on
revision
and
chart
numbers
specified
.
This
will
return
a
unique
name
based
on
revision
and
chart
numbers
specified
.
...
@@ -26,3 +20,24 @@ This will return a unique name based on revision and chart numbers specified.
...
@@ -26,3 +20,24 @@ This will return a unique name based on revision and chart numbers specified.
{{- printf "postgres-backup-from-%s-to-%s-revision-%d" $upgradeDict.oldChartVersion $upgradeDict.newChartVersion (int64 $upgradeDict.preUpgradeRevision) -}}
{{- printf "postgres-backup-from-%s-to-%s-revision-%d" $upgradeDict.oldChartVersion $upgradeDict.newChartVersion (int64 $upgradeDict.preUpgradeRevision) -}}
{{- end }}
{{- end }}
{
{
/*
Retrieve
postgres
credentials
for
environment
variables
configuration
*/
}
}
{{- define "postgres.envVariableConfiguration" -}}
{{ $envList := list }}
{{ $envList = mustAppend $envList (dict "name" "POSTGRES_USER" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-user") }}
{{ $envList = mustAppend $envList (dict "name" "POSTGRES_PASSWORD" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-password") }}
{{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) }}
{{- end -}}
{
{
/*
Retrieve
postgres
volume
configuration
*/
}
}
{{- define "postgres.volumeConfiguration" -}}
{{ $vols := list }}
{{ $vols = mustAppend $vols (dict "name" "postgres-data" "emptyDirVolumes" .Values.emptyDirVolumes "hostPathEnabled" false "pathField" nil "datasetName" (.Values.postgresDataVolume | default dict).datasetName ) }}
{{ $vols = mustAppend $vols (dict "name" "postgres-backup" "emptyDirVolumes" .Values.emptyDirVolumes "hostPathEnabled" false "pathField" nil "datasetName" (.Values.postgresBackupVolume | default dict).datasetName ) }}
{{ include "common.storage.volumesConfiguration" (dict "ixVolumes" .Values.ixVolumes "volumes" $vols) }}
{{- end -}}
test/nextcloud/1.1.0/templates/backup-postgres-hook.yaml
View file @
e659fc1d
{{
- if .Values.ixChartContext.isUpgrade -
}}
{{
- if .Values.ixChartContext.isUpgrade -
}}
{{
$values
:
= .
}}
{{
$_
:
= set $values "nameSuffix" "postgres"
}}
apiVersion
:
batch/v1
apiVersion
:
batch/v1
kind
:
Job
kind
:
Job
metadata
:
metadata
:
...
@@ -14,24 +16,14 @@ spec:
...
@@ -14,24 +16,14 @@ spec:
name
:
"
pre-upgrade-hook2"
name
:
"
pre-upgrade-hook2"
spec
:
spec
:
restartPolicy
:
Never
restartPolicy
:
Never
serviceAccountName
:
"
{{
template
"
nextcloud
.serviceAccountName" . }}"
serviceAccountName
:
"
{{
template
"
common.names
.serviceAccountName" . }}"
containers
:
containers
:
-
name
:
{{
.Chart.Name
}}
-postgres-backup
-
name
:
{{
.Chart.Name
}}
-postgres-backup
image
:
{{
template "postgres.imageName" .
}}
image
:
{{
template "postgres.imageName" .
}}
imagePullPolicy
:
{{
.Values.image.pullPolicy
}}
imagePullPolicy
:
{{
.Values.image.pullPolicy
}}
env
:
env
:
{{
include "postgres.envVariableConfiguration" $values | nindent 10
}}
-
name
:
POSTGRES_USER
-
name
:
BACKUP_NAME
valueFrom
:
value
:
{{
template "postgres.backupName" .
}}
secretKeyRef
:
name
:
db-details
key
:
db-user
-
name
:
POSTGRES_PASSWORD
valueFrom
:
secretKeyRef
:
name
:
db-details
key
:
db-password
-
name
:
BACKUP_NAME
value
:
{{
template "postgres.backupName" .
}}
volumeMounts
:
volumeMounts
:
-
name
:
postgres-data
-
name
:
postgres-data
mountPath
:
/var/lib/postgresql/data
mountPath
:
/var/lib/postgresql/data
...
@@ -43,15 +35,9 @@ spec:
...
@@ -43,15 +35,9 @@ spec:
subPath
:
entrypoint.sh
subPath
:
entrypoint.sh
command
:
command
:
-
"
/bin/backup_entrypoint.sh"
-
"
/bin/backup_entrypoint.sh"
volumes
:
volumes
:
{{
include "postgres.volumeConfiguration" $values | nindent 8
}}
-
name
:
postgres-data
-
name
:
backup-script-configmap
hostPath
:
configMap
:
path
:
{{
template "configuredPostgresHostPath" .
}}
defaultMode
:
0700
-
name
:
postgres-backup
name
:
"
postgres-backup-hook-config-map"
hostPath
:
path
:
{{
template "configuredBackupPostgresHostPath" .
}}
-
name
:
backup-script-configmap
configMap
:
defaultMode
:
0700
name
:
"
postgres-backup-hook-config-map"
{{
- end -
}}
{{
- end -
}}
test/nextcloud/1.1.0/templates/nuke-deployments-hook.yaml
View file @
e659fc1d
{{
- if .Values.ixChartContext.isUpgrade -
}}
{{
- if .Values.ixChartContext.isUpgrade -
}}
{{
$values
:
= .
}}
{{
$_
:
= set $values "nameSuffix" "postgres"
}}
apiVersion
:
batch/v1
apiVersion
:
batch/v1
kind
:
Job
kind
:
Job
metadata
:
metadata
:
...
@@ -14,9 +16,9 @@ spec:
...
@@ -14,9 +16,9 @@ spec:
name
:
"
pre-upgrade-hook1"
name
:
"
pre-upgrade-hook1"
spec
:
spec
:
restartPolicy
:
Never
restartPolicy
:
Never
serviceAccountName
:
"
{{
template
"
nextcloud
.serviceAccountName" . }}"
serviceAccountName
:
"
{{
template
"
common.names
.serviceAccountName" . }}"
containers
:
containers
:
-
name
:
kubectl
-
name
:
kubectl
image
:
"
bitnami/kubectl:1.19"
image
:
"
bitnami/kubectl:1.19"
command
:
[
"
kubectl"
,
"
delete"
,
"
deployment"
,
"
{{
template
"
nextcloud.fullname" .
}}
"
,
"
{{
template "nextcloud.fullname" .
}}
-postgres
"
]
command
:
[
"
kubectl"
,
"
delete"
,
"
deployment"
,
"
{{
template
"
common.names.fullname" .
}}
"
,
"
{{
template "common.names.fullname" $values
}}
"
]
{{-
end
-}}
{{-
end
-}}
test/nextcloud/1.1.0/templates/postgres-deployment.yaml
View file @
e659fc1d
...
@@ -20,11 +20,7 @@ spec:
...
@@ -20,11 +20,7 @@ spec:
-
name
:
{{
.Chart.Name
}}
-postgres
-
name
:
{{
.Chart.Name
}}
-postgres
image
:
{{
template "postgres.imageName" .
}}
image
:
{{
template "postgres.imageName" .
}}
imagePullPolicy
:
{{
.Values.image.pullPolicy
}}
imagePullPolicy
:
{{
.Values.image.pullPolicy
}}
env
:
env
:
{{
include "postgres.envVariableConfiguration" $values | nindent 10
}}
{{
$envList
:
= list
}}
{{
$envList = mustAppend $envList (dict "name" "POSTGRES_USER" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-user")
}}
{{
$envList = mustAppend $envList (dict "name" "POSTGRES_PASSWORD" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-password")
}}
{{
include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 10
}}
volumeMounts
:
volumeMounts
:
-
name
:
postgres-data
-
name
:
postgres-data
mountPath
:
/var/lib/postgresql/data
mountPath
:
/var/lib/postgresql/data
...
@@ -34,8 +30,4 @@ spec:
...
@@ -34,8 +30,4 @@ spec:
-
name
:
postgres-tcp
-
name
:
postgres-tcp
containerPort
:
5432
containerPort
:
5432
protocol
:
TCP
protocol
:
TCP
volumes
:
volumes
:
{{
include "postgres.volumeConfiguration" $values | nindent 8
}}
{{
$vols
:
= list
}}
{{
$vols = mustAppend $vols (dict "name" "postgres-data" "emptyDirVolumes" .Values.emptyDirVolumes "hostPathEnabled" false "pathField" nil "datasetName" (.Values.postgresDataVolume | default dict).datasetName )
}}
{{
$vols = mustAppend $vols (dict "name" "postgres-backup" "emptyDirVolumes" .Values.emptyDirVolumes "hostPathEnabled" false "pathField" nil "datasetName" (.Values.postgresBackupVolume | default dict).datasetName )
}}
{{
include "common.storage.volumesConfiguration" (dict "ixVolumes" .Values.ixVolumes "volumes" $vols) | nindent 8
}}
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