state: use enterprise meta for creating events

pull/9073/head
Daniel Nephin 2020-10-21 16:41:22 -04:00
parent 0ad2406d7c
commit 43c5803a25
2 changed files with 5 additions and 7 deletions

View File

@ -45,8 +45,8 @@ func serviceHealthSnapshot(s *Store, topic stream.Topic) stream.SnapshotFunc {
defer tx.Abort()
connect := topic == topicServiceHealthConnect
// TODO(namespace-streaming): plumb entMeta through from SubscribeRequest
idx, nodes, err := checkServiceNodesTxn(tx, nil, req.Key, connect, nil)
entMeta := structs.EnterpriseMetaInitializer(req.Namespace)
idx, nodes, err := checkServiceNodesTxn(tx, nil, req.Key, connect, &entMeta)
if err != nil {
return 0, err
}
@ -349,8 +349,7 @@ func getPayloadCheckServiceNode(payload stream.Payload) *structs.CheckServiceNod
// parseCheckServiceNodes but is more efficient since we know they are all on
// the same node.
func newServiceHealthEventsForNode(tx ReadTxn, idx uint64, node string) ([]stream.Event, error) {
// TODO(namespace-streaming): figure out the right EntMeta and mystery arg.
services, err := catalogServiceListByNode(tx, node, nil, false)
services, err := catalogServiceListByNode(tx, node, structs.WildcardEnterpriseMeta(), true)
if err != nil {
return nil, err
}
@ -384,8 +383,7 @@ func getNodeAndChecks(tx ReadTxn, node string) (*structs.Node, serviceChecksFunc
}
n := nodeRaw.(*structs.Node)
// TODO(namespace-streaming): work out what EntMeta is needed here, wildcard?
iter, err := catalogListChecksByNode(tx, node, nil)
iter, err := catalogListChecksByNode(tx, node, structs.WildcardEnterpriseMeta())
if err != nil {
return nil, nil, err
}

View File

@ -1,13 +1,13 @@
package consul
import (
"github.com/hashicorp/consul/agent/structs"
"google.golang.org/grpc"
"github.com/hashicorp/consul/acl"
"github.com/hashicorp/consul/agent/consul/stream"
agentgrpc "github.com/hashicorp/consul/agent/grpc"
"github.com/hashicorp/consul/agent/rpc/subscribe"
"github.com/hashicorp/consul/agent/structs"
)
type subscribeBackend struct {