Merge "Add support to sysinv-conductor to update static images"
This commit is contained in:
@@ -1560,6 +1560,8 @@ ANSIBLE_KUBE_PUSH_IMAGES_PLAYBOOK = \
|
|||||||
'/usr/share/ansible/stx-ansible/playbooks/push_k8s_images.yml'
|
'/usr/share/ansible/stx-ansible/playbooks/push_k8s_images.yml'
|
||||||
ANSIBLE_PLATFORM_BACKUP_PLAYBOOK = \
|
ANSIBLE_PLATFORM_BACKUP_PLAYBOOK = \
|
||||||
'/usr/share/ansible/stx-ansible/playbooks/backup.yml'
|
'/usr/share/ansible/stx-ansible/playbooks/backup.yml'
|
||||||
|
ANSIBLE_KUBE_STATIC_IMAGES_PLAYBOOK = \
|
||||||
|
'/usr/share/ansible/stx-ansible/playbooks/upgrade-static-images.yml'
|
||||||
|
|
||||||
# Clock synchronization types
|
# Clock synchronization types
|
||||||
NTP = 'ntp'
|
NTP = 'ntp'
|
||||||
|
@@ -5354,6 +5354,7 @@ class ConductorManager(service.PeriodicService):
|
|||||||
LOG.info("Tiller deployment has been patched")
|
LOG.info("Tiller deployment has been patched")
|
||||||
|
|
||||||
def _upgrade_downgrade_kube_components(self):
|
def _upgrade_downgrade_kube_components(self):
|
||||||
|
self._upgrade_downgrade_static_images()
|
||||||
self._upgrade_downgrade_tiller()
|
self._upgrade_downgrade_tiller()
|
||||||
self._upgrade_downgrade_kube_networking()
|
self._upgrade_downgrade_kube_networking()
|
||||||
|
|
||||||
@@ -5498,6 +5499,46 @@ class ConductorManager(service.PeriodicService):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@retry(retry_on_result=lambda x: x is False,
|
||||||
|
wait_fixed=(CONF.conductor.kube_upgrade_downgrade_retry_interval * 1000))
|
||||||
|
def _upgrade_downgrade_static_images(self):
|
||||||
|
try:
|
||||||
|
# Get the kubernetes version from the upgrade table
|
||||||
|
# if an upgrade exists
|
||||||
|
kube_upgrade = self.dbapi.kube_upgrade_get_one()
|
||||||
|
kube_version = \
|
||||||
|
kubernetes.get_kube_networking_upgrade_version(kube_upgrade)
|
||||||
|
except exception.NotFound:
|
||||||
|
# Not upgrading kubernetes, get the kubernetes version
|
||||||
|
# from the kubeadm config map
|
||||||
|
kube_version = self._kube.kube_get_kubernetes_version()
|
||||||
|
|
||||||
|
if not kube_version:
|
||||||
|
LOG.error("Unable to get the current kubernetes version.")
|
||||||
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
|
LOG.info("_upgrade_downgrade_kube_static_images executing"
|
||||||
|
" playbook: %s for version %s" %
|
||||||
|
(constants.ANSIBLE_KUBE_STATIC_IMAGES_PLAYBOOK, kube_version))
|
||||||
|
|
||||||
|
proc = subprocess.Popen(
|
||||||
|
['ansible-playbook', '-e', 'kubernetes_version=%s' % kube_version,
|
||||||
|
constants.ANSIBLE_KUBE_STATIC_IMAGES_PLAYBOOK],
|
||||||
|
stdout=subprocess.PIPE)
|
||||||
|
out, _ = proc.communicate()
|
||||||
|
|
||||||
|
LOG.info("ansible-playbook: %s." % out)
|
||||||
|
|
||||||
|
if proc.returncode:
|
||||||
|
raise Exception("ansible-playbook returned an error: %s" % proc.returncode)
|
||||||
|
except Exception as e:
|
||||||
|
LOG.error("Failed to upgrade/downgrade kubernetes "
|
||||||
|
"static images: {}".format(e))
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def check_nodes_stable(self):
|
def check_nodes_stable(self):
|
||||||
hosts = self.dbapi.ihost_get_list()
|
hosts = self.dbapi.ihost_get_list()
|
||||||
if (utils.is_host_simplex_controller(hosts[0]) and
|
if (utils.is_host_simplex_controller(hosts[0]) and
|
||||||
|
Reference in New Issue
Block a user