This commit is contained in:
2026-04-27 15:37:15 +03:00
parent ae50b0cd54
commit 81e765fdb1
3 changed files with 33 additions and 165 deletions

View File

@@ -43,7 +43,7 @@ class DecortController(object):
_api: sdk_types.API | None = None
_usermanager_whoami_result: None | dict = None
ANSIBLE_MODULES_VERSION = '11.0.0'
ANSIBLE_MODULES_VERSION = '11.0.1'
COMPATIBLE_SDK_MINOR_VERSION = '1.4'
VM_RESIZE_NOT = 0
@@ -5537,7 +5537,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")
@@ -5651,6 +5656,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,
@@ -5807,6 +5818,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