def Compare(self, current_master_version, current_cluster_version): """Compares the cluster and master versions and returns an enum.""" if current_master_version == current_cluster_version: return self.UP_TO_DATE master_version = SemVer(current_master_version) cluster_version = SemVer(current_cluster_version) major, minor, _ = master_version.Distance(cluster_version) if major != 0 or minor > 2: return self.UNSUPPORTED elif minor > 1: return self.SUPPORT_ENDING else: return self.UPGRADE_AVAILABLE
def Compare(self, current_master_version, current_cluster_version): """Compares the cluster and master versions and returns an enum.""" # TODO(b/36051978):update the if condition when we roll the master version if current_master_version == current_cluster_version: return self.UP_TO_DATE master_version = SemVer(current_master_version) cluster_version = SemVer(current_cluster_version) major, minor, _ = master_version.Distance(cluster_version) if major != 0 or minor > 2: return self.UNSUPPORTED elif minor > 1: return self.SUPPORT_ENDING else: return self.UPGRADE_AVAILABLE
def MaybeLog122UpgradeWarning(cluster): """Logs deprecation warning for GKE v1.22 upgrades.""" if cluster is not None: cmv = SemVer(cluster.currentMasterVersion) if cmv >= SemVer('1.22.0-gke.0'): return log.status.Print( 'Upcoming breaking change: Starting with v1.22, Kubernetes has removed ' 'several v1beta1 APIs for more stable v1 APIs. Read more about this ' 'change - ' 'https://cloud.google.com/kubernetes-engine/docs/deprecations/apis-1-22. ' 'Please ensure that your cluster is not using any deprecated v1beta1 ' 'APIs prior to upgrading to GKE 1.22.')