2023-03-28 18:39:22 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2022-07-01 15:15:49 +00:00
|
|
|
//go:build !consulent
|
|
|
|
// +build !consulent
|
|
|
|
|
|
|
|
package proxycfgglue
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/consul/acl"
|
|
|
|
"github.com/hashicorp/consul/agent/structs"
|
2023-02-17 21:14:46 +00:00
|
|
|
"github.com/hashicorp/consul/proto/private/pbsubscribe"
|
2022-07-01 15:15:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (s serverIntentions) buildSubjects(serviceName string, entMeta acl.EnterpriseMeta) []*pbsubscribe.NamedSubject {
|
|
|
|
// Based on getIntentionPrecedenceMatchServiceNames in the state package.
|
|
|
|
if serviceName == structs.WildcardSpecifier {
|
|
|
|
return []*pbsubscribe.NamedSubject{
|
|
|
|
{
|
|
|
|
Key: structs.WildcardSpecifier,
|
|
|
|
Namespace: entMeta.NamespaceOrDefault(),
|
|
|
|
Partition: entMeta.PartitionOrDefault(),
|
|
|
|
PeerName: structs.DefaultPeerKeyword,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return []*pbsubscribe.NamedSubject{
|
|
|
|
{
|
|
|
|
Key: serviceName,
|
|
|
|
Namespace: entMeta.NamespaceOrDefault(),
|
|
|
|
Partition: entMeta.PartitionOrDefault(),
|
|
|
|
PeerName: structs.DefaultPeerKeyword,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Key: structs.WildcardSpecifier,
|
|
|
|
Namespace: entMeta.NamespaceOrDefault(),
|
|
|
|
Partition: entMeta.PartitionOrDefault(),
|
|
|
|
PeerName: structs.DefaultPeerKeyword,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|