Merge pull request #7898 from hashicorp/bug/update-gateways-on-config-entry-delete

Remove error from GatewayServices RPC when a service is not a gateway
pull/7913/head
Chris Piraino 5 years ago committed by GitHub
commit 249af0a094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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) {

@ -188,7 +188,7 @@ func (m *Manager) ensureProxyServiceLocked(ns *structs.NodeService, token string
}
// Set the necessary dependencies
state.logger = m.Logger
state.logger = m.Logger.With("service_id", sid.String())
state.cache = m.Cache
state.source = m.Source
state.dnsConfig = m.DNSConfig

Loading…
Cancel
Save