config-entry: fix a panic when registering a service or ingress gateway

This commit is contained in:
Daniel Nephin 2022-02-04 18:51:32 -05:00
parent 5a0e6700c1
commit 6376141464
2 changed files with 4 additions and 0 deletions

3
.changelog/12277.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
config-entry: fix a panic when creating an ingress gateway config-entry and a proxy service instance, where both provided the same upstream and downstream mapping.
```

View File

@ -4016,6 +4016,7 @@ func insertGatewayServiceTopologyMapping(tx WriteTxn, idx uint64, gs *structs.Ga
mapping := upstreamDownstream{ mapping := upstreamDownstream{
Upstream: gs.Service, Upstream: gs.Service,
Downstream: gs.Gateway, Downstream: gs.Gateway,
Refs: make(map[string]struct{}),
RaftIndex: gs.RaftIndex, RaftIndex: gs.RaftIndex,
} }
if err := tx.Insert(tableMeshTopology, &mapping); err != nil { if err := tx.Insert(tableMeshTopology, &mapping); err != nil {