summaryrefslogtreecommitdiffstats
path: root/mod2/helm-generator/helmchartgenerator-core/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'mod2/helm-generator/helmchartgenerator-core/src/main')
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/Utils.java105
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartBuilder.java68
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartGenerator.java73
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ComponentSpecParser.java331
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/HelmClient.java31
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/HelmClientImpl.java119
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/KeyValueMerger.java94
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/config/YamlConfig.java45
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/distribution/ChartDistributor.java29
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/distribution/ChartMuseumDistributor.java79
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/chartinfo/ChartInfo.java35
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/chartinfo/Metadata.java32
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/base/Auxilary.java76
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/base/ComponentSpec.java54
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Artifacts.java41
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Calls.java43
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/ConfigVolume.java34
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Constraints.java61
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Container.java39
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/EntrySchema.java47
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/HealthCheck.java54
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Helm.java35
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Host.java39
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Parameters.java68
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Policy.java47
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/PolicyInfo.java38
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/PolicySchema.java51
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Provides.java44
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Publishes.java50
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Reconfigs.java47
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/RequestResponse.java39
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Self.java47
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Service.java43
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Streams.java41
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Subscribes.java49
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/TlsInfo.java43
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Volumes.java49
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ChartTemplateStructureValidator.java60
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidator.java29
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidatorImpl.java108
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/resources/application.properties5
-rw-r--r--mod2/helm-generator/helmchartgenerator-core/src/main/resources/component-spec-schema.json1162
42 files changed, 3584 insertions, 0 deletions
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/Utils.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/Utils.java
new file mode 100644
index 0000000..83c67b1
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/Utils.java
@@ -0,0 +1,105 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Map;
+
+/**
+ * An utility class for various file related tasks.
+ * @author Dhrumin Desai
+ */
+@Slf4j
+public class Utils {
+
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ private Utils() {}
+
+ public static <T> T deserializeJsonFileToModel(String filePath, Class<T> modelClass) {
+ return deserializeJsonFileToModel(new File(filePath), modelClass);
+ }
+
+ /**
+ * maps json file to a model class
+ * @param file Json file which holds the data
+ * @param modelClass target model class for mapping
+ * @return mapped model instance
+ */
+ public static <T> T deserializeJsonFileToModel(File file, Class<T> modelClass) {
+ try {
+ return MAPPER.readValue(file, modelClass);
+ } catch (IOException e) {
+ log.error(e.getMessage());
+ throw new RuntimeException("Error occurred while converting file to the given model class");
+ }
+ }
+
+ /**
+ * copies dir/file to a temp location on OS
+ * @param srcLocation
+ * @return
+ */
+ public static File cloneFileToTempLocation(String srcLocation) {
+ File cloneLocation = null;
+ try {
+ Path tempRootDir = Files.createTempDirectory("chart");
+ cloneLocation = new File(tempRootDir.toString());
+ log.info("cloning dir/file at : " + tempRootDir);
+ FileUtils.copyDirectory(new File(srcLocation), cloneLocation);
+ } catch (IOException e) {
+ log.error(e.getMessage());
+ throw new RuntimeException("Error occured while cloning file to temp location.");
+ }
+ return cloneLocation;
+ }
+
+ /**
+ * deletes dir / file from temp location of OS
+ * @param dir dir to be deleted
+ */
+ public static void deleteTempFileLocation(File dir) {
+ try {
+ FileUtils.deleteDirectory(dir);
+ } catch (IOException e) {
+ log.warn("Could not delete dir/file: " + dir.getAbsolutePath());
+ }
+ }
+
+ /**
+ * puts value into a map if only exists
+ * @param map a map
+ * @param key a key
+ * @param value a value
+ */
+ public static void putIfNotNull(Map<String, Object> map, String key, Object value){
+ if(value != null){
+ map.put(key, value);
+ }
+ }
+
+}
+
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartBuilder.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartBuilder.java
new file mode 100644
index 0000000..ac73544
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartBuilder.java
@@ -0,0 +1,68 @@
+
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder;
+
+import lombok.extern.slf4j.Slf4j;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo.ChartInfo;
+import org.onap.dcaegen2.platform.helmchartgenerator.validation.ChartTemplateStructureValidator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+
+/**
+ * ChartBuilder is a main class responsible to generate a helm chart.
+ * @author Dhrumin Desai
+ */
+@Component
+@Slf4j
+public class ChartBuilder {
+
+ @Autowired
+ private ComponentSpecParser specParser;
+
+ @Autowired
+ private ChartGenerator chartGenerator;
+
+ /**
+ * constructor of ChartBuilder
+ * @param specParser implementation of ComponentSpecParser
+ * @param chartGenerator implementation of ChartGenerator
+ */
+ public ChartBuilder(ComponentSpecParser specParser, ChartGenerator chartGenerator) {
+ this.specParser = specParser;
+ this.chartGenerator = chartGenerator;
+ }
+
+ /**
+ * this method validates the inputs and generate a helm chart.
+ * @param specFileLocation location of the application specification json file
+ * @param chartTemplateLocation location of the base helm chart template
+ * @param outputLocation location to store the helm chart
+ * @param specSchemaLocation location of the specification json schema file to validate the application spec
+ * @return generated helm chart tgz file
+ * @throws Exception
+ */
+ public File build(String specFileLocation, String chartTemplateLocation, String outputLocation, String specSchemaLocation ) throws Exception {
+ ChartTemplateStructureValidator.validateChartTemplateStructure(chartTemplateLocation);
+ ChartInfo chartInfo = specParser.extractChartInfo(specFileLocation, chartTemplateLocation, specSchemaLocation);
+ return chartGenerator.generate(chartTemplateLocation, chartInfo, outputLocation);
+ }
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartGenerator.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartGenerator.java
new file mode 100644
index 0000000..b9980d7
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartGenerator.java
@@ -0,0 +1,73 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder;
+
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo.ChartInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+
+import static org.onap.dcaegen2.platform.helmchartgenerator.Utils.cloneFileToTempLocation;
+import static org.onap.dcaegen2.platform.helmchartgenerator.Utils.deleteTempFileLocation;
+
+/**
+ * ChartGenerator interacts with HelmClient and generates a packaged helm chart
+ * @author Dhrumin Desai
+ */
+@Component
+@Slf4j
+public class ChartGenerator {
+
+ @Setter
+ @Autowired
+ private HelmClient helmClient;
+
+ @Setter
+ @Autowired
+ private KeyValueMerger merger;
+
+ /**
+ * Constructor for ChartGenerator
+ * @param helmClient HelmClient implementation
+ * @param merger KeyValueMerger implementation
+ */
+ public ChartGenerator(HelmClient helmClient, KeyValueMerger merger) {
+ this.helmClient = helmClient;
+ this.merger = merger;
+ }
+
+ /**
+ * Merges the key-values from the helm base template and parsed spec file and generates a new packaged helm chart
+ * @param chartBlueprintLocation location of the base helm chart template
+ * @param chartInfo chartInfo object with key-values parsed from the specfile.
+ * @param outputLocation location to store the helm chart
+ * @return generated helm chart tgz file
+ */
+ public File generate(String chartBlueprintLocation, ChartInfo chartInfo, String outputLocation) {
+ File newChartDir = cloneFileToTempLocation(chartBlueprintLocation + "/base");
+ merger.mergeValuesToChart(chartInfo, newChartDir);
+ helmClient.lint(newChartDir);
+ final File chartLocation = helmClient.packageChart(newChartDir, outputLocation);
+ deleteTempFileLocation(newChartDir);
+ return chartLocation;
+ }
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ComponentSpecParser.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ComponentSpecParser.java
new file mode 100644
index 0000000..942e5ae
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ComponentSpecParser.java
@@ -0,0 +1,331 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder;
+
+import org.jetbrains.annotations.NotNull;
+import org.onap.dcaegen2.platform.helmchartgenerator.Utils;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo.ChartInfo;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo.Metadata;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.base.ComponentSpec;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Artifacts;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.HealthCheck;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Parameters;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Policy;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.PolicyInfo;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Self;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Service;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.TlsInfo;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Volumes;
+import org.onap.dcaegen2.platform.helmchartgenerator.validation.ComponentSpecValidator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * ComponentSpecParser reads a componentspec file and collects useful data for helm chart generation.
+ * @author Dhrumin Desai
+ */
+@Component
+public class ComponentSpecParser {
+
+ @Autowired
+ private ComponentSpecValidator specValidator;
+
+ /**
+ * Constructor for ComponentSpecParser
+ * @param specValidator ComponentSpecValidator implementation
+ */
+ public ComponentSpecParser(ComponentSpecValidator specValidator) {
+ this.specValidator = specValidator;
+ }
+
+ /**
+ *
+ * @param specFileLocation location of the application specification json file
+ * @param chartTemplateLocation location of the base helm chart template
+ * @param specSchemaLocation location of the specification json schema file to validate the application spec
+ * @return ChartInfo object populated with key-values
+ * @throws Exception
+ */
+ public ChartInfo extractChartInfo(String specFileLocation, String chartTemplateLocation, String specSchemaLocation) throws Exception {
+ specValidator.validateSpecFile(specFileLocation, specSchemaLocation);
+ ComponentSpec cs = Utils.deserializeJsonFileToModel(specFileLocation, ComponentSpec.class);
+ ChartInfo chartInfo = new ChartInfo();
+ chartInfo.setMetadata(extractMetadata(cs.getSelf()));
+ chartInfo.setValues(extractValues(cs, chartTemplateLocation));
+ return chartInfo;
+ }
+
+ private Map<String, Object> extractValues(ComponentSpec cs, String chartTemplateLocation) {
+ Map<String, Object> outerValues = new LinkedHashMap<>();
+ if(cs.getAuxilary() != null && cs.getAuxilary().getTlsInfo() != null){
+ Utils.putIfNotNull(outerValues,"certDirectory", cs.getAuxilary().getTlsInfo().getCertDirectory());
+ Utils.putIfNotNull(outerValues, "tlsServer", cs.getAuxilary().getTlsInfo().getUseTls());
+ }
+ if(cs.getAuxilary() != null && cs.getAuxilary().getLogInfo() != null) {
+ Utils.putIfNotNull(outerValues,"logDirectory", cs.getAuxilary().getLogInfo().get("log_directory"));
+ }
+ if(imageUriExistsForFirstArtifact(cs)){
+ Utils.putIfNotNull(outerValues,"image", cs.getArtifacts()[0].getUri());
+ }
+ populateApplicationConfigSection(outerValues, cs);
+ populateReadinessSection(outerValues, cs);
+ populateApplicationEnvSection(outerValues, cs);
+ populateServiceSection(outerValues, cs);
+ populateCertificatesSection(outerValues, cs, chartTemplateLocation);
+ populatePoliciesSection(outerValues, cs);
+ populateExternalVolumesSection(outerValues, cs);
+ populatePostgresSection(outerValues, cs);
+ populateSecretsSection(outerValues, cs);
+ return outerValues;
+ }
+
+ private boolean imageUriExistsForFirstArtifact(ComponentSpec cs) {
+ final Artifacts[] artifacts = cs.getArtifacts();
+ return artifacts != null && artifacts.length > 0 && artifacts[0].getUri() != null;
+ }
+
+ private void populateApplicationConfigSection(Map<String, Object> outerValues, ComponentSpec cs) {
+ Map<String, Object> applicationConfig = new LinkedHashMap<>();
+ Parameters[] parameters = cs.getParameters();
+ for(Parameters param : parameters){
+ applicationConfig.put(param.getName(), param.getValue());
+ }
+ Utils.putIfNotNull(outerValues,"applicationConfig", applicationConfig);
+ }
+
+ private void populateReadinessSection(Map<String, Object> outerValues, ComponentSpec cs) {
+
+ if (!healthCheckExists(cs)) return;
+
+ Map<String, Object> readiness = new LinkedHashMap<>();
+ final HealthCheck healthcheck = cs.getAuxilary().getHealthcheck();
+ Utils.putIfNotNull(readiness, "initialDelaySeconds", healthcheck.getInitialDelaySeconds());
+
+ if(healthcheck.getInterval() != null) {
+ readiness.put("periodSeconds", getSeconds(healthcheck.getInterval(), "interval"));
+ }
+ if(healthcheck.getTimeout() != null) {
+ readiness.put("timeoutSeconds", getSeconds(healthcheck.getTimeout(), "timeout"));
+ }
+
+ readiness.put("path", healthcheck.getEndpoint());
+ readiness.put("scheme", healthcheck.getType());
+ readiness.put("port", healthcheck.getPort());
+
+ outerValues.put("readiness", readiness);
+ }
+
+ private int getSeconds(String value, String field) {
+ int seconds = 0;
+ try {
+ seconds = Integer.parseInt(value.replaceAll("[^\\d.]", ""));
+ }
+ catch (NumberFormatException e){
+ throw new RuntimeException(String.format("%s with %s is not given in a correct format", field, value));
+ }
+ return seconds;
+ }
+
+ private boolean healthCheckExists(ComponentSpec cs) {
+ return cs.getAuxilary() != null &&
+ cs.getAuxilary().getHealthcheck() != null;
+ }
+
+ private void populateApplicationEnvSection(Map<String, Object> outerValues, ComponentSpec cs){
+ if(applicationEnvExists(cs)) {
+ Object applicationEnv = cs.getAuxilary().getHelm().getApplicationEnv();
+ Utils.putIfNotNull(outerValues,"applicationEnv", applicationEnv);
+ }
+ }
+
+ private boolean applicationEnvExists(ComponentSpec cs) {
+ return cs.getAuxilary() != null &&
+ cs.getAuxilary().getHelm() != null &&
+ cs.getAuxilary().getHelm().getApplicationEnv() != null;
+ }
+
+ private void populateServiceSection(Map<String, Object> outerValues, ComponentSpec cs) {
+ if (!serviceExists(cs)) return;
+
+ Map<String, Object> service = new LinkedHashMap<>();
+ final Service serviceFromSpec = cs.getAuxilary().getHelm().getService();
+
+ if(serviceFromSpec.getPorts() != null){
+ List<Object> ports = mapServicePorts(serviceFromSpec.getPorts());
+ service.put("ports", ports);
+ Utils.putIfNotNull(service, "type", serviceFromSpec.getType());
+ }
+ Utils.putIfNotNull(service,"name", serviceFromSpec.getName());
+ Utils.putIfNotNull(service,"has_internal_only_ports", serviceFromSpec.getHasInternalOnlyPorts());
+ outerValues.put("service", service);
+ }
+
+ private boolean serviceExists(ComponentSpec cs) {
+ return cs.getAuxilary() != null &&
+ cs.getAuxilary().getHelm() != null &&
+ cs.getAuxilary().getHelm().getService() != null;
+ }
+
+ private List<Object> mapServicePorts(Object[] ports) {
+ List<Object> portsList = new ArrayList<>();
+ Collections.addAll(portsList, ports);
+ return portsList;
+ }
+
+ private void populatePoliciesSection(Map<String, Object> outerValues, ComponentSpec cs) {
+ Map<String, Object> policies = new LinkedHashMap<>();
+ final PolicyInfo policyInfo = cs.getPolicyInfo();
+ if(policyInfo != null && policyInfo.getPolicy() != null) {
+ List<String> policyList = new ArrayList<>();
+ for (Policy policyItem : policyInfo.getPolicy()) {
+ policyList.add('"' + policyItem.getPolicyID() + '"');
+ }
+ policies.put("policyRelease", "onap");
+ policies.put("duration", 300);
+ policies.put("policyID", "'" + policyList.toString() + "'\n");
+ outerValues.put("policies", policies);
+ }
+ }
+
+ private void populateCertificatesSection(Map<String, Object> outerValues, ComponentSpec cs, String chartTemplateLocation) {
+ Map<String, Object> certificate = new LinkedHashMap<>();
+ Map<String, Object> keystore = new LinkedHashMap<>();
+ Map<String, Object> passwordsSecretRef = new LinkedHashMap<>();
+ TlsInfo tlsInfo = cs.getAuxilary().getTlsInfo();
+ String componentName = getComponentNameWithOmitFirstWord(cs);
+ if(externalTlsExists(tlsInfo)) {
+ String mountPath = tlsInfo.getCertDirectory();
+ if(tlsInfo.getUseExternalTls() != null && tlsInfo.getUseExternalTls()) {
+ checkCertificateYamlExists(chartTemplateLocation);
+ mountPath += "external";
+ }
+ passwordsSecretRef.put("name", componentName + "-cmpv2-keystore-password");
+ passwordsSecretRef.put("key", "password");
+ passwordsSecretRef.put("create", true);
+ keystore.put("outputType", List.of("jks"));
+ keystore.put("passwordSecretRef", passwordsSecretRef);
+ certificate.put("mountPath", mountPath);
+ Utils.putIfNotNull(certificate,"commonName", cs.getSelf().getName());
+ Utils.putIfNotNull(certificate,"dnsNames", List.of(cs.getSelf().getName()));
+ certificate.put("keystore", keystore);
+ outerValues.put("certificates", List.of(certificate));
+ }
+ }
+
+ private String getComponentNameWithOmitFirstWord(ComponentSpec cs) {
+ return cs.getSelf().getName().substring(cs.getSelf().getName().indexOf("-") + 1);
+ }
+
+ private boolean externalTlsExists(TlsInfo tlsInfo) {
+ return tlsInfo != null && tlsInfo.getUseExternalTls() != null && tlsInfo.getUseExternalTls().equals(true);
+ }
+
+ private void checkCertificateYamlExists(String chartTemplateLocation) {
+ Path certificateYaml = Paths.get(chartTemplateLocation, "addons/templates/certificates.yaml");
+ if(!Files.exists(certificateYaml)) {
+ throw new RuntimeException("certificates.yaml not found under templates directory in addons");
+ }
+ }
+
+ private void populateExternalVolumesSection(Map<String, Object> outerValues, ComponentSpec cs) {
+ if(cs.getAuxilary().getVolumes() != null) {
+ List<Object> externalVolumes = new ArrayList<>();
+ Volumes[] volumes = cs.getAuxilary().getVolumes();
+ for (Volumes volume : volumes) {
+ if(volume.getHost() == null) {
+ Map<String, Object> tempVolume = new LinkedHashMap<>();
+ tempVolume.put("name", volume.getConfigVolume().getName());
+ tempVolume.put("type", "configMap");
+ tempVolume.put("mountPath", volume.getContainer().getBind());
+ tempVolume.put("optional", true);
+ externalVolumes.add(tempVolume);
+ }
+ }
+ if(!externalVolumes.isEmpty()) {
+ outerValues.put("externalVolumes", externalVolumes);
+ }
+ }
+ }
+
+ private void populatePostgresSection(Map<String, Object> outerValues, ComponentSpec cs) {
+ if(cs.getAuxilary().getDatabases() != null) {
+ String componentFullName = cs.getSelf().getName();
+ String component = getComponentNameWithOmitFirstWord(cs);
+ Map<String, Object> postgres = new LinkedHashMap<>();
+ Map<String, Object> service = new LinkedHashMap<>();
+ Map<String, Object> container = new LinkedHashMap<>();
+ Map<String, Object> name = new LinkedHashMap<>();
+ Map<String, Object> persistence = new LinkedHashMap<>();
+ Map<String, Object> config = new LinkedHashMap<>();
+ service.put("name", componentFullName + "-postgres");
+ service.put("name2", componentFullName + "-pg-primary");
+ service.put("name3", componentFullName + "-pg-replica");
+ name.put("primary", componentFullName + "-pg-primary");
+ name.put("replica", componentFullName + "-pg-replica");
+ container.put("name", name);
+ persistence.put("mountSubPath", componentFullName + "/data");
+ persistence.put("mountInitPath", componentFullName);
+ config.put("pgUserName", component);
+ config.put("pgDatabase", component);
+ config.put("pgUserExternalSecret", "{{ include \"common.release\" . }}-" + component + "-pg-user-creds");
+
+ postgres.put("enabled", true);
+ postgres.put("nameOverride", componentFullName + "-postgres");
+ postgres.put("service", service);
+ postgres.put("container", container);
+ postgres.put("persistence", persistence);
+ postgres.put("config", config);
+ outerValues.put("postgres", postgres);
+ }
+ }
+
+ private void populateSecretsSection(Map<String, Object> outerValues, ComponentSpec cs) {
+ if(cs.getAuxilary().getDatabases() != null) {
+ String component = getComponentNameWithOmitFirstWord(cs);
+ List<Object> secrets = new ArrayList<>();
+ Map<String, Object> secret = new LinkedHashMap<>();
+ secret.put("uid", "pg-user-creds");
+ secret.put("name", "{{ include \"common.release\" . }}-" + component + "-pg-user-creds");
+ secret.put("type", "basicAuth");
+ secret.put("externalSecret", "{{ ternary \"\" (tpl (default \"\" .Values.postgres.config.pgUserExternalSecret) .) (hasSuffix \"" + component + "-pg-user-creds\" .Values.postgres.config.pgUserExternalSecret) }}");
+ secret.put("login", "{{ .Values.postgres.config.pgUserName }}");
+ secret.put("password", "{{ .Values.postgres.config.pgUserPassword }}");
+ secret.put("passwordPolicy", "generate");
+ secrets.add(secret);
+ outerValues.put("secrets", secrets);
+ }
+ }
+
+ private Metadata extractMetadata(Self self) {
+ Metadata metadata = new Metadata();
+ metadata.setName(self.getName());
+ metadata.setDescription(self.getDescription());
+ metadata.setVersion(self.getVersion());
+ return metadata;
+ }
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/HelmClient.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/HelmClient.java
new file mode 100644
index 0000000..bcfe731
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/HelmClient.java
@@ -0,0 +1,31 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder;
+
+import java.io.File;
+
+/**
+ * An Interface for HelmClient to perform helm operations
+ * @author Dhrumin Desai
+ */
+public interface HelmClient {
+ void lint(File chartLocation);
+
+ File packageChart(File chartLocation, String outputLocation);
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/HelmClientImpl.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/HelmClientImpl.java
new file mode 100644
index 0000000..098ddda
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/HelmClientImpl.java
@@ -0,0 +1,119 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+/**
+ * HelmClient implementation which uses helm command installed in the runtime environment.
+ * @author Dhrumin Desai
+ */
+@Component
+@Slf4j
+public class HelmClientImpl implements HelmClient {
+
+ /**
+ * performs <code>helm lint</code> operation
+ * @param chartLocation helm chart location
+ */
+ @Override
+ public void lint(File chartLocation) {
+ ProcessBuilder builder = new ProcessBuilder();
+ builder.command("helm", "lint", chartLocation.getAbsolutePath());
+ runProcess(builder, "lint");
+ }
+
+ /**
+ * performs <code>helm package</code> operation
+ * @param chartLocation helm chart location
+ * @param outputLocation location to store the generated helm package
+ * @return generated helm tgz file
+ */
+ @Override
+ public File packageChart(File chartLocation, String outputLocation) {
+ ProcessBuilder builder = new ProcessBuilder();
+ builder.directory(new File(System.getProperty("user.dir")));
+ builder.command("helm", "package", "-d", outputLocation, chartLocation.getAbsolutePath());
+ return runProcess(builder, "package");
+ }
+
+ private File runProcess(ProcessBuilder builder, String command) {
+ Process process = null;
+ String chartPath = "";
+ try {
+ process = builder.start();
+ if(command.equals("lint")) {
+ printLintingProcessOutput(process);
+ }
+ else {
+ chartPath = printPackagingProcessOutput(process);
+ }
+ assertExitCode(process);
+ } catch (IOException e) {
+ log.error(e.getMessage(), e);
+ throw new RuntimeException("Error occurred while running helm command.");
+ } catch (InterruptedException e) {
+ log.error(e.getMessage(), e);
+ Thread.currentThread().interrupt();
+ throw new RuntimeException("execution interrupted");
+ }
+ return new File(chartPath);
+ }
+
+ private void printLintingProcessOutput(Process process) throws IOException {
+ final InputStream inputStream = process.getInputStream();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+ reader.lines().forEach(log::info);
+ inputStream.close();
+ }
+
+ private String printPackagingProcessOutput(Process process) throws IOException {
+ String helmChartPath = "";
+ final InputStream inputStream = process.getInputStream();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+ String line;
+ while ((line = reader.readLine()) != null){
+ if (line.contains("Successfully packaged chart and saved it to: ")){
+ helmChartPath = line.split("Successfully packaged chart and saved it to: ")[1];
+ }
+ log.info(line);
+ }
+ inputStream.close();
+ if(helmChartPath.isEmpty()){
+ throw new RuntimeException("Could not generate the chart.");
+ }
+ return helmChartPath;
+ }
+
+ private void assertExitCode(Process process) throws InterruptedException {
+ int exitCode = 0;
+ exitCode = process.waitFor();
+ process.destroy();
+ if (exitCode != 0){
+ throw new RuntimeException("Error occurred while running helm command.");
+ }
+ }
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/KeyValueMerger.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/KeyValueMerger.java
new file mode 100644
index 0000000..8a28871
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/KeyValueMerger.java
@@ -0,0 +1,94 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder;
+
+import lombok.extern.slf4j.Slf4j;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo.ChartInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.yaml.snakeyaml.Yaml;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+import java.nio.file.Paths;
+import java.util.Map;
+
+/**
+ * KeyValueMerger merges helm base templates key-values with key-values parsed from component specification file
+ * @author Dhrumin Desai
+ */
+@Component
+@Slf4j
+public class KeyValueMerger {
+
+ @Autowired
+ private Yaml yaml;
+
+ public KeyValueMerger(Yaml yaml) {
+ this.yaml = yaml;
+ }
+
+ /**
+ * merges helm base templates key-values with key-values parsed from component specification file
+ * @param chartInfo populated ChartInfo object which holds key-values parsed from component spec file
+ * @param chartDir location of the base helm chart template
+ */
+ public void mergeValuesToChart(ChartInfo chartInfo, File chartDir) {
+ mergeChartYamlFile(chartInfo, chartDir);
+ mergeValuesYamlFile(chartInfo, chartDir);
+ }
+
+ private void mergeChartYamlFile(ChartInfo chartInfo, File chartDir) {
+ String chartYamlFilePath = Paths.get(chartDir.getAbsolutePath(), "Chart.yaml").toString();
+ checkIfFIleExists(chartYamlFilePath, "Chart.yaml is not found in the given chart template.");
+
+ Map<String, Object> chartYamlKV;
+ try {
+ chartYamlKV = yaml.load(new FileInputStream(chartYamlFilePath));
+ chartYamlKV.put("name", chartInfo.getMetadata().getName());
+ chartYamlKV.put("version", chartInfo.getMetadata().getVersion());
+ chartYamlKV.put("description", chartInfo.getMetadata().getDescription());
+ yaml.dump(chartYamlKV, new PrintWriter(chartYamlFilePath));
+ } catch (FileNotFoundException e) {
+ log.error(e.getMessage());
+ }
+ }
+
+ private void mergeValuesYamlFile(ChartInfo chartInfo, File chartDir) {
+ String valuesYamlFilePath = Paths.get(chartDir.getAbsolutePath(), "values.yaml").toString();
+ checkIfFIleExists(valuesYamlFilePath, "values.yaml is not found in the given chart template.");
+ Map<String, Object> valuesYamlKv;
+ try {
+ valuesYamlKv = yaml.load(new FileInputStream(valuesYamlFilePath));
+ valuesYamlKv.putAll(chartInfo.getValues());
+ yaml.dump(valuesYamlKv, new PrintWriter(valuesYamlFilePath));
+ } catch (FileNotFoundException e) {
+ log.error(e.getMessage());
+ }
+ }
+
+ private void checkIfFIleExists(String filePath, String message) {
+ File valuesYaml = new File(filePath);
+ if (!valuesYaml.exists()) {
+ throw new RuntimeException(message);
+ }
+ }
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/config/YamlConfig.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/config/YamlConfig.java
new file mode 100644
index 0000000..47a7fbd
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/config/YamlConfig.java
@@ -0,0 +1,45 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.yaml.snakeyaml.DumperOptions;
+import org.yaml.snakeyaml.Yaml;
+
+/**
+ * Factory for Yaml object
+ * @author Dhrumin Desai
+ */
+@Configuration
+public class YamlConfig {
+
+ /**
+ * creates Yaml instance
+ * @return constructed Yaml object
+ */
+ @Bean
+ public Yaml getYamlInstance(){
+ DumperOptions options = new DumperOptions();
+ options.setIndent(2);
+ options.setPrettyFlow(true);
+ options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
+ return new Yaml(options);
+ }
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/distribution/ChartDistributor.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/distribution/ChartDistributor.java
new file mode 100644
index 0000000..7bcfefa
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/distribution/ChartDistributor.java
@@ -0,0 +1,29 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.distribution;
+
+import java.io.File;
+
+/**
+ * An interface for the helm chart distribution
+ * @author Dhrumin Desai
+ */
+public interface ChartDistributor {
+ void distribute(File chartFile);
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/distribution/ChartMuseumDistributor.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/distribution/ChartMuseumDistributor.java
new file mode 100644
index 0000000..ed861b0
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/distribution/ChartMuseumDistributor.java
@@ -0,0 +1,79 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.distribution;
+
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.Credentials;
+import okhttp3.MediaType;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Objects;
+
+/**
+ * Distributes helm chart to Chart Museum through REST
+ * @author Dhrumin Desai
+ */
+@Component
+@Slf4j
+public class ChartMuseumDistributor implements ChartDistributor {
+
+ @Value("${chartmuseum.baseurl}")
+ private String chartMuseumUrl;
+
+ @Value("${chartmuseum.auth.basic.username}")
+ private String username;
+
+ @Value("${chartmuseum.auth.basic.password}")
+ private String password;
+
+ /**
+ * distributes chart to Chart Museum
+ * @param chartFile packaged helm chart tgz file
+ */
+ @Override
+ public void distribute(File chartFile) {
+ OkHttpClient client = new OkHttpClient().newBuilder().build();
+ Request request = createRequestBody(chartFile);
+ try {
+ Response response = client.newCall(request).execute();
+ log.info(Objects.requireNonNull(response.body()).string());
+ } catch (IOException e) {
+ throw new RuntimeException(e.getMessage());
+ }
+ }
+
+ private Request createRequestBody(File chartFile) {
+ String credential = Credentials.basic(username, password);
+ MediaType mediaType = MediaType.parse("application/octet-stream");
+ RequestBody body = RequestBody.create(chartFile, mediaType);
+ return new Request.Builder()
+ .url(chartMuseumUrl)
+ .method("POST", body)
+ .addHeader("Content-Type", "application/octet-stream")
+ .addHeader("Authorization", credential)
+ .build();
+ }
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/chartinfo/ChartInfo.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/chartinfo/ChartInfo.java
new file mode 100644
index 0000000..45b15a6
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/chartinfo/ChartInfo.java
@@ -0,0 +1,35 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo;
+
+import lombok.Data;
+
+import java.util.Map;
+
+/**
+ * POJO class to hold key-values parsed from the spec file.
+ * @author Dhrumin Desai
+ */
+@Data
+public class ChartInfo {
+
+ private Metadata metadata;
+
+ private Map<String, Object> values;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/chartinfo/Metadata.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/chartinfo/Metadata.java
new file mode 100644
index 0000000..00408b2
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/chartinfo/Metadata.java
@@ -0,0 +1,32 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo;
+
+import lombok.Data;
+
+/**
+ * POJO class to hold metadata of a helm chart
+ * @author Dhrumin Desai
+ */
+@Data
+public class Metadata {
+ private String name;
+ private String version;
+ private String description;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/base/Auxilary.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/base/Auxilary.java
new file mode 100644
index 0000000..2b8504a
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/base/Auxilary.java
@@ -0,0 +1,76 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.base;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.HealthCheck;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Helm;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Policy;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Reconfigs;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.TlsInfo;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Volumes;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Auxilary of
+ * Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
+public class Auxilary {
+
+ private Helm helm;
+
+ private HealthCheck healthcheck;
+
+ private HealthCheck livehealthcheck;
+
+ private Volumes[] volumes;
+
+ private List<String> ports;
+
+ @JsonProperty("log_info")
+ private Map<String, String> logInfo;
+
+ @JsonProperty("tls_info")
+ private TlsInfo tlsInfo;
+
+ private Policy policy;
+
+ private Reconfigs reconfigs;
+
+ private List<LinkedHashMap<String, String>> env;
+
+ @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
+ private Map<String, String> databases;
+
+ @JsonProperty( value = "hpa_config", access = JsonProperty.Access.WRITE_ONLY)
+ private Object hpaConfig;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/base/ComponentSpec.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/base/ComponentSpec.java
new file mode 100644
index 0000000..80fa9cc
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/base/ComponentSpec.java
@@ -0,0 +1,54 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.base;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Artifacts;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Parameters;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.PolicyInfo;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Self;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Streams;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents base
+ * ComponentSpec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ComponentSpec {
+
+ private Self self;
+
+ private Streams streams;
+
+ private Parameters[] parameters;
+
+ private Auxilary auxilary;
+
+ private Artifacts[] artifacts;
+
+ @JsonProperty("policy_info")
+ private PolicyInfo policyInfo;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Artifacts.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Artifacts.java
new file mode 100644
index 0000000..742102c
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Artifacts.java
@@ -0,0 +1,41 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Artifacts
+ * used in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
+public class Artifacts {
+
+ private String type;
+
+ private String uri;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Calls.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Calls.java
new file mode 100644
index 0000000..3e1eb2b
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Calls.java
@@ -0,0 +1,43 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Calls used
+ * in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Calls {
+
+ @JsonProperty("config_key")
+ private String configKey;
+
+ private RequestResponse request;
+
+ private RequestResponse response;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/ConfigVolume.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/ConfigVolume.java
new file mode 100644
index 0000000..2e095f7
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/ConfigVolume.java
@@ -0,0 +1,34 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * A model class which represents Config Volume
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@EqualsAndHashCode
+public class ConfigVolume {
+
+ private String name;
+
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Constraints.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Constraints.java
new file mode 100644
index 0000000..b6b89a0
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Constraints.java
@@ -0,0 +1,61 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Constraints
+ * used in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Constraints {
+
+ private Object equal;
+
+ @JsonProperty("greater_than")
+ private int greaterThan;
+
+ @JsonProperty("greater_or_equal")
+ private int greaterOrEqual;
+
+ @JsonProperty("less_than")
+ private int lessThan;
+
+ @JsonProperty("less_or_equal")
+ private int lessOrEqual;
+
+ @JsonProperty("valid_values")
+ private Object[] validValues;
+
+ private int length;
+
+ @JsonProperty("min_length")
+ private int minLength;
+
+ @JsonProperty("max_length")
+ private int maxLength;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Container.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Container.java
new file mode 100644
index 0000000..7f7b1ce
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Container.java
@@ -0,0 +1,39 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Container
+ * used in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@EqualsAndHashCode
+public class Container {
+
+ private String bind;
+
+ private String mode;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/EntrySchema.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/EntrySchema.java
new file mode 100644
index 0000000..7a1f97d
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/EntrySchema.java
@@ -0,0 +1,47 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Entry Schema
+ * used in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class EntrySchema {
+
+ private String name;
+
+ private String description;
+
+ private String type;
+
+ private String value;
+
+ private EntrySchema[] entry_schema;
+
+ private boolean required;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/HealthCheck.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/HealthCheck.java
new file mode 100644
index 0000000..7aa87fc
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/HealthCheck.java
@@ -0,0 +1,54 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents HealthCheck
+ * used in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
+public class HealthCheck {
+
+ private String interval;
+
+ private String timeout;
+
+ private String script;
+
+ @JsonProperty(required = true)
+ private String type;
+
+ @JsonProperty(required = true)
+ private String endpoint;
+
+ private Integer initialDelaySeconds;
+
+ private Integer port;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Helm.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Helm.java
new file mode 100644
index 0000000..b210e34
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Helm.java
@@ -0,0 +1,35 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * A model class which represents helm field in Component Spec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@EqualsAndHashCode
+public class Helm {
+ private Object applicationEnv;
+
+ private Service service;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Host.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Host.java
new file mode 100644
index 0000000..d987479
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Host.java
@@ -0,0 +1,39 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Host used in
+ * Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@EqualsAndHashCode
+public class Host {
+
+ private String path;
+
+ private String mode;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Parameters.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Parameters.java
new file mode 100644
index 0000000..633fa27
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Parameters.java
@@ -0,0 +1,68 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Parameters
+ * used in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
+public class Parameters {
+
+ private String name;
+
+ private Object value;
+
+ private String description;
+
+ @JsonProperty("sourced_at_deployment")
+ private boolean sourcedAtDeployment;
+
+ @JsonProperty("designer_editable")
+ private boolean designerEditable;
+
+ @JsonProperty("policy_editable")
+ private boolean policyEditable;
+
+ private boolean required;
+
+ private String type;
+
+ @JsonProperty("policy_group")
+ private String policyGroup;
+
+ @JsonProperty("policy_schema")
+ private PolicySchema[] policySchemas;
+
+ @JsonProperty("entry_schema")
+ private EntrySchema[] entrySchemas;
+
+ private Constraints[] constraints;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Policy.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Policy.java
new file mode 100644
index 0000000..b5aa2e5
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Policy.java
@@ -0,0 +1,47 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Policy used
+ * in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
+public class Policy {
+
+ @JsonProperty("node_label")
+ private String nodeLabel;
+
+ @JsonProperty("policy_id")
+ private String policyID;
+
+ @JsonProperty("policy_model_id")
+ private String policyModelID;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/PolicyInfo.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/PolicyInfo.java
new file mode 100644
index 0000000..444cbe0
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/PolicyInfo.java
@@ -0,0 +1,38 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * A model class which represents policyInfo field in Component Spec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
+public class PolicyInfo {
+
+ private Policy[] policy;
+
+}
+
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/PolicySchema.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/PolicySchema.java
new file mode 100644
index 0000000..b584af5
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/PolicySchema.java
@@ -0,0 +1,51 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Policy
+ * Schema used in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class PolicySchema {
+
+ private String name;
+
+ private String description;
+
+ private String type;
+
+ private String value;
+
+ @JsonProperty("entry_schema")
+ private EntrySchema[] entrySchemas;
+
+ private boolean required;
+
+ private Constraints[] constraints;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Provides.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Provides.java
new file mode 100644
index 0000000..01c5186
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Provides.java
@@ -0,0 +1,44 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Provides
+ * used in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Provides {
+
+ private String route;
+
+ private RequestResponse request;
+
+ private RequestResponse response;
+
+ // Used in ONAP
+ private String verb;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Publishes.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Publishes.java
new file mode 100644
index 0000000..fa3bddc
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Publishes.java
@@ -0,0 +1,50 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Publishes
+ * used in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
+public class Publishes {
+
+ @JsonProperty("config_key")
+ private String configKey;
+
+ private String format;
+
+ private String type;
+
+ private String version;
+
+ // Used in ONAP
+ private String route;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Reconfigs.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Reconfigs.java
new file mode 100644
index 0000000..0aa6b77
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Reconfigs.java
@@ -0,0 +1,47 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Reconfigs
+ * used in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
+public class Reconfigs {
+
+ private String dti;
+
+ @JsonProperty("app_reconfig")
+ private String appReconfig;
+
+ private String policy;
+
+ private String streams;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/RequestResponse.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/RequestResponse.java
new file mode 100644
index 0000000..c4e494b
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/RequestResponse.java
@@ -0,0 +1,39 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Request
+ * Response used in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class RequestResponse {
+
+ private String format;
+
+ private String version;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Self.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Self.java
new file mode 100644
index 0000000..b45b391
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Self.java
@@ -0,0 +1,47 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Self used in
+ * Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
+public class Self {
+
+ @JsonProperty("component_type")
+ private String componentType;
+
+ private String description;
+
+ private String name;
+
+ private String version;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Service.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Service.java
new file mode 100644
index 0000000..1677896
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Service.java
@@ -0,0 +1,43 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * A model class which represents service field in Component Spec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties
+@EqualsAndHashCode
+public class Service {
+ private String type;
+
+ private String name;
+
+ @JsonProperty("has_internal_only_ports")
+ private Boolean hasInternalOnlyPorts;
+
+ private Object[] ports;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Streams.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Streams.java
new file mode 100644
index 0000000..852e3cd
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Streams.java
@@ -0,0 +1,41 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Streams used
+ * in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
+public class Streams {
+
+ private Publishes[] publishes;
+
+ private Subscribes[] subscribes;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Subscribes.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Subscribes.java
new file mode 100644
index 0000000..5e45d91
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Subscribes.java
@@ -0,0 +1,49 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Subscribes
+ * used in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
+public class Subscribes {
+
+ @JsonProperty("config_key")
+ private String configKey;
+
+ private String format;
+
+ private String route;
+
+ private String type;
+
+ private String version;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/TlsInfo.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/TlsInfo.java
new file mode 100644
index 0000000..a57b738
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/TlsInfo.java
@@ -0,0 +1,43 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * A model class which represents tlsInfo field in Component Spec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties
+@EqualsAndHashCode
+public class TlsInfo {
+ @JsonProperty("cert_directory")
+ private String certDirectory;
+
+ @JsonProperty("use_tls")
+ private Boolean useTls;
+
+ @JsonProperty("use_external_tls")
+ private Boolean useExternalTls;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Volumes.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Volumes.java
new file mode 100644
index 0000000..cf4539b
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Volumes.java
@@ -0,0 +1,49 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Volumes used
+ * in Componentspec
+ */
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
+public class Volumes {
+
+ private Container container;
+
+ private Host host;
+
+ @JsonProperty("config_volume")
+ private ConfigVolume configVolume;
+
+ private String type;
+
+ private String name;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ChartTemplateStructureValidator.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ChartTemplateStructureValidator.java
new file mode 100644
index 0000000..796ee91
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ChartTemplateStructureValidator.java
@@ -0,0 +1,60 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.validation;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+/**
+ * A class to validate structure of the base helm directory
+ */
+public class ChartTemplateStructureValidator {
+
+ /**
+ * validates base helm chart directory and throws error if the structure is not proper.
+ * @param chartTemplateLocation base helm chart dir location
+ */
+ public static void validateChartTemplateStructure(String chartTemplateLocation) {
+ checkBaseDirectory(chartTemplateLocation);
+ }
+
+ private static void checkBaseDirectory(String chartTemplateLocation) {
+ Path base = Paths.get(chartTemplateLocation, "base");
+ Path charts = Paths.get(chartTemplateLocation, "base/charts");
+ Path templates = Paths.get(chartTemplateLocation, "base/templates");
+ Path chart = Paths.get(chartTemplateLocation, "base/Chart.yaml");
+ Path values = Paths.get(chartTemplateLocation, "base/values.yaml");
+ if(!Files.exists(base)){
+ throw new RuntimeException("base directory not found in chart template location");
+ }
+ if(!Files.exists(charts)){
+ throw new RuntimeException("charts directory not found in base directory");
+ }
+ if(!Files.exists(templates)){
+ throw new RuntimeException("templates directory not found in base directory");
+ }
+ if(!Files.exists(chart)){
+ throw new RuntimeException("chart.yaml not found in base directory");
+ }
+ if(!Files.exists(values)){
+ throw new RuntimeException("values.yaml not found in base directory");
+ }
+ }
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidator.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidator.java
new file mode 100644
index 0000000..dfda935
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidator.java
@@ -0,0 +1,29 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.validation;
+
+import java.io.IOException;
+
+/**
+ * An interface for Component specification validator
+ * @author Dhrumin Desai
+ */
+public interface ComponentSpecValidator {
+ void validateSpecFile(String specFileLocation, String specSchemaLocation) throws IOException;
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidatorImpl.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidatorImpl.java
new file mode 100644
index 0000000..a74cab1
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidatorImpl.java
@@ -0,0 +1,108 @@
+/*
+ * # ============LICENSE_START=======================================================
+ * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * # ================================================================================
+ * # 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.
+ * # ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.helmchartgenerator.validation;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.FileUtils;
+import org.everit.json.schema.Schema;
+import org.everit.json.schema.loader.SchemaLoader;
+import org.json.JSONObject;
+import org.json.JSONTokener;
+import org.onap.dcaegen2.platform.helmchartgenerator.Utils;
+import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.base.ComponentSpec;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * A class for Component specification validation.
+ * @author Dhrumin Desai
+ */
+@Service
+@Slf4j
+public class ComponentSpecValidatorImpl implements ComponentSpecValidator {
+
+ /**
+ * Validates the spec json file against schema and prints errors if found
+ * @param specFileLocation specification json file location
+ * @param specSchemaLocation json schema file location
+ * @throws IOException
+ */
+ @Override
+ public void validateSpecFile(String specFileLocation, String specSchemaLocation) throws IOException {
+ File schemaFile = getSchemaFile(specSchemaLocation);
+ ComponentSpec cs = Utils.deserializeJsonFileToModel(specFileLocation, ComponentSpec.class);
+ validateSpecSchema(new File(specFileLocation), schemaFile);
+ validateHelmRequirements(cs);
+ }
+
+ private File getSchemaFile(String specSchemaLocation) throws IOException {
+ if(specSchemaLocation.isEmpty()){
+ return defaultSchemaFile();
+ }
+ else{
+ return new File(specSchemaLocation);
+ }
+ }
+
+ private File defaultSchemaFile() throws IOException {
+ File schemaFile = File.createTempFile("schema", ".json");
+ InputStream inputStream = new ClassPathResource("component-spec-schema.json").getInputStream();
+ FileUtils.copyInputStreamToFile(inputStream, schemaFile);
+ return schemaFile;
+ }
+
+ private void validateSpecSchema(File specFile, File schemaFile) {
+ try {
+ JSONTokener schemaData = new JSONTokener(new FileInputStream(schemaFile));
+ JSONObject jsonSchema = new JSONObject(schemaData);
+
+ JSONTokener jsonDataFile = new JSONTokener(new FileInputStream(specFile));
+ JSONObject jsonObject = new JSONObject(jsonDataFile);
+
+ Schema schemaValidator = SchemaLoader.load(jsonSchema);
+ schemaValidator.validate(jsonObject);
+ } catch (FileNotFoundException e) {
+ log.error(e.getMessage());
+ throw new RuntimeException("Specfile or Schemafile not found.");
+ }
+ }
+
+ private void validateHelmRequirements(ComponentSpec cs) {
+ checkHealthCheckSection(cs);
+ checkHelmSection(cs);
+ }
+
+ private void checkHealthCheckSection(ComponentSpec cs) {
+ if(cs.getAuxilary().getHealthcheck().getPort() == null) {
+ throw new RuntimeException("port in healthcheck section is a required field but was not found");
+ }
+ }
+
+ private void checkHelmSection(ComponentSpec cs) {
+ if(cs.getAuxilary().getHelm() == null){
+ throw new RuntimeException("helm section in component spec is required but was not found");
+ }
+ }
+}
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/resources/application.properties b/mod2/helm-generator/helmchartgenerator-core/src/main/resources/application.properties
new file mode 100644
index 0000000..df2005a
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/resources/application.properties
@@ -0,0 +1,5 @@
+spring.main.web-application-type=NONE
+
+chartmuseum.baseurl=http://localhost:8081/api/charts
+chartmuseum.auth.basic.username=TBD
+chartmuseum.auth.basic.password=TBD \ No newline at end of file
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/resources/component-spec-schema.json b/mod2/helm-generator/helmchartgenerator-core/src/main/resources/component-spec-schema.json
new file mode 100644
index 0000000..ddea3f0
--- /dev/null
+++ b/mod2/helm-generator/helmchartgenerator-core/src/main/resources/component-spec-schema.json
@@ -0,0 +1,1162 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "Component specification schema",
+ "type": "object",
+ "properties": {
+ "self": {
+ "type": "object",
+ "properties": {
+ "version": {
+ "$ref": "#/definitions/version"
+ },
+ "description": {
+ "type": "string"
+ },
+ "component_type": {
+ "type": "string",
+ "enum": [
+ "docker",
+ "cdap"
+ ]
+ },
+ "name": {
+ "$ref": "#/definitions/name"
+ }
+ },
+ "required": [
+ "version",
+ "name",
+ "description",
+ "component_type"
+ ]
+ },
+ "streams": {
+ "type": "object",
+ "properties": {
+ "publishes": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/publisher_http"
+ },
+ {
+ "$ref": "#/definitions/publisher_message_router"
+ },
+ {
+ "$ref": "#/definitions/publisher_data_router"
+ },
+ {
+ "$ref": "#/definitions/publisher_kafka"
+ }
+ ]
+ }
+ },
+ "subscribes": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/subscriber_http"
+ },
+ {
+ "$ref": "#/definitions/subscriber_message_router"
+ },
+ {
+ "$ref": "#/definitions/subscriber_data_router"
+ },
+ {
+ "$ref": "#/definitions/subscriber_kafka"
+ }
+ ]
+ }
+ }
+ },
+ "required": [
+ "publishes",
+ "subscribes"
+ ]
+ },
+ "services": {
+ "type": "object",
+ "properties": {
+ "calls": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/caller"
+ }
+ },
+ "provides": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/provider"
+ }
+ }
+ },
+ "required": [
+ "calls",
+ "provides"
+ ]
+ },
+ "parameters": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/docker-parameters"
+ },
+ {
+ "$ref": "#/definitions/cdap-parameters"
+ }
+ ]
+ },
+ "auxilary": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/auxilary_cdap"
+ },
+ {
+ "$ref": "#/definitions/auxilary_docker"
+ }
+ ]
+ },
+ "artifacts": {
+ "type": "array",
+ "description": "List of component artifacts",
+ "items": {
+ "$ref": "#/definitions/artifact"
+ }
+ },
+ "policy_info": {
+ "type": "object",
+ "properties": {
+ "policy": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "node_label": {
+ "type": "string"
+ },
+ "policy_id": {
+ "type": "string"
+ },
+ "policy_model_id": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "node_label",
+ "policy_model_id"
+ ]
+ }
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "self",
+ "streams",
+ "services",
+ "parameters",
+ "auxilary",
+ "artifacts"
+ ],
+ "additionalProperties": false,
+ "definitions": {
+ "cdap-parameters": {
+ "description": "There are three seperate ways to pass parameters to CDAP: app config, app preferences, program preferences. These are all treated as optional.",
+ "type": "object",
+ "properties": {
+ "program_preferences": {
+ "description": "A list of {program_id, program_type, program_preference} objects where program_preference is an object passed into program_id of type program_type",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/program_preference"
+ }
+ },
+ "app_preferences": {
+ "description": "Parameters Passed down to the CDAP preference API",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/parameter"
+ }
+ },
+ "app_config": {
+ "description": "Parameters Passed down to the CDAP App Config",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/parameter"
+ }
+ }
+ }
+ },
+ "program_preference": {
+ "type": "object",
+ "properties": {
+ "program_type": {
+ "$ref": "#/definitions/program_type"
+ },
+ "program_id": {
+ "type": "string"
+ },
+ "program_pref": {
+ "description": "Parameters that the CDAP developer wants pushed to this program's preferences API. Optional",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/parameter"
+ }
+ }
+ },
+ "required": [
+ "program_type",
+ "program_id",
+ "program_pref"
+ ]
+ },
+ "program_type": {
+ "type": "string",
+ "enum": [
+ "flows",
+ "mapreduce",
+ "schedules",
+ "spark",
+ "workflows",
+ "workers",
+ "services"
+ ]
+ },
+ "docker-parameters": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/parameter"
+ }
+ },
+ "parameter": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/parameter-list"
+ },
+ {
+ "$ref": "#/definitions/parameter-other"
+ }
+ ]
+ },
+ "parameter-list": {
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "description": "Default value for the parameter"
+ },
+ "description": {
+ "description": "Description for the parameter.",
+ "type": "string"
+ },
+ "type": {
+ "description": "Only valid type is list, the entry_schema is required - which contains the type of the list element. All properties set for the parameter apply to all elements in the list at this time",
+ "type": "string",
+ "enum": [
+ "list"
+ ]
+ },
+ "required": {
+ "description": "An optional key that declares a parameter as required (true) or not (false). Default is true.",
+ "type": "boolean",
+ "default": true
+ },
+ "constraints": {
+ "description": "The optional list of sequenced constraint clauses for the parameter.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/parameter-constraints"
+ }
+ },
+ "entry_schema": {
+ "description": "The optional property used to declare the name of the Datatype definition for entries of certain types. entry_schema must be defined when the type is list. This is the only type it is currently supported for.",
+ "type": "object",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/list-parameter"
+ }
+ },
+ "designer_editable": {
+ "description": "A required property that declares a parameter as editable by designer in SDC Tool (true) or not (false).",
+ "type": "boolean"
+ },
+ "sourced_at_deployment": {
+ "description": "A required property that declares that a parameter is assigned at deployment time (true) or not (false).",
+ "type": "boolean"
+ },
+ "policy_editable": {
+ "description": "A required property that declares a parameter as editable by DevOps in Policy UI (true) or not (false).",
+ "type": "boolean"
+ },
+ "policy_group": {
+ "description": "An optional property used to group policy_editable parameters into groups. Each group will become it's own policy model. Any parameters without this property will be grouped together to form their own policy model",
+ "type": "string"
+ },
+ "policy_schema": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/policy_schema_parameter"
+ }
+ }
+ },
+ "required": [
+ "name",
+ "value",
+ "description",
+ "designer_editable",
+ "policy_editable",
+ "sourced_at_deployment",
+ "entry_schema"
+ ],
+ "additionalProperties": false,
+ "dependencies": {
+ "policy_schema": [
+ "policy_editable"
+ ]
+ }
+ },
+ "parameter-other": {
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "description": "Default value for the parameter"
+ },
+ "description": {
+ "description": "Description for the parameter.",
+ "type": "string"
+ },
+ "type": {
+ "description": "The required data type for the parameter.",
+ "type": "string",
+ "enum": [
+ "string",
+ "number",
+ "boolean",
+ "datetime"
+ ]
+ },
+ "required": {
+ "description": "An optional key that declares a parameter as required (true) or not (false). Default is true.",
+ "type": "boolean",
+ "default": true
+ },
+ "constraints": {
+ "description": "The optional list of sequenced constraint clauses for the parameter.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/parameter-constraints"
+ }
+ },
+ "designer_editable": {
+ "description": "A required property that declares a parameter as editable by designer in SDC Tool (true) or not (false).",
+ "type": "boolean"
+ },
+ "sourced_at_deployment": {
+ "description": "A required property that declares that a parameter is assigned at deployment time (true) or not (false).",
+ "type": "boolean"
+ },
+ "policy_editable": {
+ "description": "A required property that declares a parameter as editable in Policy UI (true) or not (false).",
+ "type": "boolean"
+ },
+ "policy_group": {
+ "description": "An optional property used to group policy_editable parameters into groups. Each group will become it's own policy model. Any parameters without this property will be grouped together to form their own policy model",
+ "type": "string"
+ },
+ "policy_schema": {
+ "description": "An optional property used to define policy_editable parameters as lists or maps",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/policy_schema_parameter"
+ }
+ }
+ },
+ "required": [
+ "name",
+ "value",
+ "description",
+ "designer_editable",
+ "sourced_at_deployment",
+ "policy_editable"
+ ],
+ "additionalProperties": false,
+ "dependencies": {
+ "policy_schema": [
+ "policy_editable"
+ ]
+ }
+ },
+ "list-parameter": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "description": "The required data type for each parameter in the list.",
+ "type": "string",
+ "enum": [
+ "string",
+ "number"
+ ]
+ }
+ },
+ "required": [
+ "type"
+ ],
+ "additionalProperties": false
+ },
+ "policy_schema_parameter": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "description": "Default value for the parameter"
+ },
+ "description": {
+ "description": "Description for the parameter.",
+ "type": "string"
+ },
+ "type": {
+ "description": "The required data type for the parameter.",
+ "type": "string",
+ "enum": [
+ "string",
+ "number",
+ "boolean",
+ "datetime",
+ "list",
+ "map"
+ ]
+ },
+ "required": {
+ "description": "An optional key that declares a parameter as required (true) or not (false). Default is true.",
+ "type": "boolean",
+ "default": true
+ },
+ "constraints": {
+ "description": "The optional list of sequenced constraint clauses for the parameter.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/parameter-constraints"
+ }
+ },
+ "entry_schema": {
+ "description": "The optional key that is used to declare the name of the Datatype definition for entries of certain types. entry_schema must be defined when the type is either list or map. If the type is list and the entry type is a simple type (string, number, boolean, datetime), follow with a simple string to describe the entry type. If the type is list and the entry type is a map, follow with an array to describe the keys for the entry map. If the type is list and the entry type is also list, this is not currently supported here. If the type is map, then follow with an array to describe the keys for this map. ",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/policy_schema_parameter"
+ }
+ }
+ },
+ "required": [
+ "name",
+ "type"
+ ],
+ "additionalProperties": false
+ },
+ "parameter-constraints": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "equal": {
+ "description": "Constrains a property or parameter to a value equal to (‘=’) the value declared."
+ },
+ "greater_than": {
+ "description": "Constrains a property or parameter to a value greater than (‘>’) the value declared.",
+ "type": "number"
+ },
+ "greater_or_equal": {
+ "description": "Constrains a property or parameter to a value greater than or equal to (‘>=’) the value declared.",
+ "type": "number"
+ },
+ "less_than": {
+ "description": "Constrains a property or parameter to a value less than (‘<’) the value declared.",
+ "type": "number"
+ },
+ "less_or_equal": {
+ "description": "Constrains a property or parameter to a value less than or equal to (‘<=’) the value declared.",
+ "type": "number"
+ },
+ "valid_values": {
+ "description": "Constrains a property or parameter to a value that is in the list of declared values.",
+ "type": "array"
+ },
+ "length": {
+ "description": "Constrains the property or parameter to a value of a given length.",
+ "type": "number"
+ },
+ "min_length": {
+ "description": "Constrains the property or parameter to a value to a minimum length.",
+ "type": "number"
+ },
+ "max_length": {
+ "description": "Constrains the property or parameter to a value to a maximum length.",
+ "type": "number"
+ }
+ }
+ },
+ "stream_message_router": {
+ "type": "object",
+ "properties": {
+ "format": {
+ "$ref": "#/definitions/name"
+ },
+ "version": {
+ "$ref": "#/definitions/version"
+ },
+ "config_key": {
+ "type": "string"
+ },
+ "type": {
+ "description": "Type of stream to be used",
+ "type": "string",
+ "enum": [
+ "message router",
+ "message_router"
+ ]
+ }
+ },
+ "required": [
+ "format",
+ "version",
+ "config_key",
+ "type"
+ ]
+ },
+ "stream_kafka": {
+ "type": "object",
+ "properties": {
+ "format": {
+ "$ref": "#/definitions/name"
+ },
+ "version": {
+ "$ref": "#/definitions/version"
+ },
+ "config_key": {
+ "type": "string"
+ },
+ "type": {
+ "description": "Type of stream to be used",
+ "type": "string",
+ "enum": [
+ "kafka"
+ ]
+ }
+ },
+ "required": [
+ "format",
+ "version",
+ "config_key",
+ "type"
+ ]
+ },
+ "publisher_http": {
+ "type": "object",
+ "properties": {
+ "format": {
+ "$ref": "#/definitions/name"
+ },
+ "version": {
+ "$ref": "#/definitions/version"
+ },
+ "config_key": {
+ "type": "string"
+ },
+ "type": {
+ "description": "Type of stream to be used",
+ "type": "string",
+ "enum": [
+ "http",
+ "https"
+ ]
+ }
+ },
+ "required": [
+ "format",
+ "version",
+ "config_key",
+ "type"
+ ]
+ },
+ "publisher_message_router": {
+ "$ref": "#/definitions/stream_message_router"
+ },
+ "publisher_data_router": {
+ "type": "object",
+ "properties": {
+ "format": {
+ "$ref": "#/definitions/name"
+ },
+ "version": {
+ "$ref": "#/definitions/version"
+ },
+ "config_key": {
+ "type": "string"
+ },
+ "type": {
+ "description": "Type of stream to be used",
+ "type": "string",
+ "enum": [
+ "data router",
+ "data_router"
+ ]
+ }
+ },
+ "required": [
+ "format",
+ "version",
+ "config_key",
+ "type"
+ ]
+ },
+ "publisher_kafka": {
+ "$ref": "#/definitions/stream_kafka"
+ },
+ "subscriber_http": {
+ "type": "object",
+ "properties": {
+ "format": {
+ "$ref": "#/definitions/name"
+ },
+ "version": {
+ "$ref": "#/definitions/version"
+ },
+ "route": {
+ "type": "string"
+ },
+ "type": {
+ "description": "Type of stream to be used",
+ "type": "string",
+ "enum": [
+ "http",
+ "https"
+ ]
+ }
+ },
+ "required": [
+ "format",
+ "version",
+ "route",
+ "type"
+ ]
+ },
+ "subscriber_message_router": {
+ "$ref": "#/definitions/stream_message_router"
+ },
+ "subscriber_data_router": {
+ "type": "object",
+ "properties": {
+ "format": {
+ "$ref": "#/definitions/name"
+ },
+ "version": {
+ "$ref": "#/definitions/version"
+ },
+ "route": {
+ "type": "string"
+ },
+ "type": {
+ "description": "Type of stream to be used",
+ "type": "string",
+ "enum": [
+ "data router",
+ "data_router"
+ ]
+ },
+ "config_key": {
+ "description": "Data router subscribers require config info to setup their endpoints to handle requests. For example, needs username and password",
+ "type": "string"
+ }
+ },
+ "required": [
+ "format",
+ "version",
+ "route",
+ "type",
+ "config_key"
+ ]
+ },
+ "subscriber_kafka": {
+ "$ref": "#/definitions/stream_kafka"
+ },
+ "provider": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/docker-provider"
+ },
+ {
+ "$ref": "#/definitions/cdap-provider"
+ }
+ ]
+ },
+ "cdap-provider": {
+ "type": "object",
+ "properties": {
+ "request": {
+ "$ref": "#/definitions/formatPair"
+ },
+ "response": {
+ "$ref": "#/definitions/formatPair"
+ },
+ "service_name": {
+ "type": "string"
+ },
+ "service_endpoint": {
+ "type": "string"
+ },
+ "verb": {
+ "type": "string",
+ "enum": [
+ "GET",
+ "PUT",
+ "POST",
+ "DELETE"
+ ]
+ }
+ },
+ "required": [
+ "request",
+ "response",
+ "service_name",
+ "service_endpoint",
+ "verb"
+ ]
+ },
+ "docker-provider": {
+ "type": "object",
+ "properties": {
+ "request": {
+ "$ref": "#/definitions/formatPair"
+ },
+ "response": {
+ "$ref": "#/definitions/formatPair"
+ },
+ "route": {
+ "type": "string"
+ },
+ "verb": {
+ "type": "string",
+ "enum": [
+ "GET",
+ "PUT",
+ "POST",
+ "DELETE"
+ ]
+ }
+ },
+ "required": [
+ "request",
+ "response",
+ "route"
+ ]
+ },
+ "caller": {
+ "type": "object",
+ "properties": {
+ "request": {
+ "$ref": "#/definitions/formatPair"
+ },
+ "response": {
+ "$ref": "#/definitions/formatPair"
+ },
+ "config_key": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "request",
+ "response",
+ "config_key"
+ ]
+ },
+ "formatPair": {
+ "type": "object",
+ "properties": {
+ "format": {
+ "$ref": "#/definitions/name"
+ },
+ "version": {
+ "$ref": "#/definitions/version"
+ }
+ }
+ },
+ "name": {
+ "type": "string"
+ },
+ "version": {
+ "type": "string",
+ "pattern": "^(\\d+\\.)(\\d+\\.)(\\*|\\d+)$"
+ },
+ "artifact": {
+ "type": "object",
+ "description": "Component artifact object",
+ "properties": {
+ "uri": {
+ "type": "string",
+ "description": "Uri to artifact"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "jar",
+ "docker image"
+ ]
+ }
+ },
+ "required": [
+ "uri",
+ "type"
+ ]
+ },
+ "auxilary_cdap": {
+ "title": "cdap component specification schema",
+ "type": "object",
+ "properties": {
+ "streamname": {
+ "type": "string"
+ },
+ "artifact_name": {
+ "type": "string"
+ },
+ "artifact_version": {
+ "type": "string",
+ "pattern": "^(\\d+\\.)(\\d+\\.)(\\*|\\d+)$"
+ },
+ "namespace": {
+ "type": "string",
+ "description": "optional"
+ },
+ "programs": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/cdap_program"
+ }
+ }
+ },
+ "required": [
+ "streamname",
+ "programs",
+ "artifact_name",
+ "artifact_version"
+ ]
+ },
+ "cdap_program_type": {
+ "type": "string",
+ "enum": [
+ "flows",
+ "mapreduce",
+ "schedules",
+ "spark",
+ "workflows",
+ "workers",
+ "services"
+ ]
+ },
+ "cdap_program": {
+ "type": "object",
+ "properties": {
+ "program_type": {
+ "$ref": "#/definitions/cdap_program_type"
+ },
+ "program_id": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "program_type",
+ "program_id"
+ ]
+ },
+ "auxilary_docker": {
+ "title": "Docker component specification schema",
+ "type": "object",
+ "properties": {
+ "helm": {
+ "type": "object",
+ "properties": {
+ "applicationEnv": {
+ "type": "object"
+ },
+ "service": {
+ "description": "Mapping for kubernetes services",
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "NodePort",
+ "Cluster"
+ ]
+ },
+ "name": {
+ "type": "string"
+ },
+ "ports": {
+ "type": "array",
+ "items": {
+ "type": "object"
+ }
+ }
+ },
+ "required": [
+ "type",
+ "name",
+ "ports"
+ ]
+ }
+ },
+ "required": [
+ "service"
+ ]
+ },
+ "healthcheck": {
+ "description": "Define the health check that Consul should perfom for this component",
+ "type": "object",
+ "oneOf": [
+ {
+ "$ref": "#/definitions/docker_healthcheck_http"
+ },
+ {
+ "$ref": "#/definitions/docker_healthcheck_script"
+ }
+ ]
+ },
+ "ports": {
+ "description": "Port mapping to be used for Docker containers. Each entry is of the format <container port>:<host port>.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "log_info": {
+ "description": "Component specific details for logging",
+ "type": "object",
+ "properties": {
+ "log_directory": {
+ "description": "The path in the container where the component writes its logs. If the component is following the EELF requirements, this would be the directory where the four EELF files are being written. (Other logs can be placed in the directory--if their names in '.log', they'll also be sent into ELK.)",
+ "type": "string"
+ },
+ "alternate_fb_path": {
+ "description": "By default, the log volume is mounted at /var/log/onap/<component_type> in the sidecar container's file system. 'alternate_fb_path' allows overriding the default. Will affect how the log data can be found in the ELK system.",
+ "type": "string"
+ }
+ },
+ "additionalProperties": false
+ },
+ "tls_info": {
+ "description": "Component information to use tls certificates",
+ "type": "object",
+ "properties": {
+ "cert_directory": {
+ "description": "The path in the container where the component certificates will be placed by the init container",
+ "type": "string"
+ },
+ "use_tls": {
+ "description": "Boolean flag to determine if the application is using tls certificates",
+ "type": "boolean"
+ },
+ "use_external_tls": {
+ "description": "Boolean flag to determine if the application is using tls certificates for external communication",
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "cert_directory",
+ "use_tls"
+ ],
+ "additionalProperties": false
+ },
+ "databases": {
+ "description": "The databases the application is connecting to using the pgaas",
+ "type": "object",
+ "additionalProperties": {
+ "type": "string",
+ "enum": [
+ "postgres"
+ ]
+ }
+ },
+ "policy": {
+ "properties": {
+ "trigger_type": {
+ "description": "Only value of docker is supported at this time.",
+ "type": "string",
+ "enum": [
+ "docker"
+ ]
+ },
+ "script_path": {
+ "description": "Script command that will be executed for policy reconfiguration",
+ "type": "string"
+ }
+ },
+ "required": [
+ "trigger_type",
+ "script_path"
+ ],
+ "additionalProperties": false
+ },
+ "volumes": {
+ "description": "Volume mapping to be used for Docker containers. Each entry is of the format below",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "oneOf": [
+ {
+ "$ref": "#/definitions/host_path_volume"
+ },
+ {
+ "$ref": "#/definitions/config_map_volume"
+ }
+ ]
+ }
+ }
+ },
+ "required": [
+ "healthcheck"
+ ],
+ "additionalProperties": false
+ },
+ "host_path_volume": {
+ "type": "object",
+ "properties": {
+ "host": {
+ "type": "object",
+ "path": {
+ "type": "string"
+ }
+ },
+ "container": {
+ "type": "object",
+ "bind": {
+ "type": "string"
+ },
+ "mode": {
+ "type": "string"
+ }
+ }
+ },
+ "required": [
+ "host",
+ "container"
+ ]
+ },
+ "config_map_volume": {
+ "type": "object",
+ "properties": {
+ "config_volume": {
+ "type": "object",
+ "name": {
+ "type": "string"
+ }
+ },
+ "container": {
+ "type": "object",
+ "bind": {
+ "type": "string"
+ },
+ "mode": {
+ "type": "string"
+ }
+ }
+ },
+ "required": [
+ "config_volume",
+ "container"
+ ]
+ },
+ "docker_healthcheck_http": {
+ "properties": {
+ "type": {
+ "description": "Consul health check type",
+ "type": "string",
+ "enum": [
+ "http",
+ "https",
+ "HTTP",
+ "HTTPS"
+ ]
+ },
+ "interval": {
+ "description": "Interval duration in seconds i.e. 10s",
+ "default": "15s",
+ "type": "string"
+ },
+ "timeout": {
+ "description": "Timeout in seconds i.e. 10s",
+ "default": "1s",
+ "type": "string"
+ },
+ "endpoint": {
+ "description": "Relative endpoint used by Consul to check health by making periodic HTTP GET calls",
+ "type": "string"
+ },
+ "port": {
+ "description": "Port mapping for readiness section",
+ "type": "integer"
+ },
+ "initialDelaySeconds": {
+ "description": "Initial delay in seconds for readiness section",
+ "type": "integer"
+ }
+ },
+ "required": [
+ "type",
+ "endpoint"
+ ]
+ },
+ "docker_healthcheck_script": {
+ "properties": {
+ "type": {
+ "description": "Consul health check type",
+ "type": "string",
+ "enum": [
+ "script",
+ "docker"
+ ]
+ },
+ "interval": {
+ "description": "Interval duration in seconds i.e. 10s",
+ "default": "15s",
+ "type": "string"
+ },
+ "timeout": {
+ "description": "Timeout in seconds i.e. 10s",
+ "default": "1s",
+ "type": "string"
+ },
+ "script": {
+ "description": "Script command that will be executed by Consul to check health",
+ "type": "string"
+ },
+ "initialDelaySeconds": {
+ "description": "Initial delay in seconds for readiness section",
+ "type": "integer"
+ }
+ },
+ "required": [
+ "type",
+ "script"
+ ]
+ }
+ }
+} \ No newline at end of file