-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replaced openshift-rest-client library with fabric8.kubernetes #3381
Replaced openshift-rest-client library with fabric8.kubernetes #3381
Conversation
Can one of the admins verify this patch? |
</exclusions> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>openshift-client</artifactId> | ||
<version>${io.fabric8.openshift-client.version}</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
block should be in https://github.com/eclipse/che-dependencies/blob/master/pom.xml
and each dependency needs to have a CQ
I see one (your request) which is https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12209 but it's for version 1.4 while here I see 1.4.26
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review @benoitf. Indeed this code is not ready to be merged to master yet.
Are you sure that a CQ for version 1.4 (which by the way doesn't exist) isn't valid for 1.4.* versions too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@l0rd AFAIK each version need to be approved as it's based on the source code provided.
IMHO migrating from 1.4.25 to 1.4.26 requires a new CQ
also if I remember, even branches should have valid CQs (only code that is not in eclipse/che repository can use any code (for example your fork)
@@ -5,6 +5,9 @@ | |||
import com.openshift.restclient.IResourceFactory; | |||
import com.openshift.restclient.model.IPort; | |||
import com.openshift.restclient.model.IServicePort; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to remove obsolete com.openshift.restclient.* imports
@l0rd after switch to fabric8 I am not able to create any workspace. The problem seems to be coupled with "createOpenShiftService" method |
0200c9d
to
47e77c6
Compare
@lord here is the stacktrace:
it looks like che.openshift.mini hostname is forbidden to use |
@benoitf yes, we are going to open a CQ for openshift-client 1.4.26 version. In the meantime I was trying to setup a build without using "-Dskip-enforce". I have added openshift-client to che-dependencies, but when I run the build I have the following error:
So, in order to make it work I had to add those dependencies to pom.xml and che-dependencies - ibuziuk/che-dependencies@228bb81 Basically, openshift-client depends on those libs:
Am I correct that opening CQs for kubernetes-client & kubernetes-model is not required and they can be added once CQ for openshift-client 1.4.26 will be approved ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes seem good and the fabric8.kubernetes api seems to be a lot easier to read and work with. However there is a weird issue with stopping workspaces where deletion does not seem to be complete. I'll have to look into it more and test it on another machine later.
import io.fabric8.kubernetes.api.model.PodSpecBuilder; | ||
import io.fabric8.kubernetes.api.model.Probe; | ||
import io.fabric8.kubernetes.api.model.ProbeBuilder; | ||
import io.fabric8.kubernetes.api.model.ReplicationController; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReplicationController is an unused dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
||
// Then | ||
List<String> keysAndValues = env.keySet().stream().map(k -> k + "=" + env.get(k)).collect(Collectors.toList()); | ||
List<String> keysAndValues = env.stream().map(k -> k.getName() + "=" + k.getValue()).collect(Collectors.toList()); | ||
assertTrue(Arrays.stream(envVariablesOut).anyMatch(keysAndValues::contains)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test fails (and has been failing since bc0717a). We should fix or remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes good catch. This test didn't make sense anymore. I removed it.
openShiftClient.delete(pod); | ||
if ( pod != null ) { | ||
LOG.info("Removing OpenShift Pod " + pod.getMetadata().getName()); | ||
openShiftClient.resource(pod).delete(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this may be causing an issue where OpenShift prevents full deletion of the pod. After I stop a workspace, OpenShift immediately recreates the pod, which is then stuck in ImagePullBackOff
> oc get pods
NAME READY STATUS RESTARTS AGE
che-host-1-oas8k 1/1 Running 0 1h
che-ws-946kcw4tm6djd9k9-1058218227-rkm5w 0/1 ImagePullBackOff 0 5m
che-ws-y714ql3djvc4q1dy-1150559083-dyo0h 0/1 ImagePullBackOff 0 6m
router-1-wotpb 2/2 Running 10 20d
These pods have replica sets that are not removed, and so they are recreated. Since a pod with the name exists, the corresponding workspace cannot be restarted.
> oc get replicasets
NAME DESIRED CURRENT AGE
che-ws-946kcw4tm6djd9k9-1058218227 1 1 3m
che-ws-y714ql3djvc4q1dy-1150559083 1 1 1h
>oc get deployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
che-ws-946kcw4tm6djd9k9 1 1 1 0 21m
che-ws-y714ql3djvc4q1dy 1 1 1 0 1h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed that too thanks
47e77c6
to
d2a667e
Compare
@ibuziuk I can't reproduce your issue neither now. But I had this behaviour when I first started to test fabric8. That's related to the SSL certificate of minishift but I have no clue how to solve it: the issue has disappeared on my laptop without any particular change in the code or config (maybe try restarting minishift). |
@l0rd deleting minishift cluster and creating it from scratch helped \o/ Not sure but might be coupled with a fact that I had obsolete openshift/origin-haproxy-router image. +1 for this changes once CQ is approved |
d2a667e
to
01bae4d
Compare
openShiftClient.delete(pod); | ||
if ( pod != null ) { | ||
LOG.info("Removing OpenShift Pod " + pod.getMetadata().getName()); | ||
openShiftClient.resource(pod).delete(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@l0rd missing curly brace after rebase
IService svc = getCheServiceBySelector("deploymentConfig", deploymentConfig); | ||
Map<String, String> annotations = convertKubernetesNamesToLabels(svc.getAnnotations()); | ||
Pod pod = getChePodByContainerId(info.getId()); | ||
if (pod == null ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces for if () are different in the file
expected formatting is
if (var != value)
we have
if ( var != value )
or
if (var != value )
or
if (var!=value)
Signed-off-by: Mario Loriedo <mloriedo@redhat.com>
01bae4d
to
3e80ee6
Compare
@l0rd yes for this PR all is fine for me. |
Replace library (openshift-restclient)[https://github.com/openshift/openshift-restclient-java] with (fabric8-kubernetes)[https://github.com/fabric8io/kubernetes-client] to access the OpenShift API.
@ibuziuk and @amisevsk please review
Signed-off-by: Mario Loriedo mario.loriedo@gmail.com