aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/msb/templates/msb-discovery-deployment.yaml
AgeCommit message (Collapse)AuthorFilesLines
2017-10-29Add option to disable specific deploymentsyuryn1-1/+2
Add option to disable any deployment by using conditions in helm templates. Each deployment will get helm parameter - boolean flag allowing to disable it. The flags can be listed in the custom values.yaml file that can be passed to the createAll script with '-v' command line option. Change-Id: I32b795de46c72915c2201c94c23f4e061971bb56 Issue-ID: OOM-380 Signed-off-by: yuryn <Yury.Novitsky@Amdocs.com>
2017-09-11Use domain name instead of IP for consulHuabingZhao1-1/+1
Issue-Id: OOM-113 Change-Id: I41e6f72337a15c1d07b444b09171204d8eb378ec Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
2017-09-09Add push secret for MSB docker imagesHuabingZhao1-1/+2
Issue-Id: OOM-113 Change-Id: I9bab3903c4334c0587071eff077f1745bbd4460b Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
2017-09-02add namespaceHuabingZhao1-0/+1
Issue-ID: OOM-113 Change-Id: Ifaa978ed6156a661ae8312959fd4dc70a8029e32 Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
2017-09-02parameterize docker imageHuabingZhao1-2/+2
Issue-Id: OOM-113 Change-Id: I36641bbb2c973f3df9a9d1a24e7197c21552e61b Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
2017-08-30parameterization replica numberHuabingZhao1-1/+1
Issue-Id: OOM-113 Change-Id: I483e6e9942a3cf7ffd486c8ac53e8f458baa0c21 Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
2017-08-29MSB external api gateway service k8s deploymentHuabingZhao1-2/+2
Issue-Id: OOM-113, MSB-26 Change-Id: If365e75c7ccf7de902f771ffdd2db3b1566b98b6 Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
2017-08-29MSB discovery service k8s deploymentHuabingZhao1-0/+34
Issue-Id: OOM-113, MSB-56 Change-Id: Idec27ae5e2e32fdf4462144ddb13e9f535a4d044 Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
*/ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * Copyright © 2017-2018 AT&T Intellectual Property.
 *
 * Modifications Copyright © 2019 IBM, Bell Canada.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor

import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.CapabilityResourceSource
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service

@Service("${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-capability")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class CapabilityResourceResolutionProcessor(private var componentFunctionScriptingService: ComponentFunctionScriptingService) :
    ResourceAssignmentProcessor() {

    private val log = LoggerFactory.getLogger(CapabilityResourceResolutionProcessor::class.java)

    var componentResourceAssignmentProcessor: ResourceAssignmentProcessor? = null

    override fun getName(): String {
        return "${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-capability"
    }

    override suspend fun processNB(resourceAssignment: ResourceAssignment) {
        // Execute only if value is not in Input
        if (!setFromInput(resourceAssignment)) {
            val dName = resourceAssignment.dictionaryName!!
            val dSource = resourceAssignment.dictionarySource!!
            val resourceDefinition = resourceDefinition(resourceAssignment.dictionaryName!!)

            /** Check Resource Assignment has the source definitions, If not get from Resource Definition **/
            val resourceSource = resourceAssignment.dictionarySourceDefinition
                ?: resourceDefinition?.sources?.get(dSource)
                ?: throw BlueprintProcessorException("couldn't get resource definition $dName source($dSource)")

            val resourceSourceProps =
                checkNotNull(resourceSource.properties) { "failed to get $resourceSource properties" }

            /**
             * Get the Capability Resource Source Info from Property Definitions.
             */
            val capabilityResourceSourceProperty = JacksonUtils
                .getInstanceFromMap(resourceSourceProps, CapabilityResourceSource::class.java)

            val scriptType = capabilityResourceSourceProperty.scriptType
            val scriptClassReference = capabilityResourceSourceProperty.scriptClassReference
            val instanceDependencies = capabilityResourceSourceProperty.instanceDependencies ?: listOf()

            componentResourceAssignmentProcessor =
                scriptInstance(scriptType, scriptClassReference, instanceDependencies)

            checkNotNull(componentResourceAssignmentProcessor) {
                "failed to get capability resource assignment processor($scriptClassReference)"
            }

            // Assign Current Blueprint runtime and ResourceDictionaries
            componentResourceAssignmentProcessor!!.scriptType = scriptType
            componentResourceAssignmentProcessor!!.raRuntimeService = raRuntimeService
            componentResourceAssignmentProcessor!!.resourceAssignments = resourceAssignments
            componentResourceAssignmentProcessor!!.resourceDictionaries = resourceDictionaries

            // Invoke componentResourceAssignmentProcessor
            componentResourceAssignmentProcessor!!.executeScript(resourceAssignment)
        }
    }

    override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
        addError("Failed in CapabilityResourceResolutionProcessor : ${runtimeException.message}")
        ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, runtimeException.message)
    }

    suspend fun scriptInstance(scriptType: String, scriptClassReference: String, instanceDependencies: List<String>):
        ResourceAssignmentProcessor {

            log.info("creating resource resolution of script type($scriptType), reference name($scriptClassReference)")

            val scriptComponent = componentFunctionScriptingService
                .scriptInstance<ResourceAssignmentProcessor>(
                    raRuntimeService.bluePrintContext(), scriptType,
                    scriptClassReference
                )

            return scriptComponent
        }
}