diff options
Diffstat (limited to 'ms')
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) |