def test_is_kube_version_supported(self): self.assertTrue(kube.is_kube_version_supported('v1.42.3', 'v1.42.1', 'v1.43.1')) self.assertTrue(kube.is_kube_version_supported('v1.42.3', 'v1.42.3', 'v1.42.3')) self.assertTrue(kube.is_kube_version_supported('v1.42.3', 'v1.42.1', None)) self.assertTrue(kube.is_kube_version_supported('v1.42.3', None, 'v1.43.1')) self.assertTrue(kube.is_kube_version_supported('v1.42.3', None, None)) self.assertFalse(kube.is_kube_version_supported('v1.42.3', 'v1.42.1', 'v1.42.2')) self.assertFalse(kube.is_kube_version_supported('v1.42.3', 'v1.42.2', 'v1.42.2')) self.assertFalse(kube.is_kube_version_supported('v1.42.3', 'v1.43.1', None)) self.assertFalse(kube.is_kube_version_supported('v1.42.3', None, 'v1.41.5'))
def _check_installed_apps_compatibility(apps, kube_version): """Checks whether all installed applications are compatible with the new k8s version""" for app in apps: if app.status != constants.APP_APPLY_SUCCESS: continue kube_min_version, kube_max_version = \ cutils.get_app_supported_kube_version(app.name, app.app_version) if not kubernetes.is_kube_version_supported( kube_version, kube_min_version, kube_max_version): raise wsme.exc.ClientSideError( _("The installed Application %s (%s) is incompatible with the " "new Kubernetes version %s." % (app.name, app.app_version, kube_version)))
def _check_app_compatibility(self, app_name, app_version): """Checks whether the application is compatible with the current k8s version""" kube_min_version, kube_max_version = \ cutils.get_app_supported_kube_version(app_name, app_version) if not kube_min_version and not kube_max_version: return version_states = self._kube_operator.kube_get_version_states() for kube_version, state in version_states.items(): if state in [ kubernetes.KUBE_STATE_ACTIVE, kubernetes.KUBE_STATE_PARTIAL ]: if not kubernetes.is_kube_version_supported( kube_version, kube_min_version, kube_max_version): raise exception.IncompatibleKubeVersion( name=app_name, version=app_version, kube_version=kube_version)