From b30b541007e52243e40f831c570de5bb01141ee0 Mon Sep 17 00:00:00 2001 From: Kyle Havlovitz Date: Tue, 22 Jan 2019 11:29:13 -0800 Subject: [PATCH] connect: Forward intention RPCs if this isn't the primary --- agent/consul/intention_endpoint.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/agent/consul/intention_endpoint.go b/agent/consul/intention_endpoint.go index 6c6a5e6df..141d1c39d 100644 --- a/agent/consul/intention_endpoint.go +++ b/agent/consul/intention_endpoint.go @@ -29,6 +29,12 @@ type Intention struct { func (s *Intention) Apply( args *structs.IntentionRequest, reply *string) error { + + // Forward this request to the primary DC if we're a secondary that's replicating intentions. + if s.srv.intentionReplicationEnabled() { + args.Datacenter = s.srv.config.PrimaryDatacenter + } + if done, err := s.srv.forward("Intention.Apply", args, args, reply); done { return err }