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 first V3 cluster APIs (+ V3 plumbing). #624

Merged
merged 3 commits into from Feb 28, 2020
Merged

Add first V3 cluster APIs (+ V3 plumbing). #624

merged 3 commits into from Feb 28, 2020

Conversation

rigelbm
Copy link
Contributor

@rigelbm rigelbm commented Feb 21, 2020

The APIs added are:

  • GET /clusters -> returns the list of clusters known
  • GET /clusters/{clusterId} -> returns the cluster with the given clusterId

The APIs added are:

* GET /clusters -> returns the list of clusters known
* GET /clusters/{clusterId} -> returns the cluster with the given clusterId

@Override
protected void configure() {
install(new KafkaModule(context));
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this registered via BackendsModule? what's the advantage of the extra level?

(note: i may well ask some stupid questions due to ignorance of the frameworks etc., this may well be one of them).

@@ -65,6 +65,13 @@
+ " hostname is used";
public static final String HOST_NAME_DEFAULT = "";

public static final String ADVERTISED_LISTENERS_CONFIG = "advertised.listeners";
Copy link
Contributor

Choose a reason for hiding this comment

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

I have not spent any time thinking about the advantages of including absolute URLs in responses, but for your consideration, want to note that requiring this additional config seems like a material downside.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The configuration is not required. See UrlFactoryImpl for how the absolute URLs are generated. This configuration is to allow for generating URLs using a LB.

Copy link
Contributor

@mhowlett mhowlett left a comment

Choose a reason for hiding this comment

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

This looks great to me overall. I checked approve, but wait for input from others before merging.

I'm thinking it might be worth getting strong java developer to look over this at this stage of the project (given you're just getting going), but from my point of view, it's all looking good (or great).

@mageshn - care to take a quick look at the direction REST Proxy is taking?


@Test
public void listClusters_returnListWithOwnCluster() throws Exception {
expect(adminClient.describeCluster(anyObject())).andReturn(describeClusterResult);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we specify in the test name - returnListWithOwnCluster ? Don't we simply list all the clusters ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, there's catch currently which is that Kafka (and the REST Proxy) does not know about other clusters. It only knows about the Cluster pointed by the bootstrap.servers property. I created the API this way so that in the future, when/if we do have information about other clusters, we can return them in the list as well. But right now, listing clusters always returns only one cluster.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, thank you.

@agg111
Copy link
Contributor

agg111 commented Feb 27, 2020

Trying to follow the PR, since it has quite a few changes, I thought of following through tests to begin with, also I am pretty new to REST, might come up with simple questions. I notice the existing repo has folders as v1, v2, under resources and entities. I read in an older PR (#622), we would want to separate these but would have shared controllers. I see this PR creates separate /controller folder with this PR, and we still have some classes like Broker, Cluster under /entity (not /entity/v3). Can you explain why we do this ?

@rigelbm
Copy link
Contributor Author

rigelbm commented Feb 27, 2020

The entities that are in entities/ but not in v?/ are used the controllers as input-output. The entities in entities/v?/ are used by the resources as request/response types. You see the difference by noting that they are annotated with json-mapping annotations.


@GET
@Produces(Versions.JSON_API)
public void listBrokers(@PathParam("clusterId") String clusterId) {
Copy link
Contributor

@agg111 agg111 Feb 27, 2020

Choose a reason for hiding this comment

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

I see in v2 we were using @PerformanceMetric, why don't we use it now ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can add performance metrics to all endpoints later.

@rigelbm rigelbm merged commit 18b5daa into confluentinc:5.5.x Feb 28, 2020
@rigelbm rigelbm deleted the cluster-v3 branch March 13, 2020 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants