Skip to content

Conversation

@shubhamdhama
Copy link
Contributor

@shubhamdhama shubhamdhama commented Oct 3, 2024

This works well for shared-process mode where inter-node network
connectivity for a secondary tenant is the same as for the system tenant.
However, in external-process mode, this endpoint won't provide a complete
picture of network connectivity since the SQL server may run entirely
outside the KV node. We may need to extend this endpoint or create a new
one for SQL-SQL servers and SQL server to KV nodes. This work is left for
the future, and currently, this endpoint only shows KV-KV nodes network
connectivity. As a result, this endpoint isn't ready for external-process
mode and should only be enabled for shared-mode tenants. On the backend,
there is nothing enforcing this, which shouldn't be a problem.

Fixes: #110024

Epic: #CRDB-38968

Release note: None

@shubhamdhama shubhamdhama requested a review from a team as a code owner October 3, 2024 15:41
@shubhamdhama shubhamdhama requested review from a team October 3, 2024 15:41
@shubhamdhama shubhamdhama requested review from a team as code owners October 3, 2024 15:41
@shubhamdhama shubhamdhama requested review from kyle-a-wong and rharding6373 and removed request for a team October 3, 2024 15:41
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@shubhamdhama shubhamdhama requested review from cthumuluru-crdb and stevendanna and removed request for a team and rharding6373 October 3, 2024 15:41
@shubhamdhama shubhamdhama force-pushed the enable-connectivity-for-mt branch 3 times, most recently from 88bcb42 to 3c2ddbd Compare October 4, 2024 14:37
@shubhamdhama shubhamdhama changed the title server: enable _status/NetworkConnectivity for secondary tenants (shared-process). server: enable _status/NetworkConnectivity for secondary tenants (shared-process) Oct 7, 2024
@shubhamdhama shubhamdhama force-pushed the enable-connectivity-for-mt branch from 3c2ddbd to fa873fc Compare January 2, 2025 12:04
Copy link
Collaborator

@stevendanna stevendanna left a comment

Choose a reason for hiding this comment

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

This seems reasonable to me.

Would it be difficult to add a test that shows that if you don't have the permission then this endpoint returns an error?

Copy link
Collaborator

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

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

Reviewed 18 of 18 files at r3, 2 of 17 files at r4.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @cthumuluru-crdb, @kyle-a-wong, @shubhamdhama, and @stevendanna)


-- commits line 5 at r4:
nit: The endpoint is _status/connectivity if you're going to quote the route.


-- commits line 16 at r4:
nit: This is helpful background but can you just add a note above it describing that this change is just enabling tenant access to the feature via the can_debug_process capability? It's not super clear what's being done.


pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/authorizer.go line 393 at r3 (raw file):

}

func (a *Authorizer) HasTSDBAllMetricsCapability(

Any reason why this check cannot also be refactored?

@shubhamdhama shubhamdhama force-pushed the enable-connectivity-for-mt branch from fa873fc to 8e10ac1 Compare January 15, 2025 11:46
Copy link
Contributor Author

@shubhamdhama shubhamdhama left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @cthumuluru-crdb, @dhartunian, @kyle-a-wong, and @stevendanna)


-- commits line 16 at r4:

Previously, dhartunian (David Hartunian) wrote…

nit: This is helpful background but can you just add a note above it describing that this change is just enabling tenant access to the feature via the can_debug_process capability? It's not super clear what's being done.

Done


pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/authorizer.go line 393 at r3 (raw file):

Previously, dhartunian (David Hartunian) wrote…

Any reason why this check cannot also be refactored?

Not really, the authorizerModeV222 case had the errCaonnotQueryTSDB error, which is different from the err...AllMetrics at the end. But I think that was just a typo, so I refactored this one too.

break
case authorizerModeAllowAll:
return nil
case authorizerModeV222:
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 wonder if we should do a cleanup and remove this setting option in a separate PR

…rocess).

This works well for shared-process mode where inter-node network
connectivity for a secondary tenant is the same as for the system tenant.
However, in external-process mode, this endpoint won't provide a complete
picture of network connectivity since the SQL server may run entirely
outside the KV node. We may need to extend this endpoint or create a new
one for SQL-SQL servers and SQL server to KV nodes. This work is left for
the future, and currently, this endpoint only shows KV-KV nodes network
connectivity. As a result, this endpoint isn't ready for external-process
mode and should only be enabled for secondary tenants. On the backend,
there is nothing enforcing this, which shouldn't be a problem.

Fixes: cockroachdb#110024

Epic: #CRDB-38968

Release note: None
@shubhamdhama shubhamdhama force-pushed the enable-connectivity-for-mt branch from 8e10ac1 to 9e3c54d Compare January 15, 2025 13:35
Copy link
Contributor

@cthumuluru-crdb cthumuluru-crdb left a comment

Choose a reason for hiding this comment

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

should only be enabled for secondary tenants.

should only be enabled for shared secondary tenants. ?

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @dhartunian, @kyle-a-wong, @shubhamdhama, and @stevendanna)

@shubhamdhama shubhamdhama changed the title server: enable _status/NetworkConnectivity for secondary tenants (shared-process) server: enable _status/connectivity for secondary tenants (shared-process) Jan 15, 2025
@shubhamdhama
Copy link
Contributor Author

Already fixed in the code comment. Now fixed in the description too.

@shubhamdhama
Copy link
Contributor Author

Thanks all for the review!

bors r=stevendanna,dhartunian,cthumuluru-crdb

@craig craig bot merged commit 57117d7 into cockroachdb:master Jan 15, 2025
22 checks passed
@shubhamdhama shubhamdhama deleted the enable-connectivity-for-mt branch March 1, 2025 10:45
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.

server: the "connectivity" status API endpoint should work with secondary tenants with sufficient capability

5 participants