2020-12-16 22:12:42 +00:00
|
|
|
package state
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2021-12-02 23:42:47 +00:00
|
|
|
"net"
|
2020-12-16 22:12:42 +00:00
|
|
|
"reflect"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/hashicorp/go-memdb"
|
|
|
|
|
2022-04-05 21:10:06 +00:00
|
|
|
"github.com/hashicorp/consul/acl"
|
2020-12-16 22:12:42 +00:00
|
|
|
"github.com/hashicorp/consul/agent/structs"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2021-12-02 23:42:47 +00:00
|
|
|
tableNodes = "nodes"
|
|
|
|
tableServices = "services"
|
|
|
|
tableChecks = "checks"
|
|
|
|
tableGatewayServices = "gateway-services"
|
|
|
|
tableMeshTopology = "mesh-topology"
|
|
|
|
tableServiceVirtualIPs = "service-virtual-ips"
|
|
|
|
tableFreeVirtualIPs = "free-virtual-ips"
|
2021-12-02 00:44:13 +00:00
|
|
|
tableKindServiceNames = "kind-service-names"
|
2020-12-16 22:12:42 +00:00
|
|
|
|
2021-02-11 00:40:32 +00:00
|
|
|
indexID = "id"
|
2021-03-16 17:54:05 +00:00
|
|
|
indexService = "service"
|
2021-02-11 00:40:32 +00:00
|
|
|
indexConnect = "connect"
|
|
|
|
indexKind = "kind"
|
2021-10-13 14:47:12 +00:00
|
|
|
indexKindOnly = "kind-only"
|
2021-02-11 00:40:32 +00:00
|
|
|
indexStatus = "status"
|
|
|
|
indexNodeService = "node_service"
|
2021-02-12 22:31:02 +00:00
|
|
|
indexNode = "node"
|
2021-03-16 17:15:14 +00:00
|
|
|
indexUpstream = "upstream"
|
|
|
|
indexDownstream = "downstream"
|
2021-03-16 17:54:05 +00:00
|
|
|
indexGateway = "gateway"
|
2021-08-19 21:17:59 +00:00
|
|
|
indexUUID = "uuid"
|
|
|
|
indexMeta = "meta"
|
2021-12-02 23:42:47 +00:00
|
|
|
indexCounterOnly = "counter"
|
2020-12-16 22:12:42 +00:00
|
|
|
)
|
|
|
|
|
2021-02-19 23:18:25 +00:00
|
|
|
// nodesTableSchema returns a new table schema used for storing struct.Node.
|
2020-12-16 22:12:42 +00:00
|
|
|
func nodesTableSchema() *memdb.TableSchema {
|
|
|
|
return &memdb.TableSchema{
|
|
|
|
Name: tableNodes,
|
|
|
|
Indexes: map[string]*memdb.IndexSchema{
|
2021-01-29 01:30:08 +00:00
|
|
|
indexID: {
|
|
|
|
Name: indexID,
|
2020-12-16 22:12:42 +00:00
|
|
|
AllowMissing: false,
|
|
|
|
Unique: true,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerSingleWithPrefix[Query, *structs.Node, any]{
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
readIndex: indexWithPeerName(indexFromQuery),
|
|
|
|
writeIndex: indexWithPeerName(indexFromNode),
|
|
|
|
prefixIndex: prefixIndexFromQueryWithPeer,
|
2020-12-16 22:12:42 +00:00
|
|
|
},
|
|
|
|
},
|
2021-08-19 21:17:59 +00:00
|
|
|
indexUUID: {
|
|
|
|
Name: indexUUID,
|
2020-12-16 22:12:42 +00:00
|
|
|
AllowMissing: true,
|
|
|
|
Unique: true,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerSingleWithPrefix[Query, *structs.Node, Query]{
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
readIndex: indexWithPeerName(indexFromUUIDQuery),
|
|
|
|
writeIndex: indexWithPeerName(indexIDFromNode),
|
|
|
|
prefixIndex: prefixIndexFromUUIDWithPeerQuery,
|
2021-08-19 21:17:59 +00:00
|
|
|
},
|
2020-12-16 22:12:42 +00:00
|
|
|
},
|
2021-08-19 21:17:59 +00:00
|
|
|
indexMeta: {
|
|
|
|
Name: indexMeta,
|
2020-12-16 22:12:42 +00:00
|
|
|
AllowMissing: true,
|
|
|
|
Unique: false,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerMulti[KeyValueQuery, *structs.Node]{
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
readIndex: indexWithPeerName(indexFromKeyValueQuery),
|
|
|
|
writeIndexMulti: multiIndexWithPeerName(indexMetaFromNode),
|
2020-12-16 22:12:42 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexFromNode(n *structs.Node) ([]byte, error) {
|
2021-03-29 17:55:13 +00:00
|
|
|
if n.Node == "" {
|
|
|
|
return nil, errMissingValueForIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
var b indexBuilder
|
|
|
|
b.String(strings.ToLower(n.Node))
|
|
|
|
return b.Bytes(), nil
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexIDFromNode(n *structs.Node) ([]byte, error) {
|
2021-08-19 21:17:59 +00:00
|
|
|
if n.ID == "" {
|
|
|
|
return nil, errMissingValueForIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
v, err := uuidStringToBytes(string(n.ID))
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return v, nil
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexMetaFromNode(n *structs.Node) ([][]byte, error) {
|
2021-08-19 21:17:59 +00:00
|
|
|
// NOTE: this is case-sensitive!
|
|
|
|
|
|
|
|
vals := make([][]byte, 0, len(n.Meta))
|
|
|
|
for key, val := range n.Meta {
|
|
|
|
if key == "" {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
var b indexBuilder
|
|
|
|
b.String(key)
|
|
|
|
b.String(val)
|
|
|
|
vals = append(vals, b.Bytes())
|
|
|
|
}
|
|
|
|
if len(vals) == 0 {
|
|
|
|
return nil, errMissingValueForIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
return vals, nil
|
|
|
|
}
|
|
|
|
|
2020-12-16 22:12:42 +00:00
|
|
|
// servicesTableSchema returns a new table schema used to store information
|
|
|
|
// about services.
|
|
|
|
func servicesTableSchema() *memdb.TableSchema {
|
|
|
|
return &memdb.TableSchema{
|
|
|
|
Name: tableServices,
|
|
|
|
Indexes: map[string]*memdb.IndexSchema{
|
|
|
|
indexID: {
|
|
|
|
Name: indexID,
|
|
|
|
AllowMissing: false,
|
|
|
|
Unique: true,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerSingleWithPrefix[NodeServiceQuery, *structs.ServiceNode, any]{
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
readIndex: indexWithPeerName(indexFromNodeServiceQuery),
|
|
|
|
writeIndex: indexWithPeerName(indexFromServiceNode),
|
|
|
|
prefixIndex: prefixIndexFromQueryWithPeer,
|
2020-12-16 22:12:42 +00:00
|
|
|
},
|
|
|
|
},
|
2021-02-12 22:31:02 +00:00
|
|
|
indexNode: {
|
|
|
|
Name: indexNode,
|
2020-12-16 22:12:42 +00:00
|
|
|
AllowMissing: false,
|
|
|
|
Unique: false,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerSingle[Query, nodeIdentifier]{
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
readIndex: indexWithPeerName(indexFromQuery),
|
|
|
|
writeIndex: indexWithPeerName(indexFromNodeIdentity),
|
2020-12-16 22:12:42 +00:00
|
|
|
},
|
|
|
|
},
|
2021-03-16 17:54:05 +00:00
|
|
|
indexService: {
|
|
|
|
Name: indexService,
|
2020-12-16 22:12:42 +00:00
|
|
|
AllowMissing: true,
|
|
|
|
Unique: false,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerSingle[Query, *structs.ServiceNode]{
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
readIndex: indexWithPeerName(indexFromQuery),
|
|
|
|
writeIndex: indexWithPeerName(indexServiceNameFromServiceNode),
|
2020-12-16 22:12:42 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
indexConnect: {
|
|
|
|
Name: indexConnect,
|
|
|
|
AllowMissing: true,
|
|
|
|
Unique: false,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerSingle[Query, *structs.ServiceNode]{
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
readIndex: indexWithPeerName(indexFromQuery),
|
|
|
|
writeIndex: indexWithPeerName(indexConnectNameFromServiceNode),
|
2021-03-26 21:21:38 +00:00
|
|
|
},
|
2020-12-16 22:12:42 +00:00
|
|
|
},
|
|
|
|
indexKind: {
|
|
|
|
Name: indexKind,
|
|
|
|
AllowMissing: false,
|
|
|
|
Unique: false,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerSingle[Query, *structs.ServiceNode]{
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
readIndex: indexWithPeerName(indexFromQuery),
|
|
|
|
writeIndex: indexWithPeerName(indexKindFromServiceNode),
|
2021-03-26 22:38:52 +00:00
|
|
|
},
|
2020-12-16 22:12:42 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexFromNodeServiceQuery(q NodeServiceQuery) ([]byte, error) {
|
2021-03-29 17:55:13 +00:00
|
|
|
var b indexBuilder
|
|
|
|
b.String(strings.ToLower(q.Node))
|
|
|
|
b.String(strings.ToLower(q.Service))
|
|
|
|
return b.Bytes(), nil
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexFromServiceNode(n *structs.ServiceNode) ([]byte, error) {
|
2021-03-29 17:55:13 +00:00
|
|
|
if n.Node == "" {
|
|
|
|
return nil, errMissingValueForIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
var b indexBuilder
|
|
|
|
b.String(strings.ToLower(n.Node))
|
|
|
|
b.String(strings.ToLower(n.ServiceID))
|
|
|
|
return b.Bytes(), nil
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
type nodeIdentifier interface {
|
|
|
|
partitionIndexable
|
|
|
|
peerIndexable
|
|
|
|
|
|
|
|
NodeIdentity() structs.Identity
|
|
|
|
}
|
2021-03-29 17:55:13 +00:00
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
var _ nodeIdentifier = (*structs.HealthCheck)(nil)
|
|
|
|
var _ nodeIdentifier = (*structs.ServiceNode)(nil)
|
|
|
|
|
|
|
|
func indexFromNodeIdentity(n nodeIdentifier) ([]byte, error) {
|
2021-03-29 17:55:13 +00:00
|
|
|
id := n.NodeIdentity()
|
|
|
|
if id.ID == "" {
|
|
|
|
return nil, errMissingValueForIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
var b indexBuilder
|
|
|
|
b.String(strings.ToLower(id.ID))
|
|
|
|
return b.Bytes(), nil
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexServiceNameFromServiceNode(n *structs.ServiceNode) ([]byte, error) {
|
2021-03-26 21:21:38 +00:00
|
|
|
if n.Node == "" {
|
|
|
|
return nil, errMissingValueForIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
var b indexBuilder
|
|
|
|
b.String(strings.ToLower(n.ServiceName))
|
|
|
|
return b.Bytes(), nil
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexConnectNameFromServiceNode(n *structs.ServiceNode) ([]byte, error) {
|
2021-03-26 21:21:38 +00:00
|
|
|
name, ok := connectNameFromServiceNode(n)
|
|
|
|
if !ok {
|
|
|
|
return nil, errMissingValueForIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
var b indexBuilder
|
|
|
|
b.String(strings.ToLower(name))
|
|
|
|
return b.Bytes(), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func connectNameFromServiceNode(sn *structs.ServiceNode) (string, bool) {
|
|
|
|
switch {
|
|
|
|
case sn.ServiceKind == structs.ServiceKindConnectProxy:
|
|
|
|
// For proxies, this service supports Connect for the destination
|
|
|
|
return sn.ServiceProxy.DestinationServiceName, true
|
|
|
|
|
|
|
|
case sn.ServiceConnect.Native:
|
|
|
|
// For native, this service supports Connect directly
|
|
|
|
return sn.ServiceName, true
|
|
|
|
|
|
|
|
default:
|
|
|
|
// Doesn't support Connect at all
|
|
|
|
return "", false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexKindFromServiceNode(n *structs.ServiceNode) ([]byte, error) {
|
2021-03-26 22:38:52 +00:00
|
|
|
var b indexBuilder
|
|
|
|
b.String(strings.ToLower(string(n.ServiceKind)))
|
|
|
|
return b.Bytes(), nil
|
|
|
|
}
|
|
|
|
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
// indexWithPeerName adds peer name to the index.
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexWithPeerName[T peerIndexable](
|
|
|
|
fn func(T) ([]byte, error),
|
|
|
|
) func(T) ([]byte, error) {
|
|
|
|
return func(e T) ([]byte, error) {
|
|
|
|
v, err := fn(e)
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
peername := e.PeerOrEmpty()
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
if peername == "" {
|
|
|
|
peername = structs.LocalPeerKeyword
|
|
|
|
}
|
|
|
|
b := newIndexBuilder(len(v) + len(peername) + 1)
|
|
|
|
b.String(strings.ToLower(peername))
|
|
|
|
b.Raw(v)
|
|
|
|
return b.Bytes(), nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// multiIndexWithPeerName adds peer name to multiple indices, and returns multiple indices.
|
2022-06-23 15:07:19 +00:00
|
|
|
func multiIndexWithPeerName[T any](
|
|
|
|
fn func(T) ([][]byte, error),
|
|
|
|
) func(T) ([][]byte, error) {
|
|
|
|
return func(raw T) ([][]byte, error) {
|
|
|
|
n, ok := any(raw).(peerIndexable)
|
|
|
|
if !ok {
|
|
|
|
return nil, fmt.Errorf("type must be peerIndexable: %T", raw)
|
|
|
|
}
|
|
|
|
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
results, err := fn(raw)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
peername := n.PeerOrEmpty()
|
|
|
|
if peername == "" {
|
|
|
|
peername = structs.LocalPeerKeyword
|
|
|
|
}
|
|
|
|
for i, v := range results {
|
|
|
|
b := newIndexBuilder(len(v) + len(peername) + 1)
|
|
|
|
b.String(strings.ToLower(peername))
|
|
|
|
b.Raw(v)
|
|
|
|
results[i] = b.Bytes()
|
|
|
|
}
|
|
|
|
return results, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-16 22:12:42 +00:00
|
|
|
// checksTableSchema returns a new table schema used for storing and indexing
|
|
|
|
// health check information. Health checks have a number of different attributes
|
|
|
|
// we want to filter by, so this table is a bit more complex.
|
|
|
|
func checksTableSchema() *memdb.TableSchema {
|
|
|
|
return &memdb.TableSchema{
|
|
|
|
Name: tableChecks,
|
|
|
|
Indexes: map[string]*memdb.IndexSchema{
|
|
|
|
indexID: {
|
|
|
|
Name: indexID,
|
|
|
|
AllowMissing: false,
|
|
|
|
Unique: true,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerSingleWithPrefix[NodeCheckQuery, *structs.HealthCheck, any]{
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
readIndex: indexWithPeerName(indexFromNodeCheckQuery),
|
|
|
|
writeIndex: indexWithPeerName(indexFromHealthCheck),
|
|
|
|
prefixIndex: prefixIndexFromQueryWithPeer,
|
2020-12-16 22:12:42 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
indexStatus: {
|
|
|
|
Name: indexStatus,
|
|
|
|
AllowMissing: false,
|
|
|
|
Unique: false,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerSingle[Query, *structs.HealthCheck]{
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
readIndex: indexWithPeerName(indexFromQuery),
|
|
|
|
writeIndex: indexWithPeerName(indexStatusFromHealthCheck),
|
2020-12-16 22:12:42 +00:00
|
|
|
},
|
|
|
|
},
|
2021-03-16 17:54:05 +00:00
|
|
|
indexService: {
|
|
|
|
Name: indexService,
|
2020-12-16 22:12:42 +00:00
|
|
|
AllowMissing: true,
|
|
|
|
Unique: false,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerSingle[Query, *structs.HealthCheck]{
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
readIndex: indexWithPeerName(indexFromQuery),
|
|
|
|
writeIndex: indexWithPeerName(indexServiceNameFromHealthCheck),
|
2020-12-16 22:12:42 +00:00
|
|
|
},
|
|
|
|
},
|
2021-02-12 22:31:02 +00:00
|
|
|
indexNode: {
|
|
|
|
Name: indexNode,
|
2020-12-16 22:12:42 +00:00
|
|
|
AllowMissing: true,
|
|
|
|
Unique: false,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerSingle[Query, nodeIdentifier]{
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
readIndex: indexWithPeerName(indexFromQuery),
|
|
|
|
writeIndex: indexWithPeerName(indexFromNodeIdentity),
|
2020-12-16 22:12:42 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
indexNodeService: {
|
|
|
|
Name: indexNodeService,
|
|
|
|
AllowMissing: true,
|
|
|
|
Unique: false,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerSingle[NodeServiceQuery, *structs.HealthCheck]{
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
readIndex: indexWithPeerName(indexFromNodeServiceQuery),
|
|
|
|
writeIndex: indexWithPeerName(indexNodeServiceFromHealthCheck),
|
2020-12-16 22:12:42 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexFromNodeCheckQuery(q NodeCheckQuery) ([]byte, error) {
|
|
|
|
if q.Node == "" || q.CheckID == "" {
|
2021-03-29 17:55:13 +00:00
|
|
|
return nil, errMissingValueForIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
var b indexBuilder
|
2022-06-23 15:07:19 +00:00
|
|
|
b.String(strings.ToLower(q.Node))
|
|
|
|
b.String(strings.ToLower(q.CheckID))
|
2021-03-29 17:55:13 +00:00
|
|
|
return b.Bytes(), nil
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexFromHealthCheck(hc *structs.HealthCheck) ([]byte, error) {
|
2021-03-29 17:55:13 +00:00
|
|
|
if hc.Node == "" || hc.CheckID == "" {
|
|
|
|
return nil, errMissingValueForIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
var b indexBuilder
|
|
|
|
b.String(strings.ToLower(hc.Node))
|
|
|
|
b.String(strings.ToLower(string(hc.CheckID)))
|
|
|
|
return b.Bytes(), nil
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexNodeServiceFromHealthCheck(hc *structs.HealthCheck) ([]byte, error) {
|
2021-03-29 17:55:13 +00:00
|
|
|
if hc.Node == "" {
|
|
|
|
return nil, errMissingValueForIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
var b indexBuilder
|
|
|
|
b.String(strings.ToLower(hc.Node))
|
|
|
|
b.String(strings.ToLower(hc.ServiceID))
|
|
|
|
return b.Bytes(), nil
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexStatusFromHealthCheck(hc *structs.HealthCheck) ([]byte, error) {
|
2021-03-29 20:29:04 +00:00
|
|
|
if hc.Status == "" {
|
|
|
|
return nil, errMissingValueForIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
var b indexBuilder
|
|
|
|
b.String(strings.ToLower(hc.Status))
|
|
|
|
return b.Bytes(), nil
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexServiceNameFromHealthCheck(hc *structs.HealthCheck) ([]byte, error) {
|
2021-03-29 20:37:37 +00:00
|
|
|
if hc.ServiceName == "" {
|
|
|
|
return nil, errMissingValueForIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
var b indexBuilder
|
|
|
|
b.String(strings.ToLower(hc.ServiceName))
|
|
|
|
return b.Bytes(), nil
|
|
|
|
}
|
|
|
|
|
2022-10-21 19:58:06 +00:00
|
|
|
// gatewayServicesTableSchema returns a new table schema used to store information
|
2020-12-16 22:12:42 +00:00
|
|
|
// about services associated with terminating gateways.
|
2021-01-29 01:48:51 +00:00
|
|
|
func gatewayServicesTableSchema() *memdb.TableSchema {
|
2020-12-16 22:12:42 +00:00
|
|
|
return &memdb.TableSchema{
|
2021-01-29 01:48:51 +00:00
|
|
|
Name: tableGatewayServices,
|
2020-12-16 22:12:42 +00:00
|
|
|
Indexes: map[string]*memdb.IndexSchema{
|
2021-01-29 01:30:08 +00:00
|
|
|
indexID: {
|
|
|
|
Name: indexID,
|
2020-12-16 22:12:42 +00:00
|
|
|
AllowMissing: false,
|
|
|
|
Unique: true,
|
|
|
|
Indexer: &memdb.CompoundIndex{
|
|
|
|
Indexes: []memdb.Indexer{
|
|
|
|
&ServiceNameIndex{
|
|
|
|
Field: "Gateway",
|
|
|
|
},
|
|
|
|
&ServiceNameIndex{
|
|
|
|
Field: "Service",
|
|
|
|
},
|
|
|
|
&memdb.IntFieldIndex{
|
|
|
|
Field: "Port",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-03-16 17:54:05 +00:00
|
|
|
indexGateway: {
|
|
|
|
Name: indexGateway,
|
2020-12-16 22:12:42 +00:00
|
|
|
AllowMissing: false,
|
|
|
|
Unique: false,
|
|
|
|
Indexer: &ServiceNameIndex{
|
|
|
|
Field: "Gateway",
|
|
|
|
},
|
|
|
|
},
|
2021-03-16 17:54:05 +00:00
|
|
|
indexService: {
|
|
|
|
Name: indexService,
|
2020-12-16 22:12:42 +00:00
|
|
|
AllowMissing: true,
|
|
|
|
Unique: false,
|
|
|
|
Indexer: &ServiceNameIndex{
|
|
|
|
Field: "Service",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-29 01:48:51 +00:00
|
|
|
// meshTopologyTableSchema returns a new table schema used to store information
|
2020-12-16 22:12:42 +00:00
|
|
|
// relating upstream and downstream services
|
2021-01-29 01:48:51 +00:00
|
|
|
func meshTopologyTableSchema() *memdb.TableSchema {
|
2020-12-16 22:12:42 +00:00
|
|
|
return &memdb.TableSchema{
|
2021-01-29 01:48:51 +00:00
|
|
|
Name: tableMeshTopology,
|
2020-12-16 22:12:42 +00:00
|
|
|
Indexes: map[string]*memdb.IndexSchema{
|
2021-01-29 01:30:08 +00:00
|
|
|
indexID: {
|
|
|
|
Name: indexID,
|
2020-12-16 22:12:42 +00:00
|
|
|
AllowMissing: false,
|
|
|
|
Unique: true,
|
|
|
|
Indexer: &memdb.CompoundIndex{
|
|
|
|
Indexes: []memdb.Indexer{
|
|
|
|
&ServiceNameIndex{
|
|
|
|
Field: "Upstream",
|
|
|
|
},
|
|
|
|
&ServiceNameIndex{
|
|
|
|
Field: "Downstream",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-03-16 17:15:14 +00:00
|
|
|
indexUpstream: {
|
|
|
|
Name: indexUpstream,
|
2020-12-16 22:12:42 +00:00
|
|
|
AllowMissing: true,
|
|
|
|
Unique: false,
|
|
|
|
Indexer: &ServiceNameIndex{
|
|
|
|
Field: "Upstream",
|
|
|
|
},
|
|
|
|
},
|
2021-03-16 17:15:14 +00:00
|
|
|
indexDownstream: {
|
|
|
|
Name: indexDownstream,
|
2020-12-16 22:12:42 +00:00
|
|
|
AllowMissing: false,
|
|
|
|
Unique: false,
|
|
|
|
Indexer: &ServiceNameIndex{
|
|
|
|
Field: "Downstream",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type ServiceNameIndex struct {
|
|
|
|
Field string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (index *ServiceNameIndex) FromObject(obj interface{}) (bool, []byte, error) {
|
|
|
|
v := reflect.ValueOf(obj)
|
|
|
|
v = reflect.Indirect(v) // Dereference the pointer if any
|
|
|
|
|
|
|
|
fv := v.FieldByName(index.Field)
|
|
|
|
isPtr := fv.Kind() == reflect.Ptr
|
|
|
|
fv = reflect.Indirect(fv)
|
|
|
|
if !isPtr && !fv.IsValid() || !fv.CanInterface() {
|
|
|
|
return false, nil,
|
|
|
|
fmt.Errorf("field '%s' for %#v is invalid %v ", index.Field, obj, isPtr)
|
|
|
|
}
|
|
|
|
|
|
|
|
name, ok := fv.Interface().(structs.ServiceName)
|
|
|
|
if !ok {
|
|
|
|
return false, nil, fmt.Errorf("Field 'ServiceName' is not of type structs.ServiceName")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Enforce lowercase and add null character as terminator
|
|
|
|
id := strings.ToLower(name.String()) + "\x00"
|
|
|
|
|
|
|
|
return true, []byte(id), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (index *ServiceNameIndex) FromArgs(args ...interface{}) ([]byte, error) {
|
|
|
|
if len(args) != 1 {
|
|
|
|
return nil, fmt.Errorf("must provide only a single argument")
|
|
|
|
}
|
|
|
|
name, ok := args[0].(structs.ServiceName)
|
|
|
|
if !ok {
|
|
|
|
return nil, fmt.Errorf("argument must be of type structs.ServiceName: %#v", args[0])
|
|
|
|
}
|
|
|
|
|
|
|
|
// Enforce lowercase and add null character as terminator
|
|
|
|
id := strings.ToLower(name.String()) + "\x00"
|
|
|
|
|
|
|
|
return []byte(strings.ToLower(id)), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (index *ServiceNameIndex) PrefixFromArgs(args ...interface{}) ([]byte, error) {
|
|
|
|
val, err := index.FromArgs(args...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Strip the null terminator, the rest is a prefix
|
|
|
|
n := len(val)
|
|
|
|
if n > 0 {
|
|
|
|
return val[:n-1], nil
|
|
|
|
}
|
|
|
|
return val, nil
|
|
|
|
}
|
2021-03-16 17:37:44 +00:00
|
|
|
|
|
|
|
// upstreamDownstream pairs come from individual proxy registrations, which can be updated independently.
|
|
|
|
type upstreamDownstream struct {
|
|
|
|
Upstream structs.ServiceName
|
|
|
|
Downstream structs.ServiceName
|
|
|
|
|
|
|
|
// Refs stores the registrations that contain this pairing.
|
|
|
|
// When there are no remaining Refs, the upstreamDownstream can be deleted.
|
|
|
|
//
|
|
|
|
// Note: This map must be treated as immutable when accessed in MemDB.
|
|
|
|
// The entire upstreamDownstream structure must be deep copied on updates.
|
|
|
|
Refs map[string]struct{}
|
|
|
|
|
|
|
|
structs.RaftIndex
|
|
|
|
}
|
2021-02-12 23:06:56 +00:00
|
|
|
|
2021-03-22 21:29:58 +00:00
|
|
|
// NodeCheckQuery is used to query the ID index of the checks table.
|
|
|
|
type NodeCheckQuery struct {
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
Node string
|
|
|
|
CheckID string
|
|
|
|
PeerName string
|
2022-04-05 21:10:06 +00:00
|
|
|
acl.EnterpriseMeta
|
2021-02-12 23:06:56 +00:00
|
|
|
}
|
2021-03-29 17:55:13 +00:00
|
|
|
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
type peerIndexable interface {
|
|
|
|
PeerOrEmpty() string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (q NodeCheckQuery) PeerOrEmpty() string {
|
|
|
|
return q.PeerName
|
|
|
|
}
|
|
|
|
|
2021-03-29 17:55:13 +00:00
|
|
|
// NamespaceOrDefault exists because structs.EnterpriseMeta uses a pointer
|
|
|
|
// receiver for this method. Remove once that is fixed.
|
|
|
|
func (q NodeCheckQuery) NamespaceOrDefault() string {
|
|
|
|
return q.EnterpriseMeta.NamespaceOrDefault()
|
|
|
|
}
|
2021-07-22 18:58:08 +00:00
|
|
|
|
|
|
|
// PartitionOrDefault exists because structs.EnterpriseMeta uses a pointer
|
|
|
|
// receiver for this method. Remove once that is fixed.
|
|
|
|
func (q NodeCheckQuery) PartitionOrDefault() string {
|
|
|
|
return q.EnterpriseMeta.PartitionOrDefault()
|
|
|
|
}
|
2021-12-02 23:42:47 +00:00
|
|
|
|
|
|
|
// ServiceVirtualIP is used to store a virtual IP associated with a service.
|
|
|
|
// It is also used to store assigned virtual IPs when a snapshot is created.
|
|
|
|
type ServiceVirtualIP struct {
|
2022-06-24 18:38:39 +00:00
|
|
|
Service structs.PeeredServiceName
|
2021-12-02 23:42:47 +00:00
|
|
|
IP net.IP
|
2022-06-29 20:34:58 +00:00
|
|
|
|
|
|
|
structs.RaftIndex
|
2021-12-02 23:42:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// FreeVirtualIP is used to store a virtual IP freed up by a service deregistration.
|
|
|
|
// It is also used to store free virtual IPs when a snapshot is created.
|
|
|
|
type FreeVirtualIP struct {
|
|
|
|
IP net.IP
|
|
|
|
IsCounter bool
|
|
|
|
}
|
|
|
|
|
2021-12-10 21:36:10 +00:00
|
|
|
func counterIndex(obj interface{}) (bool, error) {
|
|
|
|
if vip, ok := obj.(FreeVirtualIP); ok {
|
|
|
|
return vip.IsCounter, nil
|
|
|
|
}
|
|
|
|
return false, fmt.Errorf("object is not a virtual IP entry")
|
|
|
|
}
|
|
|
|
|
2021-12-02 23:42:47 +00:00
|
|
|
func serviceVirtualIPTableSchema() *memdb.TableSchema {
|
|
|
|
return &memdb.TableSchema{
|
|
|
|
Name: tableServiceVirtualIPs,
|
|
|
|
Indexes: map[string]*memdb.IndexSchema{
|
|
|
|
indexID: {
|
|
|
|
Name: indexID,
|
|
|
|
AllowMissing: false,
|
|
|
|
Unique: true,
|
2022-06-29 20:34:58 +00:00
|
|
|
Indexer: indexerSingleWithPrefix[structs.PeeredServiceName, ServiceVirtualIP, Query]{
|
2022-06-24 18:38:39 +00:00
|
|
|
readIndex: indexFromPeeredServiceName,
|
|
|
|
writeIndex: indexFromServiceVirtualIP,
|
2022-06-29 20:34:58 +00:00
|
|
|
// Read all peers in a cluster / partition
|
|
|
|
prefixIndex: prefixIndexFromQueryWithPeerWildcardable,
|
2021-12-02 23:42:47 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-24 18:38:39 +00:00
|
|
|
func indexFromServiceVirtualIP(vip ServiceVirtualIP) ([]byte, error) {
|
|
|
|
if vip.Service.ServiceName.Name == "" {
|
|
|
|
return nil, errMissingValueForIndex
|
|
|
|
}
|
|
|
|
return indexFromPeeredServiceName(vip.Service)
|
|
|
|
}
|
|
|
|
|
2021-12-02 23:42:47 +00:00
|
|
|
func freeVirtualIPTableSchema() *memdb.TableSchema {
|
|
|
|
return &memdb.TableSchema{
|
|
|
|
Name: tableFreeVirtualIPs,
|
|
|
|
Indexes: map[string]*memdb.IndexSchema{
|
|
|
|
indexID: {
|
|
|
|
Name: indexID,
|
|
|
|
AllowMissing: false,
|
|
|
|
Unique: true,
|
2021-12-10 21:36:10 +00:00
|
|
|
Indexer: &memdb.CompoundIndex{
|
|
|
|
Indexes: []memdb.Indexer{
|
|
|
|
&memdb.StringFieldIndex{
|
|
|
|
Field: "IP",
|
|
|
|
},
|
|
|
|
&memdb.ConditionalIndex{
|
|
|
|
Conditional: counterIndex,
|
|
|
|
},
|
|
|
|
},
|
2021-12-02 23:42:47 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
indexCounterOnly: {
|
|
|
|
Name: indexCounterOnly,
|
|
|
|
AllowMissing: false,
|
|
|
|
Unique: false,
|
|
|
|
Indexer: &memdb.ConditionalIndex{
|
2021-12-10 21:36:10 +00:00
|
|
|
Conditional: counterIndex,
|
2021-12-02 23:42:47 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2021-12-02 00:44:13 +00:00
|
|
|
|
|
|
|
type KindServiceName struct {
|
|
|
|
Kind structs.ServiceKind
|
|
|
|
Service structs.ServiceName
|
|
|
|
|
|
|
|
structs.RaftIndex
|
|
|
|
}
|
|
|
|
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
func (n *KindServiceName) PartitionOrDefault() string {
|
|
|
|
return n.Service.PartitionOrDefault()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *KindServiceName) NamespaceOrDefault() string {
|
|
|
|
return n.Service.NamespaceOrDefault()
|
|
|
|
}
|
|
|
|
|
2021-12-02 00:44:13 +00:00
|
|
|
func kindServiceNameTableSchema() *memdb.TableSchema {
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
// TODO(peering): make this peer-aware
|
2021-12-02 00:44:13 +00:00
|
|
|
return &memdb.TableSchema{
|
|
|
|
Name: tableKindServiceNames,
|
|
|
|
Indexes: map[string]*memdb.IndexSchema{
|
|
|
|
indexID: {
|
|
|
|
Name: indexID,
|
|
|
|
AllowMissing: false,
|
|
|
|
Unique: true,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerSingle[any, any]{
|
2021-12-02 00:44:13 +00:00
|
|
|
readIndex: indexFromKindServiceName,
|
|
|
|
writeIndex: indexFromKindServiceName,
|
|
|
|
},
|
|
|
|
},
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
indexKind: {
|
|
|
|
Name: indexKind,
|
2021-12-02 00:44:13 +00:00
|
|
|
AllowMissing: false,
|
|
|
|
Unique: false,
|
2022-06-23 15:07:19 +00:00
|
|
|
Indexer: indexerSingle[enterpriseIndexable, enterpriseIndexable]{
|
2021-12-02 00:44:13 +00:00
|
|
|
readIndex: indexFromKindServiceNameKindOnly,
|
|
|
|
writeIndex: indexFromKindServiceNameKindOnly,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// KindServiceNameQuery is used to lookup service names by kind or enterprise meta.
|
|
|
|
type KindServiceNameQuery struct {
|
|
|
|
Kind structs.ServiceKind
|
|
|
|
Name string
|
2022-04-05 21:10:06 +00:00
|
|
|
acl.EnterpriseMeta
|
2021-12-02 00:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NamespaceOrDefault exists because structs.EnterpriseMeta uses a pointer
|
|
|
|
// receiver for this method. Remove once that is fixed.
|
|
|
|
func (q KindServiceNameQuery) NamespaceOrDefault() string {
|
|
|
|
return q.EnterpriseMeta.NamespaceOrDefault()
|
|
|
|
}
|
|
|
|
|
|
|
|
// PartitionOrDefault exists because structs.EnterpriseMeta uses a pointer
|
|
|
|
// receiver for this method. Remove once that is fixed.
|
|
|
|
func (q KindServiceNameQuery) PartitionOrDefault() string {
|
|
|
|
return q.EnterpriseMeta.PartitionOrDefault()
|
|
|
|
}
|
|
|
|
|
2022-06-23 15:07:19 +00:00
|
|
|
func indexFromKindServiceNameKindOnly(raw enterpriseIndexable) ([]byte, error) {
|
2021-12-02 00:44:13 +00:00
|
|
|
switch x := raw.(type) {
|
|
|
|
case *KindServiceName:
|
|
|
|
var b indexBuilder
|
|
|
|
b.String(strings.ToLower(string(x.Kind)))
|
|
|
|
return b.Bytes(), nil
|
|
|
|
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
case Query:
|
2021-12-02 00:44:13 +00:00
|
|
|
var b indexBuilder
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
b.String(strings.ToLower(x.Value))
|
2021-12-02 00:44:13 +00:00
|
|
|
return b.Bytes(), nil
|
|
|
|
|
|
|
|
default:
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
return nil, fmt.Errorf("type must be *KindServiceName or Query: %T", raw)
|
2021-12-02 00:44:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
func kindServiceNamesMaxIndex(tx ReadTxn, ws memdb.WatchSet, kind string) uint64 {
|
2021-12-02 00:44:13 +00:00
|
|
|
return maxIndexWatchTxn(tx, ws, kindServiceNameIndexName(kind))
|
|
|
|
}
|
|
|
|
|
peering: initial sync (#12842)
- Add endpoints related to peering: read, list, generate token, initiate peering
- Update node/service/check table indexing to account for peers
- Foundational changes for pushing service updates to a peer
- Plumb peer name through Health.ServiceNodes path
see: ENT-1765, ENT-1280, ENT-1283, ENT-1283, ENT-1756, ENT-1739, ENT-1750, ENT-1679,
ENT-1709, ENT-1704, ENT-1690, ENT-1689, ENT-1702, ENT-1701, ENT-1683, ENT-1663,
ENT-1650, ENT-1678, ENT-1628, ENT-1658, ENT-1640, ENT-1637, ENT-1597, ENT-1634,
ENT-1613, ENT-1616, ENT-1617, ENT-1591, ENT-1588, ENT-1596, ENT-1572, ENT-1555
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
Co-authored-by: freddygv <freddy@hashicorp.com>
Co-authored-by: Chris S. Kim <ckim@hashicorp.com>
Co-authored-by: Evan Culver <eculver@hashicorp.com>
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
2022-04-21 22:34:40 +00:00
|
|
|
func kindServiceNameIndexName(kind string) string {
|
|
|
|
return "kind_service_names." + kind
|
2021-12-02 00:44:13 +00:00
|
|
|
}
|