mirror of https://github.com/status-im/consul.git
sidecar-proxy refactor (#17328)
This commit is contained in:
parent
2edfda998a
commit
8bb16567cd
|
@ -33,6 +33,7 @@ func (e *SimplifiedExportedServices) ToPartitionMap() map[string]map[string][]st
|
|||
}
|
||||
}
|
||||
resp[svc.Namespace][svc.Name] = consumers
|
||||
resp[svc.Namespace][svc.Name+structs.SidecarProxySuffix] = consumers
|
||||
}
|
||||
}
|
||||
return resp
|
||||
|
|
|
@ -747,7 +747,7 @@ func (m *subscriptionManager) NotifyStandardService(
|
|||
//
|
||||
// This name was chosen to match existing "sidecar service" generation logic
|
||||
// and similar logic in the Service Identity synthetic ACL policies.
|
||||
const syntheticProxyNameSuffix = "-sidecar-proxy"
|
||||
const syntheticProxyNameSuffix = structs.SidecarProxySuffix
|
||||
|
||||
func generateProxyNameForDiscoveryChain(sn structs.ServiceName) structs.ServiceName {
|
||||
return structs.NewServiceName(sn.Name+syntheticProxyNameSuffix, &sn.EnterpriseMeta)
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/hashicorp/consul/agent/structs"
|
||||
)
|
||||
|
||||
const sidecarIDSuffix = "-sidecar-proxy"
|
||||
const sidecarIDSuffix = structs.SidecarProxySuffix
|
||||
|
||||
func sidecarIDFromServiceID(serviceID string) string {
|
||||
return serviceID + sidecarIDSuffix
|
||||
|
@ -96,7 +96,7 @@ func sidecarServiceFromNodeService(ns *structs.NodeService, token string) (*stru
|
|||
sidecar.Kind = structs.ServiceKindConnectProxy
|
||||
}
|
||||
if sidecar.Service == "" {
|
||||
sidecar.Service = ns.Service + "-sidecar-proxy"
|
||||
sidecar.Service = ns.Service + structs.SidecarProxySuffix
|
||||
}
|
||||
if sidecar.Address == "" {
|
||||
// Inherit address from the service if it's provided
|
||||
|
|
|
@ -1270,6 +1270,8 @@ func (a ServiceAddress) ToAPIServiceAddress() api.ServiceAddress {
|
|||
return api.ServiceAddress{Address: a.Address, Port: a.Port}
|
||||
}
|
||||
|
||||
const SidecarProxySuffix = "-sidecar-proxy"
|
||||
|
||||
// NodeService is a service provided by a node
|
||||
type NodeService struct {
|
||||
// Kind is the kind of service this is. Different kinds of services may
|
||||
|
|
Loading…
Reference in New Issue