Skip to content

Commit

Permalink
fix: kubeVersionAtLeast now stips non numeric characters
Browse files Browse the repository at this point in the history
  • Loading branch information
iocanel committed Nov 12, 2020
1 parent 10d55aa commit e906c61
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public class ClusterEntity {
public static final String FRAMEWORK = "framework";
public static final String ARQUILLIAN = "arquillian";

public static final String NON_NUMERIC_CHARACTERS = "[^\\d.]";
public static final String EMPTY = "";

public static void apply(InputStream inputStream) {
try (KubernetesClient client = new DefaultKubernetesClient()) {
String namespace = getArquillianNamespace();
Expand All @@ -53,8 +56,8 @@ public static void remove(InputStream inputStream) {
public static boolean kubernetesVersionAtLeast(String majorVersion, String minorVersion) {
try (KubernetesClient client = new DefaultKubernetesClient()) {
VersionInfo versionInfo = client.getVersion();
String clusterMajorVersion = versionInfo.getMajor();
String clusterMinorVersion = versionInfo.getMinor();
String clusterMajorVersion = versionInfo.getMajor().replaceAll(NON_NUMERIC_CHARACTERS, EMPTY);
String clusterMinorVersion = versionInfo.getMinor().replaceAll(NON_NUMERIC_CHARACTERS, EMPTY);

if (Integer.parseInt(majorVersion) < Integer.parseInt(clusterMajorVersion)) {
return true;
Expand Down

0 comments on commit e906c61

Please sign in to comment.