Skip to content
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

Add SmallRye Stork service discovery #82

Merged
merged 1 commit into from
May 18, 2022
Merged

Conversation

edeandrea
Copy link
Collaborator

Adding SmallRye Stork service discovery for both the hero & villain services.

The VillainClient, is implemented by directly using the JAX-RS client API with the RESTEasy Reactive client. Therefore, the Stork API is used directly in order to get the same functionality available in the HeroRestClient.

Fixes #40

@edeandrea edeandrea added the fights-service Fights service label May 12, 2022
@edeandrea
Copy link
Collaborator Author

@aureamunoz / @michalszynkiewicz this supercedes #68. Something got messed up there when I tried to rebase main on top of the branch.

@edeandrea
Copy link
Collaborator Author

@aureamunoz you can see here I updated the pom.xml to include quarkus-smallrye-stork and quarkus-kubernetes-client. I also removed the bouncycastle dependencies.

Copy link
Member

@aureamunoz aureamunoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

return Uni.createFrom().completionStage(this::getRandomVillain)
.onFailure().retry().withBackOff(Duration.ofMillis(200)).atMost(3);
}
private static final String STORK_PREFIX = "stork://";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure at the moment, but I think using stork:// in the web target should also work (and would keep this code simpler).
Have you tried it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't try it. When I talked with @cescoffier before doing this I believe he mentioned it was only supported when using the rest client.

I will certainly try it though. If it works I can most likely revert all the changes in this class.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michalszynkiewicz is there info/debug logging in Stork that I can turn on to see whats going on under the covers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michalszynkiewicz looks like it does work using the stork:// URL in the WebTarget. I've changed the commits a bit. I essentially reverted the VillainClient class and then added in some debug logging.

One question I had though was that when I deploy to k8s I'm using the k8s service discovery. It seems I need to add

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: default_view
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: view
subjects:
  - kind: ServiceAccount
    name: default

to the namespace in order for the service discovery to work? Is that a true statement?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't done much work on the kube stuff, @aureamunoz knows best.

Re tracing/logging, that's an area we probably should improve in Stork...

@michalszynkiewicz
Copy link
Member

it seems there are some problems with formatting

@edeandrea
Copy link
Collaborator Author

it seems there are some problems with formatting

What kinds of problems?

@michalszynkiewicz
Copy link
Member

it seems there are some problems with formatting

What kinds of problems?

It seems it's just a one problem after all, I added a comment

@edeandrea edeandrea force-pushed the stork-2 branch 2 times, most recently from 3196a0a to 26388e5 Compare May 18, 2022 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fights-service Fights service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add SmallRye Stork service discovery
3 participants