Files
chart/library/ix-dev/charts/collabora/templates/_migration.tpl
Stavros Kois 795dbd0234 collabora - migrate library (#2084)
* initial commit

* common files

* templates

* typo

* add migration

* todo

* envs

* fixeas

* cool user

* typo

* reduce logging

* setpcap

* uniq mount points

* fix path

* caps for nginx

* nginx caps

* nginx

* add metadata

* add ui

* bump version

* portal

* test values

* add migration

* fix checks

* wait for collab

* fix migration

* version bump

* add default dictionaries

* custom params
2024-01-31 10:10:09 +02:00

36 lines
1.3 KiB
Smarty

{{- define "collabora.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 "collabora.migration" -}}
{{- $versions := (fromYaml (include "collabora.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 .2.30 */}}
{{- if and (eq $oldV.Major 1) (or (ne $oldV.Minor 2) (lt ($oldV.Patch | int) 30)) -}}
{{/* Block the upgrade */}}
{{- fail "Migration to 2.x.x is only allowed from 1.2.30 or higher" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}