7.2.0
This commit is contained in:
@@ -82,6 +82,20 @@ class decort_k8s(DecortController):
|
||||
self.acc_id = self.k8s_info['accountId']
|
||||
# check workers and groups for add or remove?
|
||||
|
||||
aparam_sysctl = arg_amodule.params['lb_sysctl']
|
||||
if aparam_sysctl is not None:
|
||||
_, lb_info = self._lb_get_by_id(lb_id=self.k8s_info['lbId'])
|
||||
sysctl_with_str_values = {
|
||||
k: str(v) for k, v in aparam_sysctl.items()
|
||||
}
|
||||
if sysctl_with_str_values != lb_info['sysctlParams']:
|
||||
self.message(
|
||||
'Check for parameter "lb_sysctl" failed: '
|
||||
'cannot change lb_sysctl for an existing cluster '
|
||||
'load balancer.'
|
||||
)
|
||||
self.exit(fail=True)
|
||||
|
||||
if not self.k8s_id:
|
||||
validated_k8ci_id = self.k8s_k8ci_find(arg_amodule.params['k8ci_id'])
|
||||
if not validated_k8ci_id:
|
||||
@@ -96,6 +110,17 @@ class decort_k8s(DecortController):
|
||||
self.result['msg'] = "At least one worker group must be present"
|
||||
self.amodule.fail_json(**self.result)
|
||||
|
||||
if (
|
||||
arg_amodule.params['lb_sysctl'] is not None
|
||||
and not arg_amodule.params['with_lb']
|
||||
):
|
||||
self.message(
|
||||
'Check for parameter "lb_sysctl" failed: '
|
||||
'"lb_sysctl" can only be set if the parameter "with_lb" '
|
||||
'is set to True.'
|
||||
)
|
||||
self.exit(fail=True)
|
||||
|
||||
return
|
||||
|
||||
def package_facts(self,check_mode=False):
|
||||
@@ -129,6 +154,7 @@ class decort_k8s(DecortController):
|
||||
ret_dict['account_id'] = self.acc_id
|
||||
ret_dict['k8s_Masters'] = self.k8s_info['k8sGroups']['masters']
|
||||
ret_dict['k8s_Workers'] = self.k8s_info['k8sGroups']['workers']
|
||||
ret_dict['lb_id'] = self.k8s_info['lbId']
|
||||
|
||||
return ret_dict
|
||||
|
||||
@@ -200,6 +226,7 @@ class decort_k8s(DecortController):
|
||||
self.amodule.params['description'],
|
||||
self.amodule.params['extnet_only'],
|
||||
master_chipset,
|
||||
lb_sysctl=self.amodule.params['lb_sysctl'],
|
||||
)
|
||||
|
||||
if not k8s_id:
|
||||
@@ -216,10 +243,12 @@ class decort_k8s(DecortController):
|
||||
|
||||
if self.k8s_id:
|
||||
self.k8s_should_exist = True
|
||||
self.k8s_workers_modify(
|
||||
arg_k8swg=self.k8s_info,
|
||||
arg_modwg=target_wgs,
|
||||
)
|
||||
if len(target_wgs) > 1:
|
||||
self.k8s_workers_modify(
|
||||
arg_k8swg=self.k8s_info,
|
||||
arg_modwg=target_wgs,
|
||||
)
|
||||
self.k8s_info = self.k8s_get_by_id(k8s_id=self.k8s_id)
|
||||
return
|
||||
|
||||
def destroy(self):
|
||||
@@ -230,11 +259,21 @@ class decort_k8s(DecortController):
|
||||
|
||||
def action(self, disared_state, started=True, preupdate: bool = False):
|
||||
if self.amodule.params['master_chipset'] is not None:
|
||||
self.result['msg'] = (
|
||||
'"master_chipset" parameter must not be specified '
|
||||
'when modifying an existing K8s cluster.'
|
||||
)
|
||||
self.exit(fail=True)
|
||||
for master_node in self.k8s_info['k8sGroups']['masters'][
|
||||
'detailedInfo'
|
||||
]:
|
||||
_, master_node_info, _ = self._compute_get_by_id(
|
||||
comp_id=master_node['id']
|
||||
)
|
||||
if (
|
||||
master_node_info['chipset']
|
||||
!= self.amodule.params['master_chipset']
|
||||
):
|
||||
self.result['msg'] = (
|
||||
'"master_chipset" cannot be changed '
|
||||
'for existing K8s cluster.'
|
||||
)
|
||||
self.exit(fail=True)
|
||||
|
||||
if preupdate:
|
||||
# K8s info updating
|
||||
@@ -434,6 +473,9 @@ class decort_k8s(DecortController):
|
||||
type='str',
|
||||
choices=['Q35', 'i440fx'],
|
||||
),
|
||||
lb_sysctl=dict(
|
||||
type='dict',
|
||||
),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
required_one_of=[
|
||||
|
||||
Reference in New Issue
Block a user