X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=mod2%2Fhelm-generator%2Fhelmchartgenerator-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdcaegen2%2Fplatform%2Fhelmchartgenerator%2Fchartbuilder%2FComponentSpecParser.java;h=91fedf5330d98c70ecfa33c60b15c32d259b4331;hb=388c4d246eef260560fdcf936dec14e7e9c7430f;hp=9a9f8f15fadeeb769bbf639b716134763106bb5a;hpb=af9ecfff73cb5a3a4dc24e2840bf5a2a46a08694;p=dcaegen2%2Fplatform.git 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 index 9a9f8f1..91fedf5 100644 --- 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 @@ -1,6 +1,6 @@ /* * # ============LICENSE_START======================================================= - * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved. + * # Copyright (c) 2021-2022 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. @@ -96,7 +96,9 @@ public class ComponentSpecParser { 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")); + Map logPath = new LinkedHashMap<>(); + logPath.put("path", cs.getAuxilary().getLogInfo().get("log_directory")); + outerValues.put("log", logPath); } if(imageUriExistsForFirstArtifact(cs)){ utils.putIfNotNull(outerValues,"image", cs.getArtifacts()[0].getUri()); @@ -243,7 +245,8 @@ public class ComponentSpecParser { Map keystore = new LinkedHashMap<>(); Map passwordsSecretRef = new LinkedHashMap<>(); TlsInfo tlsInfo = cs.getAuxilary().getTlsInfo(); - String componentName = getComponentNameWithOmitFirstWord(cs); + String componentName = getComponentNameWithOmitFirstWordAndTrimHyphens(cs); + outerValues.put("useCmpv2Certificates", false); if(externalTlsExists(tlsInfo)) { String mountPath = tlsInfo.getCertDirectory(); if(tlsInfo.getUseExternalTls() != null && tlsInfo.getUseExternalTls()) { @@ -260,15 +263,16 @@ public class ComponentSpecParser { utils.putIfNotNull(certificate,"dnsNames", List.of(cs.getSelf().getName())); certificate.put("keystore", keystore); outerValues.put("certificates", List.of(certificate)); + outerValues.put("useCmpv2Certificates", true); } } - private String getComponentNameWithOmitFirstWord(ComponentSpec cs) { - return cs.getSelf().getName().substring(cs.getSelf().getName().indexOf("-") + 1); + private String getComponentNameWithOmitFirstWordAndTrimHyphens(ComponentSpec cs) { + return cs.getSelf().getName().substring(cs.getSelf().getName().indexOf("-") + 1).replaceAll("-",""); } private boolean externalTlsExists(TlsInfo tlsInfo) { - return tlsInfo != null && tlsInfo.getUseExternalTls() != null && tlsInfo.getUseExternalTls().equals(true); + return tlsInfo != null && tlsInfo.getUseExternalTls() != null && tlsInfo.getUseExternalTls(); } private void checkCertificateYamlExists(String chartTemplateLocation) { @@ -301,7 +305,7 @@ public class ComponentSpecParser { private void populatePostgresSection(Map outerValues, ComponentSpec cs) { if(cs.getAuxilary().getDatabases() != null) { String componentFullName = cs.getSelf().getName(); - String component = getComponentNameWithOmitFirstWord(cs); + String component = getComponentNameWithOmitFirstWordAndTrimHyphens(cs); Map postgres = new LinkedHashMap<>(); Map service = new LinkedHashMap<>(); Map container = new LinkedHashMap<>(); @@ -332,7 +336,7 @@ public class ComponentSpecParser { private void populateSecretsSection(Map outerValues, ComponentSpec cs) { if(cs.getAuxilary().getDatabases() != null) { - String component = getComponentNameWithOmitFirstWord(cs); + String component = getComponentNameWithOmitFirstWordAndTrimHyphens(cs); List secrets = new ArrayList<>(); Map secret = new LinkedHashMap<>(); secret.put("uid", "pg-user-creds");