From 666c1371b11799b88658b5e2ac3f77f1b01d2231 Mon Sep 17 00:00:00 2001 From: Lukasz Rajewski Date: Wed, 1 Jan 2020 23:09:26 +0100 Subject: K8s Profile Upload Modification of vFW CNF CBA package to upload K8s profile automatically just after resource assigment phase. Profile is created for each vf-module and in this version only upload of static profile is possible. Profile files must be included in the CBA in Templates/k8s-profiles folder. Profile file must be valid tar.gz file accepted by multicloud-k8s plugin. Change-Id: I30c268e9867fbb86d997b2091ce2eed204a7df2a Issue-ID: INT-1406 Signed-off-by: Lukasz Rajewski --- .../templates/cba/Definitions/data_types.json | 11 ++++ .../templates/cba/Definitions/node_types.json | 63 ++++++++++++++++++++++ .../Definitions/resources_definition_types.json | 35 ++++++++++++ .../templates/cba/Definitions/vFW_CNF_CDS.json | 59 +++++++++++++++++++- 4 files changed, 167 insertions(+), 1 deletion(-) (limited to 'heat/vFW_CNF_CDS/templates/cba/Definitions') diff --git a/heat/vFW_CNF_CDS/templates/cba/Definitions/data_types.json b/heat/vFW_CNF_CDS/templates/cba/Definitions/data_types.json index 82d4a041..60b89b7e 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Definitions/data_types.json +++ b/heat/vFW_CNF_CDS/templates/cba/Definitions/data_types.json @@ -280,6 +280,17 @@ "description" : "Profile name used in multicloud/k8s plugin to identify Helm chart(s) where this mapping is providing override values.", "type" : "string" }, + "k8s-rb-profile-namespace" : { + "description" : "", + "required" : false, + "type" : "string", + "status" : "", + "constraints" : [ { } ], + "default": "default", + "entry_schema" : { + "type" : "" + } + }, "vsn_name_0" : { "description" : "", "required" : false, diff --git a/heat/vFW_CNF_CDS/templates/cba/Definitions/node_types.json b/heat/vFW_CNF_CDS/templates/cba/Definitions/node_types.json index 91ecafe2..12eb1bc3 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Definitions/node_types.json +++ b/heat/vFW_CNF_CDS/templates/cba/Definitions/node_types.json @@ -262,6 +262,69 @@ "description" : "TOSCA base type for Resource Sources", "version" : "1.0.0", "derived_from" : "tosca.nodes.Root" + }, + "component-script-executor":{ + "description": "This is CLI Transaction Configuration Component API", + "version": "1.0.0", + "attributes": { + "response-data": { + "required": false, + "type": "json" + } + }, + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "ComponentScriptExecutor": { + "operations": { + "process": { + "inputs": { + "script-type": { + "description": "Script type, kotlin type is supported", + "required": true, + "type": "string", + "default": "internal", + "constraints": [ + { + "valid_values": [ + "kotlin", + "jython", + "internal" + ] + } + ] + }, + "script-class-reference": { + "description": "Kotlin Script class name or jython script name.", + "required": true, + "type": "string" + }, + "dynamic-properties": { + "description": "Dynamic Json Content or DSL Json reference.", + "required": false, + "type": "json" + } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" } } } \ No newline at end of file diff --git a/heat/vFW_CNF_CDS/templates/cba/Definitions/resources_definition_types.json b/heat/vFW_CNF_CDS/templates/cba/Definitions/resources_definition_types.json index ea053c38..1fb6e75f 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Definitions/resources_definition_types.json +++ b/heat/vFW_CNF_CDS/templates/cba/Definitions/resources_definition_types.json @@ -616,6 +616,41 @@ } } }, + "k8s-rb-profile-namespace" : { + "tags" : "k8s-rb-profile-namespace", + "name" : "k8s-rb-profile-namespace", + "property" : { + "description" : "k8s-rb-profile-namespace", + "type" : "string" + }, + "updated-by" : "Rajewski, Lukasz ", + "sources" : { + "input" : { + "type" : "source-input" + }, + "default" : { + "type" : "source-default", + "properties" : { } + }, + "sdnc" : { + "type" : "source-rest", + "properties" : { + "verb" : "GET", + "type" : "JSON", + "url-path" : "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/k8s-rb-profile-namespace", + "path" : "/param/0/value", + "input-key-mapping" : { + "service-instance-id" : "service-instance-id", + "vnf-id" : "vnf-id" + }, + "output-key-mapping" : { + "k8s-rb-profile-namespace" : "value" + }, + "key-dependencies" : [ "service-instance-id", "vnf-id" ] + } + } + } + }, "key_name" : { "tags" : "key_name", "name" : "key_name", diff --git a/heat/vFW_CNF_CDS/templates/cba/Definitions/vFW_CNF_CDS.json b/heat/vFW_CNF_CDS/templates/cba/Definitions/vFW_CNF_CDS.json index 405df54e..c4b6516d 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Definitions/vFW_CNF_CDS.json +++ b/heat/vFW_CNF_CDS/templates/cba/Definitions/vFW_CNF_CDS.json @@ -32,6 +32,18 @@ "username" : "admin", "password" : "admin" }, + "multicloud-k8s-api" : { + "type" : "basic-auth", + "username" : "admin", + "password" : "admin", + "url" : "http://multicloud-k8s:9015" + }, + "profile-upload-properties" : { + "resolution-key" : { + "get_input" : "resolution-key" + }, + "api-access": "*multicloud-k8s-api" + }, "config-deploy-properties" : { "resolution-key" : { "get_input" : "resolution-key" @@ -50,7 +62,24 @@ "steps" : { "resource-assignment" : { "description" : "Resource Assign Workflow", - "target" : "resource-assignment" + "target" : "resource-assignment", + "activities": [ + { + "call_operation": "ResourceResolutionComponent.process" + } + ], + "on_success": [ + "profile-upload" + ] + }, + "profile-upload" : { + "description" : "Upload K8s Profile", + "target" : "profile-upload", + "activities": [ + { + "call_operation": "ComponentScriptExecutor.process" + } + ] } }, "inputs" : { @@ -61,6 +90,13 @@ "type" : "string" } }, + "resolution-key" : { + "required" : false, + "type" : "string", + "entry_schema" : { + "type" : "" + } + }, "resource-assignment-properties" : { "description" : "Dynamic PropertyDefinition for workflow(resource-assignment).", "required" : true, @@ -111,6 +147,10 @@ "artifact-prefix-names" : { "get_input" : "template-prefix" } + }, + "store-result": true, + "resolution-key": { + "get_input" : "resolution-key" } } } @@ -159,6 +199,23 @@ } } }, + "profile-upload" : { + "type" : "component-script-executor", + "interfaces" : { + "ComponentScriptExecutor" : { + "operations" : { + "process" : { + "inputs" : { + "script-type" : "kotlin", + "script-class-reference" : "org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts.K8sProfileUpload", + "instance-dependencies" : [ ], + "dynamic-properties" : "*profile-upload-properties" + } + } + } + } + } + }, "config-deploy-process" : { "type" : "component-resource-resolution", "interfaces" : { -- cgit 1.2.3-korg