Files
chart/library/ix-dev/charts/nextcloud/templates/_migration.tpl
Stavros Kois fbc87af8dd nextcloud migration (#2377)
* init commit

* add deployments

* more config

* syntax err

* syntax err

* add missing func

* naming

* lint

* fix yaml

* yaml

* ci vals

* ci port

* perms

* wrong pod

* hmm

* meh

* no nginx without cert

* db stuf

* simplify

* add nots

* fixes

* add todo

* storage

* test https

* perms

* actually mount the config

* add some configs

* update values

* fsgroup

* cmaps

* update config

* init quests

* more test vals

* more questions

* nginx conf

* cron

* fix cron

* meta

* typo

* additional storage goes to cron too

* data and html

* config

* ui

* values

* fix

* add backwards compat

* make templ

* use var

* init migration

* make exec

* add todo

* handle hostpaths too

* update storage for backwards

* typo

* add redis

* cleaner storage solution

* br

* rm

* some cleanup

* backup

* whops

* fsgroup

* fix db script

* bump image

* remove test

* test

* todo

* try this

* lets try a hack

* hmm

* nope

* eof

* ofc

* hmm

* fix

* explain the hack

* update vers

* remove todo

* fix html storage

* backwards compat
2024-05-02 23:27:03 +03:00

49 lines
1.7 KiB
Smarty

{{- define "nextcloud.get-versions" -}}
{{- $oldChartVersion := "" -}}
{{- $newChartVersion := "" -}}
{{/* Safely access the context, so it wont block CI */}}
{{- if hasKey .Values.global "ixChartContext" -}}
{{- if .Values.global.ixChartContext.upgradeMetadata -}}
{{- $oldChartVersion = .Values.global.ixChartContext.upgradeMetadata.oldChartVersion -}}
{{- $newChartVersion = .Values.global.ixChartContext.upgradeMetadata.newChartVersion -}}
{{- if and (not $oldChartVersion) (not $newChartVersion) -}}
{{- fail "Upgrade Metadata is missing. Cannot proceed" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- toYaml (dict "old" $oldChartVersion "new" $newChartVersion) -}}
{{- end -}}
{{- define "nextcloud.migration" -}}
{{- $versions := (fromYaml (include "nextcloud.get-versions" $)) -}}
{{- if and $versions.old $versions.new -}}
{{- $oldV := semver $versions.old -}}
{{- $newV := semver $versions.new -}}
{{/* If new is v2.x.x */}}
{{- if eq ($newV.Major | int) 2 -}}
{{/* And old is v1.x.x, but lower than .6.61 */}}
{{- if and (eq $oldV.Major 1) (or (ne $oldV.Minor 6) (lt ($oldV.Patch | int) 61)) -}}
{{/* Block the upgrade */}}
{{- fail "Migration to 2.x.x is only allowed from 1.6.61 or higher" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- define "nextcloud.is-migration" -}}
{{- $isMigration := "" -}}
{{- $versions := (fromYaml (include "nextcloud.get-versions" $)) -}}
{{- if $versions.old -}}
{{- $oldV := semver $versions.old -}}
{{- if and (eq $oldV.Major 1) (eq ($oldV.Minor | int) 6) (eq ($oldV.Patch | int) 61) -}}
{{- $isMigration = "true" -}}
{{- end -}}
{{- end -}}
{{- $isMigration -}}
{{- end -}}