Skip to content

Commit

Permalink
feat(destination): add resource metadata to responses
Browse files Browse the repository at this point in the history
The destination service does no include resource coordinates, so the proxy must
"guess" them by parsing hostnames, which is not particularly reliable or
efficient.

This change updates the destination API so that profile responses may include
resource reference to (1) parent Services, (2) ServiceProfile resources and (3)
backend Services. Furthermore, the WeightedAddr type is updated to include a
resource reference so that Pod coordinates may be referenced.

This metadata is not required to be set (for backwards compatibility).
  • Loading branch information
olix0r committed Nov 5, 2024
1 parent c5648ae commit 07e8269
Show file tree
Hide file tree
Showing 18 changed files with 343 additions and 251 deletions.
534 changes: 298 additions & 236 deletions go/destination/destination.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion go/destination/destination_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/grpc_route/grpc_route.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/http_route/http_route.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/http_types/http_types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/identity/identity.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/identity/identity_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/inbound/inbound.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/inbound/inbound_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/meta/meta.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/net/net.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/outbound/outbound.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/outbound/outbound_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/tap/tap.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/tap/tap_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/tls_route/tls_route.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions proto/destination.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ option go_package = "github.com/linkerd/linkerd2-proxy-api/go/destination";
import "google/protobuf/duration.proto";

import "http_types.proto";
import "meta.proto";
import "net.proto";

/// Destination Service ///
Expand Down Expand Up @@ -107,6 +108,10 @@ message WeightedAddr {
// is HTTP/2 or when the H2 ProtocolHint is used to transport HTTP/1
// connections over HTTP/2.
Http2ClientParams http2 = 8;

// A reference to the metadata for this endpoint, usually a Pod. This may be
// omitted when the resource type is unknown.
meta.Metadata resource_ref = 9;
}

message TlsIdentity {
Expand Down Expand Up @@ -255,6 +260,14 @@ message DestinationProfile {
//
// No endpoint should be set If the target is unknown.
WeightedAddr endpoint = 6;

// A reference to the metadata for this destination, usually a service. May be
// omitted if the destination is not a service.
meta.Metadata parent_ref = 7;

// A reference to the metadata for a ServiceProfile resource. This is omitted
// when no ServiceProfile resource exists.
meta.Metadata profile_ref = 8;
}

message Route {
Expand Down Expand Up @@ -348,4 +361,6 @@ message WeightedDst {
// The proportion of requests to send to this destination. This value is
// relative to other weights in the same dst_overrides list.
uint32 weight = 2;
// A reference to the metadata for a Service resource.
meta.Metadata backend_ref = 3;
}
15 changes: 15 additions & 0 deletions src/gen/io.linkerd.proxy.destination.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 07e8269

Please sign in to comment.