Skip to content

Move service data to commons#1394

Merged
ryanjbaxter merged 7 commits intospring-cloud:3.0.xfrom
wind57:move-serviceData-to-commons
Aug 2, 2023
Merged

Move service data to commons#1394
ryanjbaxter merged 7 commits intospring-cloud:3.0.xfrom
wind57:move-serviceData-to-commons

Conversation

@wind57
Copy link
Copy Markdown
Contributor

@wind57 wind57 commented Aug 1, 2023

No description provided.

@wind57 wind57 changed the base branch from main to 3.0.x August 2, 2023 05:09
Assertions.assertNull(defaultInstance.getCluster());
}

private String filterOnK8sNamespaceAndType(Map<String, String> result) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not removed, but moved to commons

Assertions.assertTrue(output.getOut().contains("found primary-port-name via 'http' to match port : 8082"));
}

/**
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the main idea of the tests remained the same and moved to commons

return Map.of();
}

static Map<String, String> portsData(List<EndpointSubset> endpointSubsets) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this same logic already existed, since I moved things to commons, this was "split" and was left in fabric8 package

* - service type
* </pre>
*/
static Map<String, String> serviceMetadata(String serviceId, Service service,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not removed, but moved to commons

/**
* @author wind57
*/
public final class DiscoveryClientUtils {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this PR takes a method from fabric8-discovery (serviceMetadata) and moves it to commons. It does not move it verbatim, but "removes" everything fabric8 specific. For example, we used to do :

service.getMetadata().getLabels()

and now in commons, we expect a Map<String, String> that comes from the same service.getMetadata().getLabels(). Same applies for annotations and ports.

Why do I want to do that? Because I want to align implementations of discovery for fabric8 and k8s and I would like them to delegate calls to the same code in commons, so that they behave exactly the same. I started working on k8s discovery and noticed that if I don't move code to commons in this manner, there will be a lot of duplication...

@wind57 wind57 marked this pull request as ready for review August 2, 2023 16:00
@wind57
Copy link
Copy Markdown
Contributor Author

wind57 commented Aug 2, 2023

@ryanjbaxter I've started work on aligning k8s and fabric8 discovery, there will be more PRs in this direction from me...

@ryanjbaxter ryanjbaxter added this to the 3.0.5 milestone Aug 2, 2023
@ryanjbaxter ryanjbaxter merged commit 61d8368 into spring-cloud:3.0.x Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants