chore: remove unused argument from MergeNodeServiceWithCentralConfig (#15024)
Previously, the MergeNodeServiceWithCentralConfig method accepted a ServiceSpecificRequest argument, of which only the Datacenter and QueryOptions fields were used. Digging a little deeper, it turns out these fields were only passed down to the ComputeResolvedServiceConfig method (through the ServiceConfigRequest struct) which didn't actually use them. As such, not all call-sites passed a valid ServiceSpecificRequest so it's safer to remove the argument altogether to prevent future changes from depending on it.
This commit is contained in:
parent
f8c099e43c
commit
acfdbb23a9
|
@ -23,7 +23,6 @@ type StateStore interface {
|
||||||
func MergeNodeServiceWithCentralConfig(
|
func MergeNodeServiceWithCentralConfig(
|
||||||
ws memdb.WatchSet,
|
ws memdb.WatchSet,
|
||||||
state StateStore,
|
state StateStore,
|
||||||
args *structs.ServiceSpecificRequest,
|
|
||||||
ns *structs.NodeService,
|
ns *structs.NodeService,
|
||||||
logger hclog.Logger) (uint64, *structs.NodeService, error) {
|
logger hclog.Logger) (uint64, *structs.NodeService, error) {
|
||||||
|
|
||||||
|
@ -47,8 +46,6 @@ func MergeNodeServiceWithCentralConfig(
|
||||||
|
|
||||||
configReq := &structs.ServiceConfigRequest{
|
configReq := &structs.ServiceConfigRequest{
|
||||||
Name: serviceName,
|
Name: serviceName,
|
||||||
Datacenter: args.Datacenter,
|
|
||||||
QueryOptions: args.QueryOptions,
|
|
||||||
MeshGateway: ns.Proxy.MeshGateway,
|
MeshGateway: ns.Proxy.MeshGateway,
|
||||||
Mode: ns.Proxy.Mode,
|
Mode: ns.Proxy.Mode,
|
||||||
UpstreamIDs: upstreams,
|
UpstreamIDs: upstreams,
|
||||||
|
|
|
@ -753,7 +753,7 @@ func (c *Catalog) ServiceNodes(args *structs.ServiceSpecificRequest, reply *stru
|
||||||
mergedsn := sn
|
mergedsn := sn
|
||||||
ns := sn.ToNodeService()
|
ns := sn.ToNodeService()
|
||||||
if ns.IsSidecarProxy() || ns.IsGateway() {
|
if ns.IsSidecarProxy() || ns.IsGateway() {
|
||||||
cfgIndex, mergedns, err := configentry.MergeNodeServiceWithCentralConfig(ws, state, args, ns, c.logger)
|
cfgIndex, mergedns, err := configentry.MergeNodeServiceWithCentralConfig(ws, state, ns, c.logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -957,11 +957,7 @@ func (c *Catalog) NodeServiceList(args *structs.NodeSpecificRequest, reply *stru
|
||||||
for _, ns := range services.Services {
|
for _, ns := range services.Services {
|
||||||
mergedns := ns
|
mergedns := ns
|
||||||
if ns.IsSidecarProxy() || ns.IsGateway() {
|
if ns.IsSidecarProxy() || ns.IsGateway() {
|
||||||
serviceSpecificReq := structs.ServiceSpecificRequest{
|
cfgIndex, mergedns, err = configentry.MergeNodeServiceWithCentralConfig(ws, state, ns, c.logger)
|
||||||
Datacenter: args.Datacenter,
|
|
||||||
QueryOptions: args.QueryOptions,
|
|
||||||
}
|
|
||||||
cfgIndex, mergedns, err = configentry.MergeNodeServiceWithCentralConfig(ws, state, &serviceSpecificReq, ns, c.logger)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,7 @@ func (h *Health) ServiceNodes(args *structs.ServiceSpecificRequest, reply *struc
|
||||||
for _, node := range resolvedNodes {
|
for _, node := range resolvedNodes {
|
||||||
ns := node.Service
|
ns := node.Service
|
||||||
if ns.IsSidecarProxy() || ns.IsGateway() {
|
if ns.IsSidecarProxy() || ns.IsGateway() {
|
||||||
cfgIndex, mergedns, err := configentry.MergeNodeServiceWithCentralConfig(ws, state, args, ns, h.logger)
|
cfgIndex, mergedns, err := configentry.MergeNodeServiceWithCentralConfig(ws, state, ns, h.logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,15 +74,9 @@ func (s *Server) GetEnvoyBootstrapParams(ctx context.Context, req *pbdataplane.G
|
||||||
NodeId: string(svc.ID),
|
NodeId: string(svc.ID),
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is awkward because it's designed for different requests, but
|
|
||||||
// this fakes the ServiceSpecificRequest so that we can reuse code.
|
|
||||||
_, ns, err := configentry.MergeNodeServiceWithCentralConfig(
|
_, ns, err := configentry.MergeNodeServiceWithCentralConfig(
|
||||||
nil,
|
nil,
|
||||||
store,
|
store,
|
||||||
&structs.ServiceSpecificRequest{
|
|
||||||
Datacenter: s.Datacenter,
|
|
||||||
QueryOptions: options,
|
|
||||||
},
|
|
||||||
svc.ToNodeService(),
|
svc.ToNodeService(),
|
||||||
logger,
|
logger,
|
||||||
)
|
)
|
||||||
|
|
|
@ -132,16 +132,7 @@ func (m *ConfigSource) startSync(closeCh <-chan chan struct{}, proxyID proxycfg.
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, ns, err = configentry.MergeNodeServiceWithCentralConfig(
|
_, ns, err = configentry.MergeNodeServiceWithCentralConfig(ws, store, ns, logger)
|
||||||
ws,
|
|
||||||
store,
|
|
||||||
// TODO(agentless): it doesn't seem like we actually *need* any of the
|
|
||||||
// values on this request struct - we should try to remove the parameter
|
|
||||||
// in case that changes in the future as this call-site isn't passing them.
|
|
||||||
&structs.ServiceSpecificRequest{},
|
|
||||||
ns,
|
|
||||||
logger,
|
|
||||||
)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("failed to merge with central config", "error", err.Error())
|
logger.Error("failed to merge with central config", "error", err.Error())
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue