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

Cloud API: Nexus Incoming/Outgoing Service Definitions #16

Closed
wants to merge 23 commits into from

Conversation

mastermanu
Copy link
Member

No description provided.

@mastermanu mastermanu changed the title [DRAFT] Nexus Incoming Service [DRAFT] Nexus Incoming/Outgoing Service definitions Mar 12, 2024
Copy link
Member

@anekkanti anekkanti left a comment

Choose a reason for hiding this comment

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

Can we make sure to make all the comments full sentences. Meaning starts with a capitalized word and ends with a period.

// Filter incoming services by the namespace they route to - optional.
string namespace = 3;

// Filter incoming services by the task queue they route to - optional.
Copy link
Member

Choose a reason for hiding this comment

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

nit: Do we really need to support filtering with task_queue? Can't think of a usecase.

Copy link
Member Author

Choose a reason for hiding this comment

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

My thought was that we might multiple services across different environments (test, stage, dev, prod) where the task queue is the same, but the namespace varies. @bergundy @prasek if this makes sense or not

Copy link
Member Author

Choose a reason for hiding this comment

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

spoke offline, we think this is useful to have this filter here

temporal/api/cloud/nexus/v1/message.proto Outdated Show resolved Hide resolved
temporal/api/cloud/nexus/v1/message.proto Show resolved Hide resolved
temporal/api/cloud/nexus/v1/message.proto Outdated Show resolved Hide resolved

// The set of authorization policies for the service. Each request's caller
// must match with at least one of the specs to be accepted by the incoming service
repeated IncomingServiceAuthorizationSpec authorization_spec = 4;
Copy link
Member

Choose a reason for hiding this comment

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

Does the ordering of these specs mean anything? If yes, we need to make sure we can retrieve the same ordering that the user provides.

Copy link
Member Author

Choose a reason for hiding this comment

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

i think the ordering doesn't matter here (minus any form of short-circuit optimization), but cc @prasek @bergundy if you have thoughts

temporal/api/cloud/nexus/v1/message.proto Outdated Show resolved Hide resolved
temporal/api/cloud/nexus/v1/message.proto Outdated Show resolved Hide resolved
CloudIncomingServiceSpec cloud_incoming_service_spec = 2;
}

message CloudIncomingServiceSpec {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
message CloudIncomingServiceSpec {
message TargetCloudIncomingServiceSpec {

Otherwise its very confusing with the IncomingServiceSpec that we already have.

temporal/api/cloud/nexus/v1/message.proto Outdated Show resolved Hide resolved
temporal/api/cloud/nexus/v1/message.proto Show resolved Hide resolved

// The current state of the service.
// Possible values: activating, activationfailed, active, updating, updatefailed, deleting, deletefailed, deleted
// For any failed state, reach out to Temporal Cloud support for remediation.
Copy link
Member Author

Choose a reason for hiding this comment

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

mention eventual consistency here?

@mastermanu mastermanu requested review from MichaelSnowden, sergeybykov and cretz and removed request for sergeybykov March 13, 2024 16:29
@@ -229,3 +230,187 @@ message GetRegionResponse {
// The temporal cloud region.
temporal.api.cloud.region.v1.Region region = 1;
}

message GetIncomingServicesRequest {
Copy link
Member

Choose a reason for hiding this comment

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

Wonder why not call this "list" instead of "get", I find this confusing but I figure it's consistent with other cloud APIs.

Copy link
Member

Choose a reason for hiding this comment

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

Please mention if these are AND or OR filters in the comment for this message.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah the list vs get is for consistency with existing cloud apis. could have been list.

these are AND filters. will update comments


message GetIncomingServiceRequest {
// The id of the incoming service to get
string incoming_service_id = 1;
Copy link
Member

Choose a reason for hiding this comment

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

nit: can we just call this id? it's already in the context of an GetIncomingServiceRequest.

Copy link
Member Author

@mastermanu mastermanu Mar 13, 2024

Choose a reason for hiding this comment

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

we can. I was trying to be consistent with this one: https://github.com/temporalio/api-cloud/blob/main/temporal/api/cloud/cloudservice/v1/request_response.proto#L33 but I definitely wish that used id

will leave as-is for now unless there is strong feeling about it

string next_page_token = 2;
}

message GetIncomingServiceRequest {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
message GetIncomingServiceRequest {
message GetIncomingServiceByIdRequest {

Just in case we want to add a "by name" request?
The list approach is also fine, just a bit harder to use IMHO.

Copy link
Member

Choose a reason for hiding this comment

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

Can it simply be 'GetIncomingServiceRequest' and if/when we add by name, we'd add 'GetIncomingServiceByNameRequest'? Or is this against a convention for the 'ById' suffix we already use? I see that in

we named a similar message 'GetUserRequest' even though it takes a user ID.

Copy link
Member Author

Choose a reason for hiding this comment

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

agreeing with sergey here. am inclined towards leaving this as is for now (e.g. GetIncomingServiceRequest) just to be consistent with existing cloud user apis

the weirdness is that when we translate this to HTTP path, we would end up creating a different path at that time probably, but not the end of the world if we have to introduce that

temporal/api/cloud/cloudservice/v1/request_response.proto Outdated Show resolved Hide resolved
Comment on lines +334 to +335
// The name of the outgoing service to filter on - optional. Specifying this will result in zero or one results.
string name = 4;
Copy link
Member

Choose a reason for hiding this comment

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

Not really useful as a filter, this is basically a Get request.

Copy link
Member Author

Choose a reason for hiding this comment

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

right, this is what we did for our Users api (users have a static id, but you call GetUsersRequset and can supply an email address), so this is just an attempt to stay consistent.

Copy link
Member Author

Choose a reason for hiding this comment

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

@anekkanti - thoughts? we basically followed the users model, which relies on this

// Gets all known incoming services
rpc GetIncomingServices(GetIncomingServicesRequest) returns (GetIncomingServicesResponse) {
option (google.api.http) = {
get: "/api/v1/nexus/incomingservices",
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a /by-id or /id suffix to this URL just in case we want to allow looking up by name eventually?

Copy link
Member Author

Choose a reason for hiding this comment

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

since I am following what we do for users, I've kept the same format (which doesn't have by-id or id either..). @anekkanti , thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

I think for the default behavior (by ID) we don't need to add a suffix.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, am inclined to leave as-is as well. can always add suffix later if needed

message IncomingServiceAuthorizationSpec {
// The policy set on this incoming service authorization spec.
// Possible values are: allowed_cloud_namespace
string policy_type = 1;
Copy link
Member

Choose a reason for hiding this comment

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

Why not make this an enum, I'm curious?

Copy link
Member Author

Choose a reason for hiding this comment

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

@anekkanti can comment here. We appear to have stayed away from enums elsewhere (and are using strings instead), so this is just being consistent with the existing cloud APIs

Comment on lines +69 to +72
// The name of the outgoing service. Must be unique within the namespace.
// The name must match `[a-zA-Z_][a-zA-Z0-9_]*`.
// This name is immutable.
string name = 1;
Copy link
Member

Choose a reason for hiding this comment

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

This is the identifier, doesn't belong in the spec AFAICT.

Copy link
Member Author

Choose a reason for hiding this comment

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

that seems to be what we have done for namespace and for outgoing service. it is a property a user can set (albeit only on create), so we happened to put it on spec. can try and move it off, but it does create some inconsistency with the other cloud apis

Comment on lines 98 to 99
// The namespace this outgoing service is attached to.
string namespace = 2;
Copy link
Member

Choose a reason for hiding this comment

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

Should this be = 1? It's essentially the first part of the identifier.

Copy link
Member Author

Choose a reason for hiding this comment

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

good point. reordered

Copy link
Member

@sergeybykov sergeybykov left a comment

Choose a reason for hiding this comment

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

Added a couple of minor comments. Otherwise, LGTM.

string next_page_token = 2;
}

message GetIncomingServiceRequest {
Copy link
Member

Choose a reason for hiding this comment

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

Can it simply be 'GetIncomingServiceRequest' and if/when we add by name, we'd add 'GetIncomingServiceByNameRequest'? Or is this against a convention for the 'ById' suffix we already use? I see that in

we named a similar message 'GetUserRequest' even though it takes a user ID.

// Gets all known incoming services
rpc GetIncomingServices(GetIncomingServicesRequest) returns (GetIncomingServicesResponse) {
option (google.api.http) = {
get: "/api/v1/nexus/incomingservices",
Copy link
Member

Choose a reason for hiding this comment

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

I think for the default behavior (by ID) we don't need to add a suffix.

@mastermanu mastermanu changed the title [DRAFT] Nexus Incoming/Outgoing Service definitions Cloud API: Nexus Incoming/Outgoing Service Definitions Mar 13, 2024
google.protobuf.Timestamp created_time = 6;

// The date and time when the service was last modified.
// Will not be set if the service has never been modified.
Copy link
Member

Choose a reason for hiding this comment

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

Curious why not default this to created_time? Is this for consistency with other APIs?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, this is just for consistency. could have definitely been defaulted to created_time here

Comment on lines +21 to +23
// The set of authorization policies for the service. Each request's caller
// must match with at least one of the specs to be accepted by the incoming service.
repeated IncomingServiceAuthorizationSpec authorization_specs = 4;
Copy link
Member

Choose a reason for hiding this comment

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

I think maybe instead of auth spec, we might want to have a general message to also add limits (rate, concurrency, etc..) and other properties for every caller (only namespaces for now).

Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

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

I have no real comments/opinions on this one. From a high-level LGTM, but would defer to those with more familiarity with the behavior.

@mastermanu
Copy link
Member Author

abandoning as there is replacement PR

@mastermanu mastermanu closed this May 22, 2024
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.

5 participants