From 96606d114c9818f106f6fad29934ecade0fec1c4 Mon Sep 17 00:00:00 2001 From: Semir Patel Date: Mon, 23 Oct 2023 16:30:47 -0500 Subject: [PATCH] resource: default peername to local in list endpoints (#19340) --- agent/grpc-external/services/resource/server.go | 5 +++++ agent/grpc-external/services/resource/server_test.go | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/agent/grpc-external/services/resource/server.go b/agent/grpc-external/services/resource/server.go index 401631f736..0b6419fe6f 100644 --- a/agent/grpc-external/services/resource/server.go +++ b/agent/grpc-external/services/resource/server.go @@ -205,6 +205,11 @@ func validateWildcardTenancy(tenancy *pbresource.Tenancy, namePrefix string) err return status.Errorf(codes.InvalidArgument, "name_prefix invalid: must be lowercase alphanumeric, got: %v", namePrefix) } + // TODO(spatel): NET-5475 - Remove as part of peer_name moving to PeerTenancy + if tenancy.PeerName == "" { + tenancy.PeerName = resource.DefaultPeerName + } + return nil } diff --git a/agent/grpc-external/services/resource/server_test.go b/agent/grpc-external/services/resource/server_test.go index 969173b429..e0b5226390 100644 --- a/agent/grpc-external/services/resource/server_test.go +++ b/agent/grpc-external/services/resource/server_test.go @@ -157,6 +157,15 @@ func wildcardTenancyCases() map[string]struct { PeerName: "local", }, }, + // TODO(spatel): NET-5475 - Remove as part of peer_name moving to PeerTenancy + "namespaced type with empty peername": { + typ: demo.TypeV2Artist, + tenancy: &pbresource.Tenancy{ + Partition: resource.DefaultPartitionName, + Namespace: resource.DefaultNamespaceName, + PeerName: "", + }, + }, "namespaced type with empty partition and namespace": { typ: demo.TypeV2Artist, tenancy: &pbresource.Tenancy{