diff --git a/testing/deployer/sprawl/internal/tfgen/agent.go b/testing/deployer/sprawl/internal/tfgen/agent.go index 9245925d53..58bd564e64 100644 --- a/testing/deployer/sprawl/internal/tfgen/agent.go +++ b/testing/deployer/sprawl/internal/tfgen/agent.go @@ -25,6 +25,12 @@ func (g *Generator) generateAgentHCL(node *topology.Node, enableV2, enableV2Tena var b HCLBuilder + // We first write ExtraConfig since it could be overwritten by specific + // configurations below + if node.ExtraConfig != "" { + b.format(node.ExtraConfig) + } + b.add("server", node.IsServer()) b.add("bind_addr", "0.0.0.0") b.add("client_addr", "0.0.0.0") @@ -49,6 +55,7 @@ func (g *Generator) generateAgentHCL(node *topology.Node, enableV2, enableV2Tena // speed up leaves b.addBlock("performance", func() { b.add("leave_drain_time", "50ms") + b.add("raft_multiplier", 1) }) b.add("primary_datacenter", node.Datacenter) @@ -61,6 +68,9 @@ func (g *Generator) generateAgentHCL(node *topology.Node, enableV2, enableV2Tena // } if node.Segment != nil { + if node.Kind != topology.NodeKindClient { + panic("segment only applies to client agent") + } b.add("segment", node.Segment.Name) b.addSlice("retry_join", []string{ fmt.Sprintf("server.%s-consulcluster.lan:%d", node.Cluster, node.Segment.Port), diff --git a/testing/deployer/topology/topology.go b/testing/deployer/topology/topology.go index 985fc837c4..07c2bc84dd 100644 --- a/testing/deployer/topology/topology.go +++ b/testing/deployer/topology/topology.go @@ -553,6 +553,9 @@ type Node struct { // Network segment of the agent - applicable to client agent only Segment *NetworkSegment + + // ExtraConfig is the extra config added to the node + ExtraConfig string } func (n *Node) DockerName() string {