structs: remove another helper

We already have a helper funtion.
This commit is contained in:
Daniel Nephin 2021-09-17 19:24:51 -04:00
parent 17652227f6
commit 93b3e110b6
3 changed files with 8 additions and 12 deletions

View File

@ -3451,8 +3451,8 @@ func updateMeshTopology(tx WriteTxn, idx uint64, node string, svc *structs.NodeS
oldUpstreams := make(map[structs.ServiceName]bool)
if e, ok := existing.(*structs.ServiceNode); ok {
for _, u := range e.ServiceProxy.Upstreams {
upstreamMeta := e.NewEnterpriseMetaInPartition(u.DestinationNamespace)
sn := structs.NewServiceName(u.DestinationName, upstreamMeta)
upstreamMeta := structs.NewEnterpriseMetaWithPartition(e.PartitionOrDefault(), u.DestinationNamespace)
sn := structs.NewServiceName(u.DestinationName, &upstreamMeta)
oldUpstreams[sn] = true
}
@ -3467,8 +3467,8 @@ func updateMeshTopology(tx WriteTxn, idx uint64, node string, svc *structs.NodeS
}
// TODO (freddy): Account for upstream datacenter
upstreamMeta := svc.NewEnterpriseMetaInPartition(u.DestinationNamespace)
upstream := structs.NewServiceName(u.DestinationName, upstreamMeta)
upstreamMeta := structs.NewEnterpriseMetaWithPartition(svc.PartitionOrDefault(), u.DestinationNamespace)
upstream := structs.NewServiceName(u.DestinationName, &upstreamMeta)
obj, err := tx.First(tableMeshTopology, indexID, upstream, downstream)
if err != nil {

View File

@ -402,8 +402,8 @@ func (s *Store) discoveryChainTargetsTxn(tx ReadTxn, ws memdb.WatchSet, dc, serv
var resp []structs.ServiceName
for _, t := range chain.Targets {
em := entMeta.NewEnterpriseMetaInPartition(t.Namespace)
target := structs.NewServiceName(t.Service, em)
em := structs.NewEnterpriseMetaWithPartition(entMeta.PartitionOrDefault(), t.Namespace)
target := structs.NewServiceName(t.Service, &em)
// TODO (freddy): Allow upstream DC and encode in response
if t.Datacenter == dc {
@ -459,8 +459,8 @@ func (s *Store) discoveryChainSourcesTxn(tx ReadTxn, ws memdb.WatchSet, dc strin
}
for _, t := range chain.Targets {
em := sn.NewEnterpriseMetaInPartition(t.Namespace)
candidate := structs.NewServiceName(t.Service, em)
em := structs.NewEnterpriseMetaWithPartition(sn.PartitionOrDefault(), t.Namespace)
candidate := structs.NewServiceName(t.Service, &em)
if !candidate.Matches(destination) {
continue

View File

@ -46,10 +46,6 @@ func (m *EnterpriseMeta) WildcardEnterpriseMetaForPartition() *EnterpriseMeta {
return &emptyEnterpriseMeta
}
func (m *EnterpriseMeta) NewEnterpriseMetaInPartition(_ string) *EnterpriseMeta {
return &emptyEnterpriseMeta
}
// TODO(partition): stop using this
func NewEnterpriseMetaInDefaultPartition(_ string) EnterpriseMeta {
return emptyEnterpriseMeta