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
[CLOUD-3200] - querying k8s api to discover generated routes #87
Conversation
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 made a couple comments regarding the "secure-" prefix, and open to opinions on it.
LGTM, thanks @ricardozanini One final note, there aren't any tests, if you could write some bats tests just to verify the output of the functions, that would be really great. |
Guys, I reviewed the entire scenario, reduced the scope and made a real clean up. Now we don't rely from kie-modules anymore (just a small error handling). The only "problem" now is the python dependency. Tomorrow I'll write bats tests and do the integration tests. @luck3y please hold this one until I finish these tests. @errantepiphany @luck3y please let me know your thoughts. ❤️ |
Here's a sample output: sh-4.2$ query_routes_from_service dasdas
sh-4.2$ query_routes_from_service eap-app
https://eap-app-bsig-cloud.192.168.99.100.nip.io
sh-4.2$ query_routes_from_service library-process-kieserver
http://library-process-kieserver-bsig-cloud.192.168.99.100.nip.io;https://secure-library-process-kieserver-bsig-cloud.192.168.99.100.nip.io |
Signed-off-by: Ricardo Zanini <zanini@redhat.com>
Everything is fine now and this PR is ready to be merged after #86 |
@ricardozanini , looks good to me, but will defer to @luck3y , as he is the gatekeeper of jboss-eap-modules. |
Ignore the CI error, this was from a hung previous job. |
…-3200 [CLOUD-3200] - querying k8s api to discover generated routes
…-3200 [CLOUD-3200] - querying k8s api to discover generated routes
@luck3y this is the PR to fix https://issues.jboss.org/browse/CLOUD-3200.
Tested with Business Central (RHPAM) images and I was able to create a keycloak client configuration with URLs from the application routes where the pod is running.
The logic between this "discover" is to use the pod hostname. If a route is found with this name, we set the
APPLICATION_ROUTES
to it, then the script does the rest of the job and registers the keycloak client with the correct URLs.Most of the time, templates create routes, services, pods, secrets with the same base name. So, if the template does not set the
HOSTNAME_HTTP
env variable, we try to found a URL based on this base name.For this to work, I borrowed these functions from our code base (jboss-kie-modules):
query_route
query_route_host
build_simple_url
build_route_url
I tried to keep them agnostic to the use case, so we could easily export those to a common module in this repo. This would require the BA cloud team to add this new dependency to our images. That's why I'd like to discuss this matter with @errantepiphany and @spolti
So, before merging this one, I believe that we have to decide which path to go and/or if this feature make sense for you.
Signed-off-by: Ricardo Zanini zanini@redhat.com