{{ 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\\.12|1\\.13|1\\.14)\\." $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. If you are conscious of the risk of such a dangerous action we recommend to perform security upgrades of all your SGCluster and SGShardedCluster as soon as possible after upgrading from an unsupported version of the operator upgrade") }} {{ 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\\.12|1\\.13|1\\.14)\\." $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 }} {{ $shardedclusters := lookup "stackgres.io/v1" "SGShardedCluster" "" "" }} {{ if $shardedclusters }} {{ if $shardedclusters.items }} {{ range $shardedcluster := $shardedclusters.items }} {{ if $shardedcluster.metadata.annotations }} {{ if (index $shardedcluster.metadata.annotations "stackgres.io/operatorVersion") }} {{ $version := (index $shardedcluster.metadata.annotations "stackgres.io/operatorVersion") }} {{ if (not (regexMatch "^(1\\.12|1\\.13|1\\.14)\\." $version)) }} {{ fail (print "Can not upgrade due to some SGShardedCluster still at version " $version ". You have to run a SGShardedDbOps of type securityUpgrade on those SGShardedClusters first.") }} {{ end }} {{ end }} {{ end }} {{ end }} {{ end }} {{ end }} {{ end }} {{ end }}