Skip to content

Commit dc34cfe

Browse files
authored
Merge pull request #594 from SAP/DM01-5150
chore(DM01-5150): Support oldest GKE cluster versions
2 parents b898229 + 66ba36b commit dc34cfe

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/services/gcp/pkg/stub/handler.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,26 @@ func getExactClusterVersion(cr *v1alpha1.GKECluster, log *logrus.Entry) (string,
746746
}
747747
}
748748

749+
if cr.Spec.ClusterVersion == "oldest" {
750+
version := "" //Store the oldest available version
751+
for _, c := range config.Channels {
752+
if c.Channel == "RAPID" {
753+
for i, v := range c.ValidVersions {
754+
if i == 0 {
755+
version = v
756+
} else {
757+
sliceVersion := strings.Split(version, ".")
758+
sliceV := strings.Split(v, ".") //Compare major version at first and then minor version
759+
if (sliceVersion[1] > sliceV[1]) || (sliceVersion[1] == sliceV[1] && sliceVersion[3] > sliceV[3]) {
760+
version = v
761+
}
762+
}
763+
}
764+
return version, strings.ToLower(c.Channel), nil
765+
}
766+
}
767+
}
768+
749769
for _, c := range config.Channels {
750770
if strings.ToLower(c.Channel) == "extended" {
751771
// extended in not supported by --release-channel extended in current gcloud version

0 commit comments

Comments
 (0)