summaryrefslogtreecommitdiffstats
path: root/artifactbroker
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2020-08-13 14:15:20 +0200
committerLukasz Rajewski <lukasz.rajewski@orange.com>2020-08-13 14:15:20 +0200
commit04ab3c197d2791db89a6d67e6c31fb987154fb95 (patch)
treef4c100c4d974122b720d4065d022b946ae1f2be1 /artifactbroker
parent7351cde6316dc9524bbc6856924456525802f9e1 (diff)
HELM artifact type support
HELM artifact type support was added to the k8s artifact broker. Issue-ID: MULTICLOUD-1120 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com> Change-Id: Iee101420ea3876ce3991085915e1cdc6841dfd2f
Diffstat (limited to 'artifactbroker')
-rw-r--r--artifactbroker/packages/src/main/resources/etc/defaultConfig.json3
-rw-r--r--artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/k8s/K8sArtifactForwarder.java37
-rw-r--r--artifactbroker/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java2
-rw-r--r--artifactbroker/plugins/reception-plugins/src/test/resources/handling-sdc.json3
-rw-r--r--artifactbroker/plugins/reception-plugins/src/test/resources/handling-sdcInvalid.json3
5 files changed, 32 insertions, 16 deletions
diff --git a/artifactbroker/packages/src/main/resources/etc/defaultConfig.json b/artifactbroker/packages/src/main/resources/etc/defaultConfig.json
index 1e9221a..6f0ace4 100644
--- a/artifactbroker/packages/src/main/resources/etc/defaultConfig.json
+++ b/artifactbroker/packages/src/main/resources/etc/defaultConfig.json
@@ -40,7 +40,8 @@
"TOSCA_CSAR",
"HEAT",
"HEAT_ENV",
- "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT"
+ "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT",
+ "HELM"
],
"consumerGroup": "policy-group",
"environmentName": "AUTO",
diff --git a/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/k8s/K8sArtifactForwarder.java b/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/k8s/K8sArtifactForwarder.java
index 8ad07df..5f93e28 100644
--- a/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/k8s/K8sArtifactForwarder.java
+++ b/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/k8s/K8sArtifactForwarder.java
@@ -66,6 +66,7 @@ public class K8sArtifactForwarder implements ArtifactForwarder {
private static final Logger LOGGER = FlexLogger.getLogger(K8sArtifactForwarder.class);
private static final String BASE_PATH = "http://localhost:9015/v1/rb/definition";
private static final String CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT = "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT";
+ private static final String HELM_ARTIFACT = "HELM";
private Map<String, IArtifactInfo> artifactMap;
private K8sArtifactForwarderParameterGroup configurationParameters = null;
@@ -154,23 +155,35 @@ public class K8sArtifactForwarder implements ArtifactForwarder {
boolean found = false;
for (String artifact: artifacts) {
- if ( artifactMap.get(artifact) != null
- && artifactMap.get(artifact).getArtifactType().equals("CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT")) {
- if ( cloudArtifactCount == 0 )
- firstCloudArtifact = artifactMap.get(artifact);
- cloudArtifactCount++;
- IArtifactInfo tmpArtifact = artifactMap.get(artifact);
- if ( tmpArtifact.getArtifactName().toLowerCase().startsWith(vfNamePrefix) ) {
- cloudArtifact = tmpArtifact;
- found = true;
- break;
- }
+ if (artifactMap.get(artifact) != null
+ && artifactMap.get(artifact).getArtifactType().equals(HELM_ARTIFACT)) {
+ firstCloudArtifact = artifactMap.get(artifact);
+ cloudArtifact = firstCloudArtifact;
+ cloudArtifactCount = 1;
+ found = true;
+ break;
}
}
+ if ( found == false )
+ for (String artifact: artifacts) {
+ if ( artifactMap.get(artifact) != null
+ && artifactMap.get(artifact).getArtifactType().equals(CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT)) {
+ if ( cloudArtifactCount == 0 )
+ firstCloudArtifact = artifactMap.get(artifact);
+ cloudArtifactCount++;
+ IArtifactInfo tmpArtifact = artifactMap.get(artifact);
+ if ( tmpArtifact.getArtifactName().toLowerCase().startsWith(vfNamePrefix) ) {
+ cloudArtifact = tmpArtifact;
+ found = true;
+ break;
+ }
+ }
+ }
+
if ( found == false ) {
if ( firstCloudArtifact == null ) {
- System.out.println(" meets error , no CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT type found ");
+ System.out.println(" meets error , no CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT or HELM type found ");
return false;
} else {
if ( cloudArtifactCount == 1 || vfNamePrefix == "" ) {
diff --git a/artifactbroker/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java b/artifactbroker/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
index f9a65c5..8f16708 100644
--- a/artifactbroker/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
+++ b/artifactbroker/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
@@ -55,7 +55,7 @@ public class TestSdcReceptionHandlerConfigurationParameterGroup {
assertTrue(validationResult.isValid());
final SdcConfiguration config = new SdcConfiguration(configParameters);
assertEquals(Arrays.asList("a.com", "b.com", "c.com"), config.getMsgBusAddress());
- assertEquals(Arrays.asList("TOSCA_CSAR", "HEAT"), config.getRelevantArtifactTypes());
+ assertEquals(Arrays.asList("TOSCA_CSAR", "HEAT", "HELM"), config.getRelevantArtifactTypes());
assertEquals("localhost", config.getAsdcAddress());
assertEquals("policy", config.getUser());
assertEquals("policy", config.getPassword());
diff --git a/artifactbroker/plugins/reception-plugins/src/test/resources/handling-sdc.json b/artifactbroker/plugins/reception-plugins/src/test/resources/handling-sdc.json
index 0bb936b..aa548e4 100644
--- a/artifactbroker/plugins/reception-plugins/src/test/resources/handling-sdc.json
+++ b/artifactbroker/plugins/reception-plugins/src/test/resources/handling-sdc.json
@@ -14,7 +14,8 @@
"consumerId": "policy-id",
"artifactTypes": [
"TOSCA_CSAR",
- "HEAT"
+ "HEAT",
+ "HELM"
],
"consumerGroup": "policy-group",
"environmentName": "TEST",
diff --git a/artifactbroker/plugins/reception-plugins/src/test/resources/handling-sdcInvalid.json b/artifactbroker/plugins/reception-plugins/src/test/resources/handling-sdcInvalid.json
index 803fc41..65201d1 100644
--- a/artifactbroker/plugins/reception-plugins/src/test/resources/handling-sdcInvalid.json
+++ b/artifactbroker/plugins/reception-plugins/src/test/resources/handling-sdcInvalid.json
@@ -13,7 +13,8 @@
"consumerId": "policy-id",
"artifactTypes": [
"TOSCA_CSAR",
- "HEAT"
+ "HEAT",
+ "HELM"
],
"consumerGroup": "policy-group",
"environmentName": "environmentName",