aboutsummaryrefslogtreecommitdiffstats
path: root/tutorials/ApacheCNF/templates/cba
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2022-10-21 17:36:17 +0200
committerLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2022-10-21 17:36:33 +0200
commit5762244a0c6282557169c8183e464f6950438122 (patch)
treed1b1a4a18edc72918be8bb2f6f4b7a1ad104abce /tutorials/ApacheCNF/templates/cba
parent0c85ee9fc85870f8ba39befc63b8351301d4842f (diff)
[APACHECNF] Update healthcheck and add scale workflow
Issue-ID: INT-2164 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> Change-Id: I7cf59f58592321ec06d8d812bd081293130ec74d
Diffstat (limited to 'tutorials/ApacheCNF/templates/cba')
-rw-r--r--tutorials/ApacheCNF/templates/cba/Definitions/CNF.json15
-rw-r--r--tutorials/ApacheCNF/templates/cba/Definitions/data_types.json35
-rw-r--r--tutorials/ApacheCNF/templates/cba/Definitions/resources_definition_types.json19
-rw-r--r--tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt19
-rw-r--r--tutorials/ApacheCNF/templates/cba/Scripts/kotlin/K8sHealthCheck.kt3
-rw-r--r--tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt3
-rw-r--r--tutorials/ApacheCNF/templates/cba/Templates/config-setup-mapping.json14
7 files changed, 91 insertions, 17 deletions
diff --git a/tutorials/ApacheCNF/templates/cba/Definitions/CNF.json b/tutorials/ApacheCNF/templates/cba/Definitions/CNF.json
index 2e30ce01..4f44e8a1 100644
--- a/tutorials/ApacheCNF/templates/cba/Definitions/CNF.json
+++ b/tutorials/ApacheCNF/templates/cba/Definitions/CNF.json
@@ -56,6 +56,15 @@
"config-deploy",
"config-deploy-setup"
]
+ },
+ "status-check-max-count": {
+ "get_attribute": [
+ "config-setup-process",
+ "",
+ "assignment-map",
+ "config-deploy",
+ "status-check-max-count"
+ ]
}
}
},
@@ -453,9 +462,6 @@
],
"on_success": [
"health-check-process"
- ],
- "on_failure": [
- "handle_error"
]
},
"health-check-process": {
@@ -468,9 +474,6 @@
],
"on_success": [
"collect-results"
- ],
- "on_failure": [
- "handle_error"
]
},
"handle_error": {
diff --git a/tutorials/ApacheCNF/templates/cba/Definitions/data_types.json b/tutorials/ApacheCNF/templates/cba/Definitions/data_types.json
index 603b0baa..1573c81c 100644
--- a/tutorials/ApacheCNF/templates/cba/Definitions/data_types.json
+++ b/tutorials/ApacheCNF/templates/cba/Definitions/data_types.json
@@ -30,6 +30,17 @@
"description": "",
"required": false,
"type": "string"
+ },
+ "replica-count": {
+ "description": "replica count for apache pods",
+ "type": "integer",
+ "required": false
+ },
+ "status-check-max-count": {
+ "description": "max status check count for pods",
+ "type": "integer",
+ "required": false,
+ "default": 30
}
},
"derived_from": "tosca.datatypes.Dynamic"
@@ -57,6 +68,12 @@
"description": "",
"required": false,
"type": "string"
+ },
+ "status-check-max-count": {
+ "description": "max status check count for pods",
+ "type": "integer",
+ "required": false,
+ "default": 30
}
},
"derived_from": "tosca.datatypes.Dynamic"
@@ -89,6 +106,12 @@
"description": "replica count for apache pods",
"type": "integer",
"default": 2
+ },
+ "status-check-max-count": {
+ "description": "max status check count for pods",
+ "type": "integer",
+ "required": false,
+ "default": 30
}
},
"derived_from": "tosca.datatypes.Dynamic"
@@ -121,6 +144,12 @@
"description": "replica count for apache pods",
"type": "integer",
"default": 1
+ },
+ "status-check-max-count": {
+ "description": "max status check count for pods",
+ "type": "integer",
+ "required": false,
+ "default": 30
}
},
"derived_from": "tosca.datatypes.Dynamic"
@@ -158,6 +187,12 @@
"description": "the data content of the policy request parameters",
"required": false,
"type": "json"
+ },
+ "status-check-max-count": {
+ "description": "max status check count for pods",
+ "type": "integer",
+ "required": false,
+ "default": 30
}
},
"derived_from": "tosca.datatypes.Dynamic"
diff --git a/tutorials/ApacheCNF/templates/cba/Definitions/resources_definition_types.json b/tutorials/ApacheCNF/templates/cba/Definitions/resources_definition_types.json
index 38b5fee4..31f04c11 100644
--- a/tutorials/ApacheCNF/templates/cba/Definitions/resources_definition_types.json
+++ b/tutorials/ApacheCNF/templates/cba/Definitions/resources_definition_types.json
@@ -1439,6 +1439,25 @@
}
}
},
+ "status-check-max-count": {
+ "tags": "max status check count for pods",
+ "name": "status-check-max-count",
+ "property": {
+ "description": "max status check count for pods",
+ "type": "integer"
+ },
+ "group": "default",
+ "updated-by": "Lukasz Rajewski <lukasz.rajewski@t-mobile.pl>",
+ "sources": {
+ "input": {
+ "type": "source-input"
+ },
+ "default": {
+ "type": "source-default",
+ "properties": {}
+ }
+ }
+ },
"service-instance-name": {
"tags": "service-instance-name",
"name": "service-instance-name",
diff --git a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt
index 77d86d04..f925be06 100644
--- a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt
+++ b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt
@@ -70,17 +70,22 @@ open class ConfigDeploySetup() : ResourceAssignmentProcessor() {
}
}
} else if (executionRequest.name == "replica-count") {
- var value = raRuntimeService.getInputValue(executionRequest.name)
retValue = "1"
- if (!value.isNullOrMissing()) {
- retValue = value.asText()
- } else {
- value = raRuntimeService.getInputValue("data")
+ try {
+ var value = raRuntimeService.getInputValue(executionRequest.name)
if (!value.isNullOrMissing()) {
- if (value["replicaCount"] != null) {
- retValue = value["replicaCount"].asText()
+ retValue = value.asText()
+ } else {
+ value = raRuntimeService.getInputValue("data")
+ if (!value.isNullOrMissing()) {
+ if (value["replicaCount"] != null) {
+ retValue = value["replicaCount"].asText()
+ }
}
}
+ } catch (e: Exception) {
+ log.error(e.message, e)
+ log.info("Setting default replica count: 1")
}
} else if (executionRequest.name == "config-deploy-setup") {
val modulesSdnc = raRuntimeService.getResolutionStore("vf-modules-list-sdnc")["vf-modules"]
diff --git a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/K8sHealthCheck.kt b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/K8sHealthCheck.kt
index dd87c6f5..30b4d96b 100644
--- a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/K8sHealthCheck.kt
+++ b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/K8sHealthCheck.kt
@@ -119,7 +119,6 @@ open class K8sHealthCheck : AbstractScriptComponentFunction() {
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- log.info("Executing Recovery")
- bluePrintRuntimeService.getBluePrintError().addError("${runtimeException.message}", getName())
+ this.addError("${runtimeException.message}")
}
}
diff --git a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt
index c99dcd4f..c1f59d98 100644
--- a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt
+++ b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt
@@ -38,6 +38,7 @@ open class SimpleStatusCheck : AbstractScriptComponentFunction() {
log.info("SIMPLE STATUS CHECK - START")
val configValueSetup: ObjectNode = getDynamicProperties("config-deploy-setup") as ObjectNode
+ var checkCount: Int = getDynamicProperties("status-check-max-count").asInt()
val bluePrintPropertiesService: BluePrintPropertiesService =
this.functionDependencyInstanceAsType("bluePrintPropertiesService")
@@ -46,7 +47,6 @@ open class SimpleStatusCheck : AbstractScriptComponentFunction() {
val instanceApi = K8sPluginInstanceApi(k8sConfiguration)
- var checkCount: Int = 30 // in the future to be read in from the input
while (checkCount > 0) {
var continueCheck = false
configValueSetup.fields().forEach { it ->
@@ -75,7 +75,6 @@ open class SimpleStatusCheck : AbstractScriptComponentFunction() {
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- log.info("Executing Recovery")
this.addError("${runtimeException.message}")
}
}
diff --git a/tutorials/ApacheCNF/templates/cba/Templates/config-setup-mapping.json b/tutorials/ApacheCNF/templates/cba/Templates/config-setup-mapping.json
index 95d2681f..34189bca 100644
--- a/tutorials/ApacheCNF/templates/cba/Templates/config-setup-mapping.json
+++ b/tutorials/ApacheCNF/templates/cba/Templates/config-setup-mapping.json
@@ -101,5 +101,19 @@
"dependencies": [
"service-instance-id"
]
+ },
+ {
+ "name": "status-check-max-count",
+ "property": {
+ "description": "max status check count for pods",
+ "required": false,
+ "type": "integer",
+ "default": 30
+ },
+ "input-param": false,
+ "dictionary-name": "status-check-max-count",
+ "dictionary-source": "default",
+ "dependencies": [],
+ "version": 0
}
]