This commit is contained in:
2026-05-14 14:45:06 +03:00
parent 8c554c8edd
commit a5f23d09da
3 changed files with 35 additions and 5 deletions

View File

@@ -6472,7 +6472,12 @@ class DecortController(object):
self.result['changed'] = False
return
def k8s_workers_modify(self,arg_k8swg,arg_modwg):
def k8s_workers_modify(
self,
arg_k8swg,
arg_modwg,
master_node_storage_policy_id: int | None = None,
):
self.result['waypoints'] = "{} -> {}".format(self.result['waypoints'], "k8s_workers_modify")
@@ -6586,6 +6591,12 @@ class DecortController(object):
'annotations': wg_to_create['annotations'],
'userData': json.dumps(wg_to_create['ci_user_data']),
'chipset': wg_to_create['chipset'],
'storage_policy_id': (
master_node_storage_policy_id
or self.k8s_get_master_node_storage_policy_id(
k8s_info=arg_k8swg,
)
),
}
wg_add_response = self.decort_api_call(
arg_req_function=requests.post,
@@ -6742,6 +6753,19 @@ class DecortController(object):
self.set_changed()
return api_response.json()
def k8s_get_master_node_storage_policy_id(self, k8s_info: dict) -> int:
master_nodes_info = k8s_info['k8sGroups']['masters'][
'detailedInfo'
]
if not master_nodes_info:
raise ValueError(
f'No master nodes found in K8s cluster ID {k8s_info['id']}'
)
_, master_node_info, _ = self._compute_get_by_id(
comp_id=master_nodes_info[0]['id']
)
return master_node_info['disks'][0]['storage_policy_id']
##############################
#
# Bservice management