diff options
Diffstat (limited to 'heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt')
-rw-r--r-- | heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt b/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt index 90330644..e2d10534 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt +++ b/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt @@ -40,7 +40,7 @@ open class SimpleStatusCheck : AbstractScriptComponentFunction() { val configValueSetup: ObjectNode = getDynamicProperties("config-deploy-setup") as ObjectNode val bluePrintPropertiesService: BlueprintPropertiesService = - this.functionDependencyInstanceAsType("blueprintPropertiesService") + this.functionDependencyInstanceAsType("blueprintPropertiesService") val k8sConfiguration = K8sConnectionPluginConfiguration(bluePrintPropertiesService) @@ -54,7 +54,10 @@ open class SimpleStatusCheck : AbstractScriptComponentFunction() { val instanceName = it.value.get("k8s-instance-id").asText() val instanceStatus: K8sRbInstanceStatus? = instanceApi.getInstanceStatus(instanceName) + log.debug("Get status for $instanceName") + var status = "" instanceStatus?.resourcesStatus?.forEach { + log.debug("Resource: name=$it.name kind=$it.gvk.kind group=$it.gvk.group version=$it.gvk.version") if (it.gvk?.kind == "Pod") { var version = it.gvk?.version!! if (it.gvk?.group!! != "") @@ -62,10 +65,12 @@ open class SimpleStatusCheck : AbstractScriptComponentFunction() { // val podStatus = instanceApi.queryInstanceStatus(instanceName, it.gvk?.kind!!, version, it.name, null) // log.info(podStatus.toString()) val podState = it.status?.get("status") as Map<String, Object> - - if ((podState["phase"] as String) != "Running") { + status = podState["phase"] as String + if (status != "Running") { continueCheck = true - log.info("Pod ${it.name} [$vfModuleName] has invalid state ${(podState["phase"])}") + log.info("Pod ${it.name} [$vfModuleName] has INVALID state ${(podState["phase"])}") + } else { + log.info("Pod ${it.name} [$vfModuleName] has VALID state ${(podState["phase"])}") } } } @@ -79,7 +84,7 @@ open class SimpleStatusCheck : AbstractScriptComponentFunction() { checkCount = 0 } - log.info("SIMPLE STATUS CHECK - END") + log.info("SIMPLE STATUS CHECK - END SUCCESS") } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { |