Kubernetes-client: Support OpenShift 4.x

Created on 16 Jul 2019  路  9Comments  路  Source: fabric8io/kubernetes-client

It seems that OpenShift 4 is not supported, I get the following error when creating a new project:

Code snippet

            client.projectrequests().createNew().
                    withNewMetadata().
                    withName(name).
                    endMetadata().
                    done();

Error

io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://api.cluster-01.devcluster.openshift.com:6443/oapi/v1/projectrequests. Received status: Status(apiVersion=v1, code=404, details=null, kind=Status, message=null, metadata=null, reason=null, status=null, additionalProperties={}).
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:503)
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.assertResponseCode(OperationSupport.java:442)
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:406)
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:365)
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleCreate(OperationSupport.java:234)
    at io.fabric8.openshift.client.dsl.internal.ProjectRequestsOperationImpl.create(ProjectRequestsOperationImpl.java:74)
    at io.fabric8.openshift.client.dsl.internal.ProjectRequestsOperationImpl.lambda$createNew$0(ProjectRequestsOperationImpl.java:89)
    at io.fabric8.openshift.api.model.DoneableProjectRequest.done(DoneableProjectRequest.java:27)
feature platforopenshift

All 9 comments

Hmm, this is something we would need to provide as soon as possible

@rohanKanojia apparently the endpoint changed. The ProjectRequests Endpoint looks like this:
https://api.cluster-01.devcluster.openshift.com:6443/apis/project.openshift.io/v1/projectrequests

And I may be wrong but I think that new endpoint URL works in Openshift 3.11 too

So, ProjectRequest and Templates. Are these the only resources which are affected by 4.x endpoint changes? Or are there more resources?

These are the ones I use and tested. It would be nice if we could run the integration tests against a local OS4 (Codeready containers?)

I ran tests on my local crc setup, these seem to be failing:

Deleting project: itest-c9cb307e...
Project: itest-c9cb307e, successfully deleted
Destroying Session:c9cb307e
[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Failures: 
[ERROR]   ServiceIT.getURL:173
[ERROR] Errors: 
[ERROR]   CustomResourceDefinitionIT.testCrdOperations:85 禄 KubernetesClient An error ha...
[ERROR]   SecurityContextConstraintsIT.cleanup:165 禄 ConditionTimeout Condition io.fabri...
[ERROR]   SecurityContextConstraintsIT.init:71 禄 KubernetesClient Failure executing: POS...
[ERROR]   SecurityContextConstraintsIT.init:71 禄 KubernetesClient Failure executing: POS...
[ERROR]   SecurityContextConstraintsIT.init:71 禄 KubernetesClient Failure executing: POS...
[ERROR]   SecurityContextConstraintsIT.init:71 禄 KubernetesClient Failure executing: POS...
[ERROR]   TemplateIT.init:78 禄 KubernetesClient Failure executing: POST at: https://api....
[ERROR]   TemplateIT.init:78 禄 KubernetesClient Failure executing: POST at: https://api....
[ERROR]   TemplateIT.init:78 禄 KubernetesClient Failure executing: POST at: https://api....
[ERROR]   TemplateIT.init:78 禄 KubernetesClient Failure executing: POST at: https://api....
[ERROR]   UserImpersonationIT.should_be_able_to_create_a_project_impersonating_service_account:131 禄 KubernetesClient
[INFO] 
[ERROR] Tests run: 136, Failures: 1, Errors: 11, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.4:report (default-report) @ kubernetes-itests ---
[INFO] Skipping JaCoCo execution due to missing classes directory.
[INFO] 
[INFO] --- maven-failsafe-plugin:3.0.0-M3:verify (default) @ kubernetes-itests ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11:48 min
[INFO] Finished at: 2019-07-29T18:27:02+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:3.0.0-M3:verify (default) on project kubernetes-itests: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/Rohaan/go/src/github.com/fabric8io/kubernetes-client/kubernetes-itests/target/failsafe-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
~/go/src/github.com/fabric8io/kubernetes-client/kubernetes-itests : $ 

@rohanKanojia did you run these tests based on master or in my branch? Just asking because I think I have already fixed the TemplateIT test

I ran on master

Was this page helpful?
0 / 5 - 0 ratings