Do not return an error if requested service is not a gateway
This commit converts the previous error into just a Warn-level log message. By returning an error when the requested service was not a gateway, we did not appropriately update envoy because the cache Fetch returned an error and thus did not propagate the update through proxycfg and xds packages.
This commit is contained in:
parent
52b09d3b79
commit
ce099c9aca
|
@ -414,8 +414,15 @@ func (m *Internal) GatewayServices(args *structs.ServiceSpecificRequest, reply *
|
|||
}
|
||||
}
|
||||
|
||||
// We log a warning here to indicate that there is a potential
|
||||
// misconfiguration. We explicitly do NOT return an error because this
|
||||
// can occur in the course of normal operation by deleting a
|
||||
// configuration entry or starting the proxy before registering the
|
||||
// config entry.
|
||||
if !found {
|
||||
return fmt.Errorf("service %q is not a configured terminating-gateway or ingress-gateway", args.ServiceName)
|
||||
m.logger.Warn("no terminating-gateway or ingress-gateway associated with this gateway",
|
||||
"gateway", args.ServiceName,
|
||||
)
|
||||
}
|
||||
|
||||
index, services, err = state.GatewayServices(ws, args.ServiceName, &args.EnterpriseMeta)
|
||||
|
|
|
@ -954,8 +954,11 @@ func TestInternal_GatewayServices_BothGateways(t *testing.T) {
|
|||
}
|
||||
var resp structs.IndexedGatewayServices
|
||||
err := msgpackrpc.CallWithCodec(codec, "Internal.GatewayServices", &req, &resp)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), `service "api" is not a configured terminating-gateway or ingress-gateway`)
|
||||
assert.NoError(t, err)
|
||||
assert.Empty(t, resp.Services)
|
||||
// Ensure that the index is not zero so that a blocking query still gets the
|
||||
// latest GatewayServices index
|
||||
assert.NotEqual(t, 0, resp.Index)
|
||||
}
|
||||
|
||||
func TestInternal_GatewayServices_ACLFiltering(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue