File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed
Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change 44 "context"
55 "encoding/json"
66 "fmt"
7+ "strconv"
78 "strings"
89
910 "github.com/Masterminds/semver"
@@ -14,30 +15,22 @@ import (
1415 "k8s.io/apimachinery/pkg/types"
1516)
1617
17- // VersionMap Map of version numbers
18- var VersionMap = map [string ]int {
19- "14" : 140000 ,
20- "15" : 150000 ,
21- "16" : 160000 ,
22- "17" : 170000 ,
23- "18" : 180000 ,
24- }
25-
2618const (
2719 majorVersionUpgradeSuccessAnnotation = "last-major-upgrade-success"
2820 majorVersionUpgradeFailureAnnotation = "last-major-upgrade-failure"
2921)
3022
3123// IsBiggerPostgresVersion Compare two Postgres version numbers
3224func IsBiggerPostgresVersion (old string , new string ) bool {
33- oldN := VersionMap [ old ]
34- newN := VersionMap [ new ]
25+ oldN , _ := strconv . Atoi ( old )
26+ newN , _ := strconv . Atoi ( new )
3527 return newN > oldN
3628}
3729
3830// GetDesiredMajorVersionAsInt Convert string to comparable integer of PG version
3931func (c * Cluster ) GetDesiredMajorVersionAsInt () int {
40- return VersionMap [c .GetDesiredMajorVersion ()]
32+ version , _ := strconv .Atoi (c .GetDesiredMajorVersion ())
33+ return version * 10000
4134}
4235
4336// GetDesiredMajorVersion returns major version to use, incl. potential auto upgrade
You can’t perform that action at this time.
0 commit comments