Setting up External Service using EndPoints

Skip to first unread message

Alex T

unread,
Sep 8, 2015, 6:12:26 AM9/8/15
to fabric8
Hi All,

Firstly, many thanks James to confirm my last post about the GOGS issue for the CDelivery.

In order to go further with my POC, I decided to setup an external GOGS service to use my existing GOGS server that we are using.

I followed the instruction from this link integrating_external_services and services but no much luck  !  (I couldn't figure out how to inspect the log files or if there are any ?  nothing from the openshift log !  ) 

So, I tried this using the camel CDI simple to query my external KIE-Server.

I makes sure that the following code works perfectly fine on my server in the camel CDI sample  :



Then I changed the IP and port as  service as :

@Uri("http://{{service:kie-server}}/services/rest/server/containers/myCheese)


Finally, I set up the external service as :

NAME         CLUSTER_IP       EXTERNAL_IP   PORT(S)    SELECTOR                            AGE
kie-server   172.30.152.243   <none>        9080/TCP   <none>                              4m

as per the document, if a service doesn't have a 'Selector', then the EndPointController won't create a new one. So, I have to manually create the EndPoint for my external Service.

NAME         ENDPOINTS           AGE
kie-server   101.25.101.238:9080   5m


I am expecting the URI should become :


at runtime, but the service proxy should translate this to use the EndPoint value ? 

However, this wasn't the case and I am getting HTTP 404 as following :

</batch-execution>]. Caused by: [org.apache.camel.http.common.HttpOperationFailedException - HTTP operation failed invok
org.apache.camel.http.common.HttpOperationFailedException: HTTP operation failed invoking http://172.30.152.243:9080/ser
vices/rest/server/containers/myCheese with statusCode: 404

Seems like no translation ?  or the translation should have been happened before that ?

Inside the camelCDI pod, I can see the server's env variables :

KIE_SERVER_PORT=tcp://172.30.152.243:9080
KIE_SERVER_PORT_9080_TCP=tcp://172.30.152.243:9080
KIE_SERVER_PORT_9080_TCP_ADDR=172.30.152.243
KIE_SERVER_PORT_9080_TCP_PORT=9080
KIE_SERVER_PORT_9080_TCP_PROTO=tcp
KIE_SERVER_SERVICE_HOST=172.30.152.243
KIE_SERVER_SERVICE_PORT=9080

Nothing about the EndPoints.  Any ideas how this works ?

Many Thanks for help suggestions.

Regards

Alex




Alex T

unread,
Sep 8, 2015, 9:06:38 AM9/8/15
to fabric8
Further investigating by rsh into the camelcdi pod, then perform a <curl> on the url :

   HTTP/1.1 404 Not Found
   Connection: keep-alive
   X-Powered-By: Undertow/1
   Server: WildFly/8
   Content-Length: 74
   Content-Type: text/html
   Date: Tue, 08 Sep 2015 12:57:59 GMT
 
   Interestingly, it is hitting the Wildfly server which is hosting the kie-server.  However, getting a 404 ! 

However, if I am <curl> on the actual Kie-Server IP :

HTTP/1.1 401 Unauthorized
Expires: 0
Cache-Control: no-cache, no-store, must-revalidate
X-Powered-By: Undertow/1
Server: WildFly/8
Pragma: no-cache
Date: Tue, 08 Sep 2015 13:04:33 GMT
Connection: keep-alive
WWW-Authenticate: Basic realm="KIE Server"
Content-Type: text/html;charset=UTF-8
Content-Length: 71

which gives me 'Unauthorized' error, 401.

No sure why the different response ?  

Alex T

unread,
Sep 8, 2015, 9:09:18 AM9/8/15
to fabric8
The IP address is 101.25.101.238,  sry the typo.

Jimmi Dyson

unread,
Sep 8, 2015, 9:20:53 AM9/8/15
to Alex T, fabric8
You seem to be hitting different paths? /containers/myCheese vs /kie-server-620/services/rest/server/containers

That would mean the actual target server would return different responses, no?

--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alex T

unread,
Sep 8, 2015, 12:00:45 PM9/8/15
to fabric8
Thanks for the reply Jimmi.

I figured out the problem and this is a bit embarrassing !  The setup was right from the beginning and it is as simple as this has been documented  ! It was my bad.  I sweared  I only changed the IP to {service:name},  some how the "kie-server-620" path in the new URL was missing (you can see the url in my initial post), hence, the problem. Adding the extra url and all works fine ! 

Well, this proves that the External Service using Endpoint is working fine. (BTW, there is a typo in the Openshift Origin document, in the sample json, metadata->name in the Service is different from the one in Endpoint which is wrong. They should be the same as explained in the Kubernetes doc.)

Anyway, my main task for this is to get the GOGS external repository to work with the CDelivery service and this is still no working.

After replacing the original GOGS service with the external GOGS service, seems like all the other related services such as forge, jenkins are still having the old IP in their ENV variables :

GOGS_PORT=tcp://172.30.163.51:80
GOGS_PORT_80_TCP=tcp://172.30.163.51:80

My new GOGS service IP :

NAME                     CLUSTER_IP       EXTERNAL_IP   PORT(S)     SELECTOR                                    AGE
gogs                     172.30.33.175    <none>        80/TCP      <none>                                      22m

with Endpoint :
NAME                     ENDPOINTS           AGE
gogs                     10.35.224.78:443    1h

I am not sure which services are using GOGS, so bounced Vagrant to resolved this. (Anyone is having the list ?) 

When Click Projects->Sign-In to create new project, I am getting 

Failed to load resource: the server responded with a status of 503 (Service Unavailable)
libs-375df221.js:11 [Forge] failed to load https://vagrant.f8:8443/api/v1/proxy/namespaces/default/services/fabric8-fo…ic%20YWxleC50c3VpOk1zZXJ2MTIzIQ%3D%3D&_gogsEmail=gogsadmin%40fabric8.local. status: 503 data: Error: 'dial tcp 172.17.0.18:8080: connection refused'

I guess this is because the GOGS login.  

Trying to look into details, I guess this is because of  GOGS http vs https ?  For security reason, our GOGS has been configured to use https only, but the CDelivery seems like expecting http.  What is the best way to change this ?


Thanks 

Alex
Reply all
Reply to author
Forward
0 new messages