diff options
author | Tomasz Wrobel <tomasz.wrobel@nokia.com> | 2021-04-12 12:28:16 +0200 |
---|---|---|
committer | Tomasz Wrobel <tomasz.wrobel@nokia.com> | 2021-04-12 12:34:26 +0200 |
commit | 8b42cf54a9b8fab9a3ac8d37376ec752d00d2883 (patch) | |
tree | 829e33979c60c6c66599de25db7f5e10aa148780 /src/main/java | |
parent | a39ffbf3cae394c8964e8407b4eee2d39aab4f41 (diff) |
Remove support for Helm v21.1.0
- Remove mapping to helm v2 when version desired is not provided
- Remove Helm v2 clients from container
Issue-ID: SDC-3185
Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com>
Change-Id: I43def179ee35ade76905a88f83bd17b9be787481
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/onap/sdc/helmvalidator/helm/versions/ChartBasedVersionProvider.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main/java/org/onap/sdc/helmvalidator/helm/versions/ChartBasedVersionProvider.java b/src/main/java/org/onap/sdc/helmvalidator/helm/versions/ChartBasedVersionProvider.java index b892a33..c3e423f 100644 --- a/src/main/java/org/onap/sdc/helmvalidator/helm/versions/ChartBasedVersionProvider.java +++ b/src/main/java/org/onap/sdc/helmvalidator/helm/versions/ChartBasedVersionProvider.java @@ -20,6 +20,7 @@ package org.onap.sdc.helmvalidator.helm.versions; +import java.util.List; import org.onap.sdc.helmvalidator.helm.versions.exception.NotSupportedApiVersionException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -27,6 +28,9 @@ import org.springframework.stereotype.Service; @Service public class ChartBasedVersionProvider { + private static final List<String> SUPPORTED_API_VERSIONS = List.of("v1", "v2"); + private static final String HELM_3 = "3"; + private final SupportedVersionsProvider supportedVersionsProvider; private final ApiVersionsReader apiVersionsReader; @@ -40,18 +44,14 @@ public class ChartBasedVersionProvider { public String getVersion(String chartPath) { String apiVersion = apiVersionsReader.readVersion(chartPath); - return mapToChartVersion(apiVersion); + return mapToHelmVersion(apiVersion); } - private String mapToChartVersion(String apiVersion) { - switch (apiVersion) { - case "v1": - return supportedVersionsProvider.getLatestVersion("2"); - case "v2": - return supportedVersionsProvider.getLatestVersion("3"); - default: - throw new NotSupportedApiVersionException("Cannot obtain Helm version from API version: " + apiVersion); + private String mapToHelmVersion(String apiVersion) { + if (!SUPPORTED_API_VERSIONS.contains(apiVersion)) { + throw new NotSupportedApiVersionException("Cannot obtain Helm version from API version: " + apiVersion); } + return supportedVersionsProvider.getLatestVersion(HELM_3); } } |