mirror of https://github.com/hashicorp/consul
Fixup typo, comments, and regression
parent
08759e46ed
commit
f5ed751c91
|
@ -911,7 +911,7 @@ func registerTestTopologyEntries(t *testing.T, codec rpc.ClientCodec, token stri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func registetIntentionUpstreamEntries(t *testing.T, codec rpc.ClientCodec, token string) {
|
func registerIntentionUpstreamEntries(t *testing.T, codec rpc.ClientCodec, token string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
// api and api-proxy on node foo
|
// api and api-proxy on node foo
|
||||||
|
|
|
@ -683,6 +683,10 @@ func (s *Intention) Check(args *structs.IntentionQueryRequest, reply *structs.In
|
||||||
return fmt.Errorf("Invalid destination namespace %q: %v", query.DestinationNS, err)
|
return fmt.Errorf("Invalid destination namespace %q: %v", query.DestinationNS, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if query.SourceType != structs.IntentionSourceConsul {
|
||||||
|
return fmt.Errorf("unsupported SourceType: %q", query.SourceType)
|
||||||
|
}
|
||||||
|
|
||||||
// Perform the ACL check. For Check we only require ServiceRead and
|
// Perform the ACL check. For Check we only require ServiceRead and
|
||||||
// NOT IntentionRead because the Check API only returns pass/fail and
|
// NOT IntentionRead because the Check API only returns pass/fail and
|
||||||
// returns no other information about the intentions used. We could check
|
// returns no other information about the intentions used. We could check
|
||||||
|
|
|
@ -188,7 +188,7 @@ func (m *Internal) ServiceTopology(args *structs.ServiceSpecificRequest, reply *
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// IntentionUpstreams returns the upstreams or downstreams of a service. Upstreams and downstreams are inferred from intentions.
|
// IntentionUpstreams returns the upstreams of a service. Upstreams are inferred from intentions.
|
||||||
// If intentions allow a connection from the target to some candidate service, the candidate service is considered
|
// If intentions allow a connection from the target to some candidate service, the candidate service is considered
|
||||||
// an upstream of the target.
|
// an upstream of the target.
|
||||||
func (m *Internal) IntentionUpstreams(args *structs.ServiceSpecificRequest, reply *structs.IndexedServiceList) error {
|
func (m *Internal) IntentionUpstreams(args *structs.ServiceSpecificRequest, reply *structs.IndexedServiceList) error {
|
||||||
|
|
|
@ -1908,7 +1908,7 @@ func TestInternal_IntentionUpstreams(t *testing.T) {
|
||||||
// Intentions
|
// Intentions
|
||||||
// * -> * (deny) intention
|
// * -> * (deny) intention
|
||||||
// web -> api (allow)
|
// web -> api (allow)
|
||||||
registetIntentionUpstreamEntries(t, codec, "")
|
registerIntentionUpstreamEntries(t, codec, "")
|
||||||
|
|
||||||
t.Run("web", func(t *testing.T) {
|
t.Run("web", func(t *testing.T) {
|
||||||
retry.Run(t, func(r *retry.R) {
|
retry.Run(t, func(r *retry.R) {
|
||||||
|
@ -1957,7 +1957,7 @@ func TestInternal_IntentionUpstreams_ACL(t *testing.T) {
|
||||||
// Intentions
|
// Intentions
|
||||||
// * -> * (deny) intention
|
// * -> * (deny) intention
|
||||||
// web -> api (allow)
|
// web -> api (allow)
|
||||||
registetIntentionUpstreamEntries(t, codec, TestDefaultMasterToken)
|
registerIntentionUpstreamEntries(t, codec, TestDefaultMasterToken)
|
||||||
|
|
||||||
t.Run("valid token", func(t *testing.T) {
|
t.Run("valid token", func(t *testing.T) {
|
||||||
// Token grants read to read api service
|
// Token grants read to read api service
|
||||||
|
|
|
@ -747,7 +747,7 @@ func serviceListTxn(tx ReadTxn, ws memdb.WatchSet,
|
||||||
svc := service.(*structs.ServiceNode)
|
svc := service.(*structs.ServiceNode)
|
||||||
// TODO (freddy) This is a hack to exclude certain kinds.
|
// TODO (freddy) This is a hack to exclude certain kinds.
|
||||||
// Need a new index to query by kind and namespace, have to coordinate with consul foundations first
|
// Need a new index to query by kind and namespace, have to coordinate with consul foundations first
|
||||||
if include != nil && include(svc) {
|
if include == nil || include(svc) {
|
||||||
unique[svc.CompoundServiceName()] = struct{}{}
|
unique[svc.CompoundServiceName()] = struct{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue