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
58a796ab
Commit
58a796ab
authored
Feb 03, 2021
by
Waqar Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update nextcloud chart migrating it to newer storage format
parent
7db9059e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
137 additions
and
264 deletions
+137
-264
test/nextcloud/1.1.0/migrations/migrate
test/nextcloud/1.1.0/migrations/migrate
+23
-0
test/nextcloud/1.1.0/questions.yaml
test/nextcloud/1.1.0/questions.yaml
+93
-78
test/nextcloud/1.1.0/templates/_backup.tpl
test/nextcloud/1.1.0/templates/_backup.tpl
+0
-0
test/nextcloud/1.1.0/templates/_helpers.tpl
test/nextcloud/1.1.0/templates/_helpers.tpl
+0
-114
test/nextcloud/1.1.0/templates/_postgres.tpl
test/nextcloud/1.1.0/templates/_postgres.tpl
+10
-4
test/nextcloud/1.1.0/templates/_upgrade.tpl
test/nextcloud/1.1.0/templates/_upgrade.tpl
+0
-21
test/nextcloud/1.1.0/templates/backup-postgres-hook.yaml
test/nextcloud/1.1.0/templates/backup-postgres-hook.yaml
+3
-7
test/nextcloud/1.1.0/templates/deployment.yaml
test/nextcloud/1.1.0/templates/deployment.yaml
+4
-20
test/nextcloud/1.1.0/templates/postgres-deployment.yaml
test/nextcloud/1.1.0/templates/postgres-deployment.yaml
+4
-20
No files found.
test/nextcloud/1.1.0/migrations/migrate
0 → 100755
View file @
58a796ab
#!/usr/bin/python3
import
json
import
sys
def
migrate
(
values
):
values
.
update
({
'appVolumeMounts'
:
{
'nextcloud-data'
:
{
'hostPathEnabled'
:
values
[
'nextcloudDataHostPathEnabled'
],
**
({
'hostPath'
:
values
[
'nextcloudHostPath'
]}
if
values
.
get
(
'nextcloudHostPath'
)
else
{})
},
},
'updateStrategy'
:
values
.
get
(
'nextcloud'
).
get
(
'strategy'
,
'Recreate'
),
})
return
values
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
!=
2
:
exit
(
1
)
print
(
json
.
dumps
(
migrate
(
json
.
loads
(
sys
.
argv
[
1
]))))
test/nextcloud/1.1.0/questions.yaml
View file @
58a796ab
...
@@ -9,6 +9,8 @@ groups:
...
@@ -9,6 +9,8 @@ groups:
description
:
"
Configure
nextcloud
container
parameters"
description
:
"
Configure
nextcloud
container
parameters"
-
name
:
"
Postgresql
Configuration"
-
name
:
"
Postgresql
Configuration"
description
:
"
Configure
Postgresql
for
nextcloud"
description
:
"
Configure
Postgresql
for
nextcloud"
-
name
:
"
Scaling/Upgrade
Policy"
description
:
"
Configure
how
pods
are
replaced
when
configuration
is
upgraded"
portals
:
portals
:
web_portal
:
web_portal
:
...
@@ -94,16 +96,20 @@ questions:
...
@@ -94,16 +96,20 @@ questions:
type
:
path
type
:
path
default
:
"
/var/www/html/data"
default
:
"
/var/www/html/data"
required
:
true
required
:
true
-
variable
:
strategy
label
:
"
Nextcloud
update
strategy"
# Update strategy
schema
:
-
variable
:
updateStrategy
type
:
string
description
:
"
Upgrade
Policy"
default
:
"
Recreate"
label
:
"
Update
Strategy"
enum
:
group
:
"
Scaling/Upgrade
Policy"
-
value
:
"
RollingUpdate"
schema
:
description
:
"
Create
new
pods
and
then
kill
old
ones"
type
:
string
-
value
:
"
Recreate"
default
:
"
Recreate"
description
:
"
Kill
existing
pods
before
creating
new
ones"
enum
:
-
value
:
"
RollingUpdate"
description
:
"
Create
new
pods
and
then
kill
old
ones"
-
value
:
"
Recreate"
description
:
"
Kill
existing
pods
before
creating
new
ones"
-
variable
:
service
-
variable
:
service
description
:
"
Nextcloud
Service
Configuration"
description
:
"
Nextcloud
Service
Configuration"
...
@@ -122,80 +128,89 @@ questions:
...
@@ -122,80 +128,89 @@ questions:
default
:
9001
default
:
9001
required
:
true
required
:
true
-
variable
:
nextcloudDataHostPathEnabled
-
variable
:
appVolumeMounts
label
:
"
Configure
Host
Path
for
Nextcloud
data"
label
:
"
Nextcloud
Storage"
group
:
"
Storage"
schema
:
type
:
boolean
default
:
false
show_subquestions_if
:
true
subquestions
:
-
variable
:
nextcloudHostPath
label
:
"
Specify
HostPath
for
Nextcloud
data"
schema
:
type
:
hostpath
-
variable
:
nextcloudDataVolume
label
:
"
Nextcloud
Data
Volume
Defaults"
group
:
"
Storage"
schema
:
type
:
dict
$ref
:
-
"
normalize/ixVolume"
show_if
:
[[
"
nextcloudDataHostPathEnabled"
,
"
="
,
false
]]
attrs
:
-
variable
:
mountPath
label
:
"
Nextcloud
Data
Mount
Path"
description
:
"
Path
where
the
volume
will
be
mounted
inside
the
pod"
schema
:
type
:
path
editable
:
false
default
:
"
/var/www"
-
variable
:
datasetName
label
:
"
Nextcloud
Dataset
Name"
schema
:
type
:
string
default
:
"
ix-nextcloud_data"
editable
:
false
-
variable
:
postgresBackupVolume
label
:
"
Postgres
Backup
Volume
Defaults"
group
:
"
Storage"
group
:
"
Storage"
schema
:
schema
:
type
:
dict
type
:
dict
$ref
:
-
"
normalize/ixVolume"
attrs
:
attrs
:
-
variable
:
mountPath
-
variable
:
nextcloud-data
label
:
"
Postgres
Backup
Mount
Path"
label
:
"
Nextcloud
Data
Volume"
schema
:
schema
:
type
:
path
type
:
dict
editable
:
false
attrs
:
default
:
"
/postgres_backups"
-
variable
:
datasetName
-
variable
:
datasetName
label
:
"
Nextcloud
Data
Volume
Name"
label
:
"
Postgres
Backup
Dataset
Name"
schema
:
schema
:
type
:
string
type
:
string
$ref
:
default
:
"
ix-postgres_backups"
-
"
normalize/ixVolume"
editable
:
false
show_if
:
[[
"
hostPathEnabled"
,
"
="
,
false
]]
default
:
"
ix-nextcloud_data"
editable
:
false
-
variable
:
mountPath
label
:
"
Nextcloud
Data
Mount
Path"
description
:
"
Path
where
the
volume
will
be
mounted
inside
the
pod"
schema
:
type
:
path
editable
:
false
default
:
"
/var/www"
-
variable
:
hostPathEnabled
label
:
"
Enable
Host
Path
for
Nextcloud
Data
Volume"
schema
:
type
:
boolean
default
:
false
show_subquestions_if
:
true
subquestions
:
-
variable
:
hostPath
label
:
"
Host
Path
for
Nextcloud
Data
Volume"
schema
:
type
:
hostpath
required
:
true
-
variable
:
postgres
DataVolume
-
variable
:
postgres
AppVolumeMounts
label
:
"
Postgres
ql
Data
Volume
Defaults
"
label
:
"
Postgres
Storage
"
group
:
"
Storage"
group
:
"
Storage"
schema
:
schema
:
type
:
dict
type
:
dict
$ref
:
-
"
normalize/ixVolume"
attrs
:
attrs
:
-
variable
:
mountPath
-
variable
:
postgres-data
label
:
"
Postgres
Mount
Path"
label
:
"
Postgres
Data
Volume"
schema
:
schema
:
type
:
path
type
:
dict
editable
:
false
attrs
:
default
:
"
/var/lib/postgresql/data"
-
variable
:
datasetName
-
variable
:
datasetName
label
:
"
Postgres
Data
Volume
Name"
label
:
"
Postgres
Dataset
Name"
schema
:
schema
:
type
:
string
type
:
string
$ref
:
default
:
"
ix-postgres_data"
-
"
normalize/ixVolume"
editable
:
false
default
:
"
ix-postgres_data"
editable
:
false
-
variable
:
mountPath
label
:
"
Postgresql
Data
Mount
Path"
description
:
"
Path
where
the
volume
will
be
mounted
inside
the
pod"
schema
:
type
:
path
editable
:
false
default
:
"
/var/lib/postgresql/data"
-
variable
:
postgres-backup
label
:
"
Postgres
Backup
Volume"
schema
:
type
:
dict
attrs
:
-
variable
:
datasetName
label
:
"
Postgres
Backup
Volume
Name"
schema
:
type
:
string
$ref
:
-
"
normalize/ixVolume"
default
:
"
ix-postgres_backups"
editable
:
false
-
variable
:
mountPath
label
:
"
Postgresql
Backup
Mount
Path"
description
:
"
Path
where
the
volume
will
be
mounted
inside
the
pod"
schema
:
type
:
path
editable
:
false
default
:
"
/postgres_backups"
test/nextcloud/1.1.0/templates/_backup.tpl
deleted
100644 → 0
View file @
7db9059e
test/nextcloud/1.1.0/templates/_helpers.tpl
deleted
100644 → 0
View file @
7db9059e
{{
/*
vim
:
set
filetype
=
mustache
:
*/
}}
{
{
/*
Expand
the
name
of
the
chart
.
*/
}
}
{{- define "nextcloud.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{
{
/*
Create
a
default
fully
qualified
app
name
.
We
truncate
at
63
chars
because
some
Kubernetes
name
fields
are
limited
to
this
(
by
the
DNS
naming
spec
).
If
release
name
contains
chart
name
it
will
be
used
as
a
full
name
.
*/
}
}
{{- define "nextcloud.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{
{
/*
Create
a
default
fully
qualified
app
name
.
We
truncate
at
63
chars
because
some
Kubernetes
name
fields
are
limited
to
this
(
by
the
DNS
naming
spec
).
*/
}
}
{{- define "nextcloud.mariadb.fullname" -}}
{{- printf "%s-%s" .Release.Name "mariadb" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{
{
/*
Create
a
default
fully
qualified
redis
app
name
.
We
truncate
at
63
chars
because
some
Kubernetes
name
fields
are
limited
to
this
(
by
the
DNS
naming
spec
).
*/
}
}
{{- define "nextcloud.redis.fullname" -}}
{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{
{
/*
Create
chart
name
and
version
as
used
by
the
chart
label
.
*/
}
}
{{- define "nextcloud.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{
{
/*
Retrieve
host
path
from
ix
volumes
based
on
dataset
name
*/
}
}
{{- define "retrieveHostPathFromiXVolume" -}}
{{- range $index, $hostPathConfiguration := $.ixVolumes }}
{{- $dsName := base $hostPathConfiguration.hostPath -}}
{{- if eq $.datasetName $dsName -}}
{{- $hostPathConfiguration.hostPath -}}
{{- end -}}
{{- end -}}
{{- end -}}
{
{
/*
Retrieve
host
path
defined
in
volume
*/
}
}
{{- define "configuredHostPath" -}}
{{- if .Values.emptyDirVolumes -}}
{{- printf "" -}}
{{- else if .Values.nextcloudDataHostPathEnabled -}}
{{- required "Please specify a host path for nextcloud" .Values.nextcloudHostPath -}}
{{- else -}}
{{- $volDict := dict "datasetName" $.Values.nextcloudDataVolume.datasetName "ixVolumes" $.Values.ixVolumes -}}
{{- include "retrieveHostPathFromiXVolume" $volDict -}}
{{- end -}}
{{- end -}}
{
{
/*
Retrieve
backup
postgresql
host
path
defined
in
volume
*/
}
}
{{- define "configuredBackupPostgresHostPath" -}}
{{- if .Values.emptyDirVolumes -}}
{{- printf "" -}}
{{- else -}}
{{- $volDict := dict "datasetName" $.Values.postgresBackupVolume.datasetName "ixVolumes" $.Values.ixVolumes -}}
{{- include "retrieveHostPathFromiXVolume" $volDict -}}
{{- end -}}
{{- end -}}
{
{
/*
Retrieve
postgresql
data
host
path
defined
in
volume
*/
}
}
{{- define "configuredPostgresHostPath" -}}
{{- if .Values.emptyDirVolumes -}}
{{- printf "" -}}
{{- else -}}
{{- $volDict := dict "datasetName" $.Values.postgresDataVolume.datasetName "ixVolumes" $.Values.ixVolumes -}}
{{- include "retrieveHostPathFromiXVolume" $volDict -}}
{{- end -}}
{{- end -}}
{
{
/*
Selector
labels
*/
}
}
{{- define "nextcloud.selectorLabels" -}}
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{
{
/*
Nextcloud
service
account
*/
}
}
{{- define "nextcloud.serviceAccountName" -}}
{{- printf "%s-service-account" .Release.Name -}}
{{- end -}}
test/nextcloud/1.1.0/templates/_postgres.tpl
View file @
58a796ab
...
@@ -36,8 +36,14 @@ Retrieve postgres credentials for environment variables configuration
...
@@ -36,8 +36,14 @@ Retrieve postgres credentials for environment variables configuration
Retrieve
postgres
volume
configuration
Retrieve
postgres
volume
configuration
*/
}
}
*/
}
}
{{- define "postgres.volumeConfiguration" -}}
{{- define "postgres.volumeConfiguration" -}}
{{ $vols := list }}
{{ include "common.storage.configureAppVolumes" (dict "appVolumeMounts" .Values.postgresAppVolumeMounts "emptyDirVolumes" .Values.emptyDirVolumes "ixVolumes" .Values.ixVolumes) | nindent 0 }}
{{ $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 -}}
{{- end -}}
{
{
/*
Retrieve
postgres
volume
mounts
configuration
*/
}
}
{{- define "postgres.volumeMountsConfiguration" -}}
{{ include "common.storage.configureAppVolumeMountsInContainer" (dict "appVolumeMounts" .Values.postgresAppVolumeMounts ) | nindent 0 }}
{{- end -}}
test/nextcloud/1.1.0/templates/_upgrade.tpl
deleted
100644 → 0
View file @
7db9059e
{{
/*
Retrieve
previous
chart
version
from
which
we
are
upgrading
to
a
newer
chart
version
*/
}}
{{- define "tn.chart.old_version" -}}
{{- if .Values.ixChartContext.is_upgrade -}}
{{- .Values.ixChartContext.upgradeMetadata.oldChartVersion -}}
{{- else -}}
{{- fail "A chart upgrade is not taking place" -}}
{{- end -}}
{{- end -}}
{
{
/*
Retrieve
new
chart
version
to
which
we
are
upgrading
from
an
old
chart
version
*/
}
}
{{- define "tn.chart.new_version" -}}
{{- if .Values.ixChartContext.is_upgrade -}}
{{- .Values.ixChartContext.upgradeMetadata.newChartVersion -}}
{{- else -}}
{{- fail "A chart upgrade is not taking place" -}}
{{- end -}}
{{- end -}}
test/nextcloud/1.1.0/templates/backup-postgres-hook.yaml
View file @
58a796ab
{{
- if .Values.ixChartContext.isUpgrade -
}}
{{
- if .Values.ixChartContext.isUpgrade -
}}
{{
$values
:
=
.
}}
{{
$values
:
=
(. | mustDeepCopy)
}}
{{
$_
:
= set $values "
nameSuffix" "postgres"
}}
{{
$_
:
= set $values "
common" (dict "nameSuffix" "postgres")
}}
apiVersion
:
batch/v1
apiVersion
:
batch/v1
kind
:
Job
kind
:
Job
metadata
:
metadata
:
...
@@ -24,11 +24,7 @@ spec:
...
@@ -24,11 +24,7 @@ spec:
env
:
{{
include "postgres.envVariableConfiguration" $values | nindent 10
}}
env
:
{{
include "postgres.envVariableConfiguration" $values | nindent 10
}}
-
name
:
BACKUP_NAME
-
name
:
BACKUP_NAME
value
:
{{
template "postgres.backupName" .
}}
value
:
{{
template "postgres.backupName" .
}}
volumeMounts
:
volumeMounts
:
{{
include "postgres.volumeMountsConfiguration" $values | nindent 10
}}
-
name
:
postgres-data
mountPath
:
/var/lib/postgresql/data
-
name
:
postgres-backup
mountPath
:
/postgres_backups
-
name
:
backup-script-configmap
-
name
:
backup-script-configmap
mountPath
:
/bin/backup_entrypoint.sh
mountPath
:
/bin/backup_entrypoint.sh
readOnly
:
true
readOnly
:
true
...
...
test/nextcloud/1.1.0/templates/deployment.yaml
View file @
58a796ab
{{
$postgres_values
:
= (. | mustDeepCopy)
}}
{{
$postgres_values
:
= (. | mustDeepCopy)
}}
{{
$_
:
= set $postgres_values "common" (dict "nameSuffix" "postgres")
}}
{{
$_
:
= set $postgres_values "common" (dict "nameSuffix" "postgres")
}}
apiVersion
:
{{
include "common.capabilities.deployment.apiVersion" .
}}
{{
include "common.deployment.common_config" . | nindent 0
}}
kind
:
Deployment
spec
:
{{
include "common.deployment.common_spec" . | nindent 2
}}
metadata
:
template
:
{{
include "common.deployment.pod.metadata" . | nindent 4
}}
name
:
{{
template "common.names.fullname" .
}}
labels
:
{{
include "common.labels" . | nindent 4
}}
annotations
:
{{
include "common.annotations" . | nindent 4
}}
spec
:
replicas
:
1
strategy
:
type
:
{{
.Values.nextcloud.strategy
}}
selector
:
matchLabels
:
{{
include "common.labels.selectorLabels" . | nindent 6
}}
template
:
metadata
:
labels
:
{{
include "common.labels.selectorLabels" . | nindent 8
}}
annotations
:
{{
include "common.annotations" . | nindent 8
}}
spec
:
spec
:
initContainers
:
initContainers
:
-
name
:
init-postgresdb
-
name
:
init-postgresdb
...
@@ -61,10 +48,7 @@ spec:
...
@@ -61,10 +48,7 @@ spec:
-
name
:
nextcloud-data
-
name
:
nextcloud-data
mountPath
:
/var/www/html/themes
mountPath
:
/var/www/html/themes
subPath
:
"
themes"
subPath
:
"
themes"
volumes
:
{{
include "common.storage.allAppVolumes" .Values | nindent 6
}}
{{
$vols
:
= list
}}
{{
$vols = mustAppend $vols (dict "name" "nextcloud-data" "emptyDirVolumes" .Values.emptyDirVolumes "hostPathEnabled" .Values.nextcloudDataHostPathEnabled "pathField" .Values.nextcloudHostPath "datasetName" (.Values.nextcloudDataVolume | default dict).datasetName )
}}
{{
include "common.storage.volumesConfiguration" (dict "ixVolumes" .Values.ixVolumes "volumes" $vols) | nindent 8
}}
# Will mount configuration files as www-data (id: 33) for nextcloud
# Will mount configuration files as www-data (id: 33) for nextcloud
securityContext
:
securityContext
:
fsGroup
:
33
fsGroup
:
33
test/nextcloud/1.1.0/templates/postgres-deployment.yaml
View file @
58a796ab
{{
$values
:
= (. | mustDeepCopy)
}}
{{
$values
:
= (. | mustDeepCopy)
}}
{{
$_
:
= set $values "common" (dict "nameSuffix" "postgres")
}}
{{
$_
:
= set $values "common" (dict "nameSuffix" "postgres")
}}
apiVersion
:
{{
include "common.capabilities.deployment.apiVersion" .
}}
{{
include "common.deployment.common_config" $values | nindent 0
}}
kind
:
Deployment
spec
:
{{
include "common.deployment.common_spec" $values | nindent 2
}}
metadata
:
template
:
{{
include "common.deployment.pod.metadata" $values | nindent 4
}}
name
:
{{
template "common.names.fullname" $values
}}
labels
:
{{
include "common.labels.selectorLabels" $values | nindent 4
}}
spec
:
replicas
:
1
strategy
:
type
:
{{
.Values.nextcloud.strategy
}}
selector
:
matchLabels
:
{{
- include "common.labels.selectorLabels" $values | nindent 6
}}
template
:
metadata
:
labels
:
{{
- include "common.labels.selectorLabels" $values | nindent 8
}}
annotations
:
{{
- include "common.annotations" $values | nindent 8
}}
spec
:
spec
:
containers
:
containers
:
-
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
:
{{
include "postgres.envVariableConfiguration" $values | nindent 10
}}
env
:
{{
include "postgres.envVariableConfiguration" $values | nindent 10
}}
volumeMounts
:
volumeMounts
:
{{
include "postgres.volumeMountsConfiguration" $values | nindent 10
}}
-
name
:
postgres-data
mountPath
:
/var/lib/postgresql/data
-
name
:
postgres-backup
mountPath
:
/postgres_backups
ports
:
ports
:
-
name
:
postgres-tcp
-
name
:
postgres-tcp
containerPort
:
5432
containerPort
:
5432
...
...
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