Skip to content

Commit c734ddb

Browse files
committed
fix version check to cater for version strings with vendor suffixes
1 parent a24824f commit c734ddb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public HealthCheckHelper(ClientHolder client, String operatorNamespace, Collecti
147147
namespaceAccessChecks.put(AuthorizationProxy.Resource.ingresses, ingressOperations);
148148
namespaceAccessChecks.put(AuthorizationProxy.Resource.networkpolicies, networkPoliciesOperations);
149149
clusterAccessChecks.put(AuthorizationProxy.Resource.customresourcedefinitions, crudOperations);
150-
150+
151151
clusterAccessChecks.put(AuthorizationProxy.Resource.domains, domainOperations);
152152

153153
// Readonly resources
@@ -248,7 +248,9 @@ private void verifyK8sVersion() throws ApiException {
248248
// git version is of the form v1.7.5
249249
// Check the 3rd part of the version.
250250
String[] splitVersion = gitVersion.split("\\.");
251-
if (Integer.parseInt(splitVersion[2]) < 5) {
251+
// issue-36: gitVersion can be not just "v1.7.9" but also values like "v1.7.9+coreos.0"
252+
splitVersion = splitVersion[2].split("\\+");
253+
if (Integer.parseInt(splitVersion[0]) < 5) {
252254
k8sMinVersion = false;
253255
}
254256
}

0 commit comments

Comments
 (0)