aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-kubernetes
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2021-06-16 12:08:01 +0100
committerliamfallon <liam.fallon@est.tech>2021-06-17 15:51:34 +0100
commit2d186df9e3ed47599dbc86c2f435f7884535398c (patch)
treed77b85e48927ad072248e784c7b99b12205f4e0b /participant/participant-impl/participant-impl-kubernetes
parent17f5d3c97e47064407452122bc6cb801e43df5f9 (diff)
Clean up CLAMP Sonar and checkstyle issues
This commit cleans up sonar and checkstyle issues identified in the CLAMP repository. Issue-ID: POLICY-3206 Change-Id: I16b61bbe771cc17de15183a24b2a5e82a8d35872 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-kubernetes')
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/controller/ChartController.java12
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java19
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartService.java18
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java1
4 files changed, 29 insertions, 21 deletions
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/controller/ChartController.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/controller/ChartController.java
index 427b06fc5..5560e47a8 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/controller/ChartController.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/controller/ChartController.java
@@ -74,7 +74,8 @@ public class ChartController {
*
* @param info Info of the chart to be installed
* @return Status of the install operation
- * @throws ServiceException incase of error
+ * @throws ServiceException in case of error
+ * @throws IOException in case of IO error
*/
@PostMapping(path = "/install", consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
@@ -97,7 +98,7 @@ public class ChartController {
* @param name name of the chart
* @param version version of the chart
* @return Status of operation
- * @throws ServiceException incase of error.
+ * @throws ServiceException in case of error.
*/
@DeleteMapping(path = "/uninstall/{name}/{version}", produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Uninstall the Chart")
@@ -118,9 +119,10 @@ public class ChartController {
*
* @param chartFile Multipart file for the helm chart
* @param infoJson AppInfo of the chart
+ * @param overrideFile the file for overriding the chart
* @return Status of onboard operation
- * @throws ServiceException incase of error
- * @throws IOException incase of IO error
+ * @throws ServiceException in case of error
+ * @throws IOException in case of IO error
*/
@PostMapping(path = "/charts", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
@@ -147,7 +149,7 @@ public class ChartController {
* @param name name of the chart
* @param version version of the chart
* @return Status of operation
- * @throws ServiceException incase of error.
+ * @throws ServiceException in case of error.
*/
@DeleteMapping(path = "/charts/{name}/{version}")
@ApiOperation(value = "Delete the chart")
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java
index 1b7599ce9..343a44617 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java
@@ -46,7 +46,6 @@ public class HelmClient {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
/**
* Install a chart.
*
@@ -70,7 +69,9 @@ public class HelmClient {
* Finds helm chart repository for the chart.
*
* @param chart ChartInfo.
- * @throws ServiceException incase of error
+ * @return the chart repository as a string
+ * @throws ServiceException in case of error
+ * @throws IOException in case of IO errors
*/
public String findChartRepository(ChartInfo chart) throws ServiceException, IOException {
updateHelmRepo();
@@ -127,8 +128,8 @@ public class HelmClient {
return output;
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
- throw new ServiceException(
- "Failed to execute the Command: " + commandStr + ", the command was interrupted", ie);
+ throw new ServiceException("Failed to execute the Command: " + commandStr + ", the command was interrupted",
+ ie);
} catch (Exception exc) {
throw new ServiceException("Failed to execute the Command: " + commandStr, exc);
}
@@ -139,12 +140,12 @@ public class HelmClient {
// @formatter:off
List<String> helmArguments = new ArrayList<>(
Arrays.asList(
- "helm",
- "install", chart.getReleaseName(), chart.getRepository() + "/" + chart.getChartName(),
- "--version", chart.getVersion(),
- "--namespace", chart.getNamespace()
+ "helm",
+ "install", chart.getReleaseName(), chart.getRepository() + "/" + chart.getChartName(),
+ "--version", chart.getVersion(),
+ "--namespace", chart.getNamespace()
)
- );
+ );
// @formatter:on
// Verify if values.yaml available for the chart
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartService.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartService.java
index 6accac339..29a49a9ff 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartService.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartService.java
@@ -53,7 +53,7 @@ public class ChartService {
* @param name name of the app
* @param version version of the app
* @return chart
- * @throws ServiceException incase of error.
+ * @throws ServiceException in case of error.
*/
public ChartInfo getChart(String name, String version) throws ServiceException {
return chartStore.getChart(name, version);
@@ -63,12 +63,13 @@ public class ChartService {
* Save a helm chart.
* @param chartInfo name and version of the app.
* @param chartFile Helm chart file
+ * @param overrideFile override file
* @return chart details of the helm chart
- * @throws IOException incase of IO error
- * @throws ServiceException incase of error
+ * @throws IOException in case of IO error
+ * @throws ServiceException in case of error
*/
public ChartInfo saveChart(ChartInfo chartInfo, MultipartFile chartFile, MultipartFile overrideFile)
- throws IOException, ServiceException {
+ throws IOException, ServiceException {
return chartStore.saveChart(chartInfo, chartFile, overrideFile);
}
@@ -83,7 +84,8 @@ public class ChartService {
/**
* Install a helm chart.
* @param chart name and version.
- * @throws ServiceException incase of error
+ * @throws ServiceException in case of error
+ * @throws IOException in case of IO errors
*/
public void installChart(ChartInfo chart) throws ServiceException, IOException {
if (chart.getRepository() == null) {
@@ -102,7 +104,9 @@ public class ChartService {
/**
* Finds helm chart repository for a given chart.
* @param chart chartInfo.
- * @throws ServiceException incase of error
+ * @return the chart repo as a string
+ * @throws ServiceException in case of error
+ * @throws IOException in case of IO errors
*/
public String findChartRepo(ChartInfo chart) throws ServiceException, IOException {
logger.info("Fetching helm chart repository for the given chart {} ", chart.getChartName());
@@ -112,7 +116,7 @@ public class ChartService {
/**
* Uninstall a helm chart.
* @param chart name and version
- * @throws ServiceException incase of error.
+ * @throws ServiceException in case of error.
*/
public void uninstallChart(ChartInfo chart) throws ServiceException {
logger.info("Uninstalling helm deployment {}", chart.getReleaseName());
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java
index 041c0c810..e7458a4cd 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java
@@ -94,6 +94,7 @@ public class ChartStore {
*
* @param chartInfo chartInfo
* @param chartFile helm chart file.
+ * @param overrideFile override file.
* @return chart
* @throws IOException incase of IO error
* @throws ServiceException incase of error.