35 lines
1.9 KiB
YAML
35 lines
1.9 KiB
YAML
{{ if .Release.IsUpgrade }}
|
|
{{ $chart := .Chart }}
|
|
{{ $crd := lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" "" "sgclusters.stackgres.io" }}
|
|
{{ if $crd }}
|
|
{{ $deployment := lookup "apps/v1" "Deployment" .Release.Namespace .Release.Name }}
|
|
{{ if $deployment }}
|
|
{{ if $deployment.metadata.labels }}
|
|
{{ if $deployment.metadata.labels.version }}
|
|
{{ $version := $deployment.metadata.labels.version }}
|
|
{{ if not .Values.forceUpgradeFromUnsupportedVersion }}
|
|
{{ if or (not (regexMatch "^(1\\.8\\.|1\\.9\\.|1\\.10\\.)" $version)) (and (not (eq $version $chart.Version)) (regexMatch "(-alpha[0-9]|-beta[0-9])" $version)) }}
|
|
{{ fail (print "Upgrading from version " $version " version is not supported. You may force upgrading from an unsupported version setting the parameter \"forceUpgradeFromUnsupportedVersion\" to \"true\". If you do so do it at your own risk. It has not been tested and some functionality may break. We recommend to perform security upgrades all your SGCluster as soon as possible after upgrading from an unsupported version of the operator") }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ $clusters := lookup "stackgres.io/v1" "SGCluster" "" "" }}
|
|
{{ if $clusters }}
|
|
{{ if $clusters.items }}
|
|
{{ range $cluster := $clusters.items }}
|
|
{{ if $cluster.metadata.annotations }}
|
|
{{ if (index $cluster.metadata.annotations "stackgres.io/operatorVersion") }}
|
|
{{ $version := (index $cluster.metadata.annotations "stackgres.io/operatorVersion") }}
|
|
{{ if (not (regexMatch "^(1\\.8\\.|1\\.9\\.|1\\.10\\.)" $version)) }}
|
|
{{ fail (print "Can not upgrade due to some SGCluster still at version " $version ". You have to run a SGDbOps of type securityUpgrade on those SGClusters first.") }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|