Skip to content
Snippets Groups Projects
Commit d7d8bdec authored by garciadeblas's avatar garciadeblas
Browse files

Fix checks for KSU update operations


Change-Id: I4dd187183b6c5c13cfae9eab7069456a9c0733b1
Signed-off-by: default avatargarciadeblas <gerardo.garciadeblas@telefonica.com>
parent 7cf480d1
No related branches found
No related tags found
No related merge requests found
......@@ -1175,29 +1175,66 @@ class ClusterLcm(GitOpsLcm):
f"check_update_cluster Operation {op_id}. Params: {op_params}."
)
self.logger.debug(f"Content: {content}")
return await self.check_dummy_operation(op_id, op_params, content)
# db_cluster = content["cluster"]
# cluster_id = db_cluster["_id"]
# cluster_kubectl = self.cluster_kubectl(db_cluster)
# cluster_name = db_cluster["git_name"].lower()
# cluster_kustomization_name = cluster_name
# checkings_list = [
# {
# "item": "kustomization",
# "name": cluster_kustomization_name,
# "namespace": "managed-resources",
# "condition": {
# "jsonpath_filter": "status.conditions[?(@.type=='Ready')].status",
# "value": "True",
# },
# "timeout": self._checkloop_kustomization_timeout,
# "enable": True,
# "resourceState": "IN_PROGRESS.KUSTOMIZATION_READY",
# },
# ]
# return await self.common_check_list(
# op_id, checkings_list, "clusters", db_cluster, cluster_kubectl
# )
# return await self.check_dummy_operation(op_id, op_params, content)
db_cluster = content["cluster"]
cluster_name = db_cluster["git_name"].lower()
cluster_kustomization_name = cluster_name
db_vim_account = content["vim_account"]
cloud_type = db_vim_account["vim_type"]
if cloud_type == "aws":
cluster_name = f"{cluster_name}-cluster"
if cloud_type in ("azure", "gcp", "aws"):
checkings_list = [
{
"item": "kustomization",
"name": cluster_kustomization_name,
"namespace": "managed-resources",
"condition": {
"jsonpath_filter": "status.conditions[?(@.type=='Ready')].status",
"value": "True",
},
"timeout": self._checkloop_kustomization_timeout,
"enable": True,
"resourceState": "IN_PROGRESS.KUSTOMIZATION_READY",
},
]
else:
return False, "Not suitable VIM account to check cluster status"
# Scale operation
if "node_count" in op_params:
checkings_list.append(
{
"item": f"cluster_{cloud_type}",
"name": cluster_name,
"namespace": "",
"condition": {
"jsonpath_filter": "status.atProvider.defaultNodePool[0].nodeCount",
"value": f"{op_params['node_count']}",
},
"timeout": self._checkloop_resource_timeout * 2,
"enable": True,
"resourceState": "IN_PROGRESS.RESOURCE_READY.NODE_COUNT.CLUSTER",
}
)
# Upgrade operation
if "k8s_version" in op_params:
checkings_list.append(
{
"item": f"cluster_{cloud_type}",
"name": cluster_name,
"namespace": "",
"condition": {
"jsonpath_filter": "status.atProvider.defaultNodePool[0].orchestratorVersion",
"value": op_params["k8s_version"],
},
"timeout": self._checkloop_resource_timeout * 2,
"enable": True,
"resourceState": "IN_PROGRESS.RESOURCE_READY.K8S_VERSION.CLUSTER",
}
)
return await self.common_check_list(
op_id, checkings_list, "clusters", db_cluster
)
class CloudCredentialsLcm(GitOpsLcm):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment