Skip storage nodes when listing per-host k8s upgrade info
Currently when determining whether an in-progress Kubernetes upgrade can be completed, the sysinv API code will look at the status of each host to see whether it has completed the kubelet upgrade. Storage nodes are not part of the Kubernetes cluster, and therefore they should not be considered part of the Kubernetes upgrade. Accordingly, modify the kube_host_upgrade_get_list() call to filter out the storage nodes so that it only shows information about K8s upgrades for hosts that are actually part of the K8s cluster. This will also no longer display storage nodes in the output of "system kube-host-upgrade-list". Testing PASS: install with K8s 1.18, upgrade up to 1.20 (lab was reinstalled under me while upgrading to 1.21, but there's no reason to expect any problems) PASS: run "system kube-host-upgrade-list" on each k8s version Change-Id: I508b2218a4a30bde28bbbb515cb0f8746caee27a Closes-Bug: 1951324 Signed-off-by: Chris Friesen <chris.friesen@windriver.com>
This commit is contained in:
parent
defffe6f64
commit
c43c2000f2
|
@ -132,6 +132,10 @@ def do_kube_host_upgrade_list(cc, args):
|
|||
# Get the kubernetes host upgrades
|
||||
kube_host_upgrade_details = _get_kube_host_upgrade_details(cc)
|
||||
|
||||
# Keep only the hosts that have kubernetes upgrade details.
|
||||
# Storage nodes aren't part of the kubernetes cluster, for example.
|
||||
ihosts = [host for host in ihosts if host.id in kube_host_upgrade_details]
|
||||
|
||||
for host in ihosts:
|
||||
host.target_version = \
|
||||
kube_host_upgrade_details[host.id]['target_version']
|
||||
|
|
|
@ -8446,6 +8446,8 @@ class Connection(api.Connection):
|
|||
query = query.join(models.ihost,
|
||||
models.KubeHostUpgrade.host_id == models.ihost.id)
|
||||
query = query.filter(models.ihost.recordtype == "standard")
|
||||
# Filter out the storage nodes since they aren't running k8s.
|
||||
query = query.filter(models.ihost.subfunctions != "storage")
|
||||
|
||||
return _paginate_query(models.KubeHostUpgrade, limit, marker,
|
||||
sort_key, sort_dir, query)
|
||||
|
|
|
@ -193,7 +193,7 @@ class TestListKubeHostUpgrade(TestKubeHostUpgrade):
|
|||
worker = self._create_worker(mgmt_ip='192.168.24.12')
|
||||
storage = self._create_storage(mgmt_ip='192.168.24.13')
|
||||
data = self.get_json('/kube_host_upgrades')
|
||||
self.assertEqual(4, len(data['kube_host_upgrades']))
|
||||
self.assertEqual(3, len(data['kube_host_upgrades']))
|
||||
host_id = 1
|
||||
for upgrade in data['kube_host_upgrades']:
|
||||
self.assertIn('id', upgrade)
|
||||
|
|
Loading…
Reference in New Issue