cluster_kustomization_name = cluster_name
db_vim_account = content["vim_account"]
cloud_type = db_vim_account["vim_type"]
+ nodepool_name = ""
+ if cloud_type == "aws":
+ nodepool_name = f"{cluster_name}-nodegroup"
+ cluster_name = f"{cluster_name}-cluster"
+ elif cloud_type == "gcp":
+ nodepool_name = f"nodepool-{cluster_name}"
bootstrap = op_params.get("bootstrap", True)
- if cloud_type not in ("azure", "gcp", "aws"):
+ if cloud_type in ("azure", "gcp", "aws"):
+ checkings_list = [
+ {
+ "item": "kustomization",
+ "name": cluster_kustomization_name,
+ "namespace": "managed-resources",
+ "flag": "Ready",
+ "timeout": self._odu_checkloop_kustomization_timeout,
+ "enable": True,
+ },
+ {
+ "item": f"cluster_{cloud_type}",
+ "name": cluster_name,
+ "namespace": "",
+ "flag": "Synced",
+ "timeout": self._odu_checkloop_resource_timeout,
+ "enable": True,
+ },
+ {
+ "item": f"cluster_{cloud_type}",
+ "name": cluster_name,
+ "namespace": "",
+ "flag": "Ready",
+ "timeout": self._odu_checkloop_resource_timeout,
+ "enable": True,
+ },
+ {
+ "item": "kustomization",
+ "name": f"{cluster_kustomization_name}-bstrp-fluxctrl",
+ "namespace": "managed-resources",
+ "flag": "Ready",
+ "timeout": self._odu_checkloop_kustomization_timeout,
+ "enable": bootstrap,
+ },
+ ]
+ else:
return False, "Not suitable VIM account to check cluster status"
-
- checkings_list = [
- {
- "item": "kustomization",
- "name": cluster_kustomization_name,
- "namespace": "managed-resources",
- "flag": "Ready",
- "timeout": self._odu_checkloop_kustomization_timeout,
- "enable": True,
- },
- {
- "item": f"cluster_{cloud_type}",
- "name": cluster_name,
- "namespace": "",
- "flag": "Synced",
- "timeout": self._odu_checkloop_resource_timeout,
- "enable": True,
- },
- {
- "item": f"cluster_{cloud_type}",
- "name": cluster_name,
+ if nodepool_name:
+ nodepool_check = {
+ "item": f"nodepool_{cloud_type}",
+ "name": nodepool_name,
"namespace": "",
"flag": "Ready",
"timeout": self._odu_checkloop_resource_timeout,
"enable": True,
- },
- {
- "item": "kustomization",
- "name": f"{cluster_kustomization_name}-bstrp-fluxctrl",
- "namespace": "managed-resources",
- "flag": "Ready",
- "timeout": self._odu_checkloop_kustomization_timeout,
- "enable": bootstrap,
- },
- ]
+ }
+ checkings_list.insert(3, nodepool_check)
return await self.common_check_list(checkings_list)
import asyncio
import traceback
+import yaml
from math import ceil
async def readiness_loop(self, item, name, namespace, flag, timeout):
self.logger.info("readiness_loop Enter")
self.logger.info(
- f"{item} {name}. Namespace: {namespace}. Flag: {flag}. Timeout: {timeout}"
+ f"{item} {name}. Namespace: '{namespace}'. Flag: {flag}. Timeout: {timeout}"
)
item_api_map = {
"workflow": {
"api_plural": "clusters",
"api_version": "v1beta2",
},
+ "nodepool_aws": {
+ "api_group": "eks.aws.upbound.io",
+ "api_plural": "nodegroups",
+ "api_version": "v1beta1",
+ },
+ "nodepool_gcp": {
+ "api_group": "container.gcp.upbound.io",
+ "api_plural": "nodepools",
+ "api_version": "v1beta2",
+ },
}
counter = 1
retry_time = self._odu_checkloop_retry_time
name=name,
)
if generic_object:
- # self.logger.debug(f"{yaml.safe_dump(generic_object)}")
+ self.logger.debug(f"{yaml.safe_dump(generic_object)}")
conditions = generic_object.get("status", {}).get("conditions", [])
else:
+ self.logger.debug(
+ f"Could not find {api_plural}. Name: {name}. Namespace: '{namespace}'. API: {api_group}/{api_version}"
+ )
conditions = []
self.logger.info(
f"Iteration {counter}/{max_iterations}. {item} status conditions: {conditions}"