baf886c6f3
The gist here is that now we use a value-type struct proxycfg.UpstreamID as the map key in ConfigSnapshot maps where we used to use "upstream id-ish" strings. These are internal only and used just for bidirectional trips through the agent cache keyspace (like the discovery chain target struct). For the few places where the upstream id needs to be projected into xDS, that's what (proxycfg.UpstreamID).EnvoyID() is for. This lets us ALWAYS inject the partition and namespace into these things without making stuff like the golden testdata diverge.
31 lines
576 B
Go
31 lines
576 B
Go
//go:build !consulent
|
|
// +build !consulent
|
|
|
|
package proxycfg
|
|
|
|
import (
|
|
"github.com/hashicorp/consul/agent/structs"
|
|
)
|
|
|
|
func UpstreamIDString(typ, dc, name string, _ *structs.EnterpriseMeta) string {
|
|
ret := name
|
|
|
|
if dc != "" {
|
|
ret += "?dc=" + dc
|
|
}
|
|
|
|
if typ == "" || typ == structs.UpstreamDestTypeService {
|
|
return ret
|
|
}
|
|
|
|
return typ + ":" + ret
|
|
}
|
|
|
|
func parseInnerUpstreamIDString(input string) (string, *structs.EnterpriseMeta) {
|
|
return input, structs.DefaultEnterpriseMetaInDefaultPartition()
|
|
}
|
|
|
|
func (u UpstreamID) enterpriseIdentifierPrefix() string {
|
|
return ""
|
|
}
|