Skip to content

Commit c4cf876

Browse files
authored
Merge pull request #74 from cerndb/issue-73
Issue-73. Fix problem with Minor Version. If it is not just a number …
2 parents ef4343f + da1b7ee commit c4cf876

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main/java/oracle/kubernetes/operator/helpers/HealthCheckHelper.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,21 @@ private void verifyK8sVersion() throws ApiException {
241241
if (major < 1) {
242242
k8sMinVersion = false;
243243
} else if (major == 1) {
244+
// The Minor version can be also 8+
245+
String minor_string = info.getMinor();
246+
// It will check if it is a number.
247+
// If not it will remove the last part of the string in order to have just a number
248+
while( ! minor_string.chars().allMatch( Character::isDigit )) {
249+
minor_string = minor_string.substring(0, minor_string.length() -1);
250+
}
244251
Integer minor = Integer.parseInt(info.getMinor());
245252
if (minor < 7) {
246253
k8sMinVersion = false;
247-
} else if (minor == 7) {
254+
} else if (minor >= 7) {
248255
// git version is of the form v1.7.5
249256
// Check the 3rd part of the version.
250257
String[] splitVersion = gitVersion.split("\\.");
251-
// issue-36: gitVersion can be not just "v1.7.9" but also values like "v1.7.9+coreos.0"
258+
// issue-36: gitVersion can be not just "v1.7.9" but also values like "v1.7.9+coreos.0"
252259
splitVersion = splitVersion[2].split("\\+");
253260
if (Integer.parseInt(splitVersion[0]) < 5) {
254261
k8sMinVersion = false;

0 commit comments

Comments
 (0)