Fix bugs on k8s-particpant 98/123898/1
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>
Mon, 6 Sep 2021 15:15:32 +0000 (16:15 +0100)
committerrameshiyer27 <ramesh.murugan.iyer@est.tech>
Mon, 6 Sep 2021 15:15:32 +0000 (16:15 +0100)
  Configure repository without port
  Add CL element state change
  Fix log directory creation inside container

Issue-ID: POLICY-3629
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: I4564025a94053342b21e6600e0ee7c563bd23243

packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml
participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java
participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java
participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartService.java
participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml

index d91cc73..ebd744f 100644 (file)
@@ -7,7 +7,7 @@ security:
   enable-csrf: false
 
 participant:
-  localChartDirectory: /var/helm-manager/local-charts
+  localChartDirectory: /home/policy/local-charts
   infoFileName: CHART_INFO.json
   intermediaryParameters:
     reportingTimeIntervalMs: 120000
@@ -51,4 +51,4 @@ logging:
     org.springframework.data: ERROR
     org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR
   file:
-    name: /var/log/helm-manager/application.log
+    name: /var/log/onap/policy/clamp/application.log
index 24a0755..da0ef13 100644 (file)
@@ -143,6 +143,9 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
             var config = CODER.convert(nodeTemplate.getProperties(), ThreadConfig.class);
             checkPodStatus(chartInfo, config.uninitializedToPassiveTimeout, config.podStatusCheckInterval);
 
+            intermediaryApi.updateControlLoopElementState(element.getId(), ControlLoopOrderedState.PASSIVE,
+                    ControlLoopState.UNINITIALISED, ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+
         } catch (ServiceException | CoderException | IOException e) {
             LOGGER.warn("Installation of Helm chart failed", e);
         }
index 7954dbb..1c40553 100644 (file)
@@ -183,12 +183,16 @@ public class HelmClient {
     }
 
     private ProcessBuilder prepareRepoAddCommand(HelmRepository repo) {
+        var url = repo.getProtocol() + "://" + repo.getAddress();
+        if (repo.getPort() != null) {
+            url =  url + ":" + repo.getPort();
+        }
         // @formatter:off
         List<String> helmArguments = new ArrayList<>(
                 List.of(
                         "helm",
                         "repo",
-                        "add", repo.getRepoName(), repo.getProtocol() + "://" + repo.getAddress() + ":" + repo.getPort()
+                        "add", repo.getRepoName(), url
                 ));
         if (repo.getUserName() != null && repo.getPassword() != null) {
             helmArguments.addAll(List.of("--username", repo.getUserName(), "--password",  repo.getPassword()));
index 770bbb2..a07fca5 100644 (file)
@@ -112,7 +112,7 @@ public class ChartService {
      * @throws ServiceException incase of error
      */
     public void configureRepository(HelmRepository repo) throws ServiceException {
-        if (repo.getAddress() != null && repo.getPort() != null) {
+        if (repo.getAddress() != null) {
             helmClient.addRepository(repo);
         }
     }
index 713b072..e169331 100644 (file)
@@ -7,7 +7,7 @@ security:
   enable-csrf: false
 
 participant:
-  localChartDirectory: /var/helm-manager/local-charts
+  localChartDirectory: /home/policy/local-charts
   infoFileName: CHART_INFO.json
   intermediaryParameters:
     reportingTimeIntervalMs: 120000
@@ -53,4 +53,4 @@ logging:
     org.springframework.data: ERROR
     org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR
   file:
-    name: /var/log/helm-manager/application.log
+    name: /var/log/onap/policy/clamp/application.log