From 196a1c468a6da54a8748c55770bb4d01c551ed1b Mon Sep 17 00:00:00 2001 From: kisunji Date: Tue, 7 Jun 2022 19:54:09 -0400 Subject: [PATCH] Add missing index for read --- agent/consul/state/config_entry_intention.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/agent/consul/state/config_entry_intention.go b/agent/consul/state/config_entry_intention.go index 4113df3fb7..7575697e25 100644 --- a/agent/consul/state/config_entry_intention.go +++ b/agent/consul/state/config_entry_intention.go @@ -129,8 +129,15 @@ func (s *ServiceIntentionSourceIndex) FromArgs(args ...interface{}) ([]byte, err if !ok { return nil, fmt.Errorf("argument must be a structs.ServiceID: %#v", args[0]) } + // Intention queries cannot use a peered service as a source + peer := structs.LocalPeerKeyword + sn := arg.String() + // add 2 for null separator after each string + buf := newIndexBuilder(len(peer) + len(sn) + 2) + buf.String(peer) + buf.String(sn) // Add the null character as a terminator - return []byte(arg.String() + "\x00"), nil + return buf.Bytes(), nil } func configIntentionsListTxn(tx ReadTxn, ws memdb.WatchSet, entMeta *acl.EnterpriseMeta) (uint64, structs.Intentions, bool, error) {