Closed edeandrea closed 1 year ago
That's odd (the project check), we'll take a look and provide a fix.
Thanks for the bug report. I can reproduce this issue. I think this is caused by upgrade of KubernetesClient. I see this line:
in v1.8.0, it was throwing OpenShiftNotAvailableException but on v1.9.0 it's just returning a regular DefaultOpenShiftClient object
Could you provide the stack-trace, that method shouldn't be called to determine if the underlying cluster is OpenShift (I think most of these checks were replaced when upgrading the client version).
Also, do you have any idea why our tests haven't showed this behavior?
I think it's called from ApplyService while applying RoleBinding
ApplyService.applyRoleBinding(ApplyService.java:712)
ApplyService.applyNamespace(ApplyService.java:954)
ApplyService.applyNamespace(ApplyService.java:961)
ApplyService.getOpenShiftClient(ApplyService.java:349)
OpenShiftHelper.asOpenShiftClient(OpenShiftHelper.java:49) (should return null but returns valid object)
We do seem to have a test for this scenario in OpenShiftHelperTest but there we're mocking client's adapt method to throw exception (which is not happening with 6.x version)
OK; so this is due to the usage of a RoleBinding resource.
In the original Kubernetes Client bump PR (#1464), we left out a few places where we checked if the cluster was OpenShift.
To verify if a cluster is an OpenShift cluster, we need to reuse the method OpenshiftHelper.isOpenShift.
So basically we need to find all of the usages of asOpenShiftClient and replace any if-else with the asOpenShiftClient(client) != null
with the proper check (isOpenShift
).
For additional safety, we should also modify the asOpenShiftClient
to make sure that if isOpenShift(client)
returns false
, the method returns null
.
Thank you @manusa and @rohanKanojia for the quick turnaround! Is there a timeline for when 1.9.1 might be released?
It was released this morning, but there might be some problems with the repository synchronization. I've been waiting for more than 8 hours now to complete the release process :sweat:
New version is now available from Maven Central. @edeandrea please confirm if the fix works for you :pray: :crossed_fingers:
Doesn't look like its in maven central yet (or at least hasn't dispersed through their CDN).
Now its there. Looks good! Confirmed it worked.
Again - many thanks for the extremely quick turnaround!
Now its there. Looks good! Confirmed it worked.
Awesome news :rocket:
Again - many thanks for the extremely quick turnaround!
Thank you for trying and reporting. This was a critical one, I'm glad we caught it so quickly.
Describe the bug
I have a learning tutorial (https://kubebyexample.com/learning-paths/developing-spring-boot-kubernetes/lesson-4-deploying-spring-boot-kubernetes-eclipse) which currently uses JKube 1.8.0. It is a simple Spring Boot application that uses the JKube
kubernetes-maven-plugin
to deploy to minikube.The source code is at https://github.com/RedHat-Middleware-Workshops/spring-jkube-external-config/tree/solution.
As part of the repo there are some GitHub actions which verify that things work correctly. Upon upgrading JKube from 1.8.0 to 1.9.0 the
k8s:deploy
task no longer works. I get this output:It looks as if its trying to create a
project.openshift.io/v1/project
, but I'm not sure why it would be doing that. This is thekubernetes-maven-plugin
, not theopenshift-maven-plugin
.This issue is preventing me from upgrading.
Eclipse JKube version
other (please specify in additional context)
Component
Kubernetes Maven Plugin
Apache Maven version
3.8.4
Gradle version
No response
Steps to reproduce
pom.xml
, update<jkube.version>1.8.0</jkube.version>
to<jkube.version>1.9.0</jkube.version>
./mvnw clean k8s:deploy -Pk8s -DskipTests
In addition to failing on my local machine (Mac M1), it is failing in GitHub actions too (https://github.com/RedHat-Middleware-Workshops/spring-jkube-external-config/actions/runs/3034325286)
Expected behavior
I would expect the deployment to minikube to be successful, just as it is with version 1.8.0
Runtime
minikube
Kubernetes API Server version
other (please specify in additional context)
Environment
Linux, macOS
Eclipse JKube Logs
Sample Reproducer Project
https://github.com/RedHat-Middleware-Workshops/spring-jkube-external-config/tree/solution
Additional context
JKube version is
1.9.0
(no option for1.9.0
is available in theEclipse JKube version
dropdown.Minikube/Kubernetes version: