summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2022-02-14 16:39:09 +0100
committerLukasz Rajewski <lukasz.rajewski@orange.com>2022-02-14 16:39:09 +0100
commit4db0643d321940dc0677f6953cb5701fb8ffb26b (patch)
tree107f2de4a6e2a4c7a5caf8f84107fd28c630739f /ms/blueprintsprocessor
parent4954e82b2af21c684ce827959f7949e71d8530a7 (diff)
K8sPlugin integration changes for Istanbul APIs
- k8sconfigteamplate component accepts empty source what means that template is the same like definition - fix of the query API namespace param Issue-ID: CCSDK-3537 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com> Change-Id: I86c6b7e0fd98cd34a1ee89dd183732b113439a23
Diffstat (limited to 'ms/blueprintsprocessor')
-rw-r--r--ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt26
-rw-r--r--ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/query/K8sPluginQueryApi.kt2
2 files changed, 16 insertions, 12 deletions
diff --git a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt
index 969277751..cd58baf83 100644
--- a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt
+++ b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt
@@ -135,23 +135,27 @@ open class K8sConfigTemplateComponent(
log.info("Uploading K8s template..")
outputPrefixStatuses[prefix] = OUTPUT_ERROR
var templateSource: String? = prefixInputParamsMap[INPUT_K8S_TEMPLATE_SOURCE]?.returnNullIfMissing()?.asText()
- if (templateSource == null) {
- templateSource = templateName
- log.info("Template name used instead of template source")
+
+ var templateFilePath: Path? = null
+ if (templateSource != null && templateSource != "") {
+ val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
+ val artifact: ArtifactDefinition = bluePrintContext.nodeTemplateArtifact(nodeTemplateName, templateSource)
+ if (artifact.type != BluePrintConstants.MODEL_TYPE_ARTIFACT_K8S_CONFIG)
+ throw BluePrintProcessorException(
+ "Unexpected template artifact type for template source $templateSource. Expecting: $artifact.type"
+ )
+ templateFilePath = prepareTemplateFile(templateName, templateSource, artifact.file)
+ } else {
+ templateSource = ""
+ log.info("Configuration template without content. RB definition content will be used instead")
}
- val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
- val artifact: ArtifactDefinition = bluePrintContext.nodeTemplateArtifact(nodeTemplateName, templateSource)
- if (artifact.type != BluePrintConstants.MODEL_TYPE_ARTIFACT_K8S_CONFIG)
- throw BluePrintProcessorException(
- "Unexpected template artifact type for template source $templateSource. Expecting: $artifact.type"
- )
val template = K8sTemplate()
template.templateName = templateName
template.description = templateSource
- val templateFilePath: Path = prepareTemplateFile(templateName, templateSource, artifact.file)
api.createTemplate(definitionName, definitionVersion, template)
- api.uploadConfigTemplateContent(definitionName, definitionVersion, template, templateFilePath)
+ if (templateFilePath != null)
+ api.uploadConfigTemplateContent(definitionName, definitionVersion, template, templateFilePath)
log.info("K8s Config Upload Completed")
outputPrefixStatuses[prefix] = OUTPUT_UPLOADED
diff --git a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/query/K8sPluginQueryApi.kt b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/query/K8sPluginQueryApi.kt
index 170f29566..9a5051f8e 100644
--- a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/query/K8sPluginQueryApi.kt
+++ b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/query/K8sPluginQueryApi.kt
@@ -26,7 +26,7 @@ public class K8sPluginQueryApi(
if (name != null)
path = path.plus("&Name=$name")
if (namespace != null)
- path = path.plus("&Namespace=$name")
+ path = path.plus("&Namespace=$namespace")
if (labels != null && labels.isNotEmpty()) {
path = path.plus("&Labels=")
for ((name, value) in labels)