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

feat(inspect): api for retrieving service hostnames #11865

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jakubdyszkiewicz
Copy link
Contributor

@jakubdyszkiewicz jakubdyszkiewicz commented Oct 25, 2024

Motivation

We want to see hostnames of Mesh*Service in the Global CP.

Implementation information

While we could add new KDSService to retrieve stats of a resource in specific zones and then aggregate this an easier (less expensive to execute, faster, don't depend on the zone) option is to calculate the hostname. We have all the resources in global CP already (because HostnameGenerator from zone is synced to global for visibility). It's just a matter of relabeling properly.

Supporting documentation

Fix #10618

@jakubdyszkiewicz jakubdyszkiewicz added the ci/skip-test PR: Don't run unit and e2e tests (maybe this is just a doc change) label Oct 25, 2024
@jakubdyszkiewicz jakubdyszkiewicz force-pushed the inspect-hostnames branch 2 times, most recently from fc4908d to b1294d2 Compare October 28, 2024 10:56
@jakubdyszkiewicz jakubdyszkiewicz marked this pull request as ready for review October 28, 2024 11:07
@jakubdyszkiewicz jakubdyszkiewicz requested a review from a team as a code owner October 28, 2024 11:07
@jakubdyszkiewicz jakubdyszkiewicz requested review from michaelbeaumont and slonka and removed request for a team October 28, 2024 11:07
@@ -172,6 +172,41 @@ paths:
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/InternalServerError'
/meshes/{mesh}/{serviceType}/{serviceName}/_resources/hostnames:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure about this path. What _resources stand for?

@lahabana any input here?

Copy link
Contributor

Choose a reason for hiding this comment

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

_resources are meant to map to other resources. For example you get /_resources/dataplanes or /_resources/policies here this doesn't look right.

IMO what you want here is: /meshes/{mesh}/{serviceType}/{serviceName}/_hostnames

@jakubdyszkiewicz jakubdyszkiewicz removed the ci/skip-test PR: Don't run unit and e2e tests (maybe this is just a doc change) label Oct 28, 2024
@@ -172,6 +172,41 @@ paths:
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/InternalServerError'
/meshes/{mesh}/{serviceType}/{serviceName}/_resources/hostnames:
Copy link
Contributor

Choose a reason for hiding this comment

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

_resources are meant to map to other resources. For example you get /_resources/dataplanes or /_resources/policies here this doesn't look right.

IMO what you want here is: /meshes/{mesh}/{serviceType}/{serviceName}/_hostnames

description: The mesh the service is part of
- in: path
name: serviceType
example: meshservices
Copy link
Contributor

Choose a reason for hiding this comment

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

You should be able to add validation with just the list of supported values.

InspectHostname:
type: object
title: InspectHostname
description: A list of zones in which the hostname is available in
Copy link
Contributor

Choose a reason for hiding this comment

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

This description seems to be the one of the zones field not of this entire object.
I think this is more

Suggested change
description: A list of zones in which the hostname is available in
description: An supported hostname along with the zones it exists in

InspectHostnameZone:
type: object
title: InspectHostnameZone
description: A name of the zone with hostname generator that was used to generate the hostname
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this sentence.

request.Request.Context(),
response,
&validators.ValidationError{},
fmt.Sprintf("only %s are available for inspection", strings.Join(util_maps.SortedKeys(typeDescForType), ",")),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fmt.Sprintf("only %s are available for inspection", strings.Join(util_maps.SortedKeys(typeDescForType), ",")),
fmt.Sprintf("only %q are available for inspection", strings.Join(util_maps.SortedKeys(typeDescForType), ",")),

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.

Ability to see VIPs/Hostname on global CP
2 participants