upgrade test(LTS): import remaining agent config from usage profile (#19999)

* upgrade test(LTS): import remaining agent config from usage profile
This commit is contained in:
cskh 2024-01-03 12:52:49 -05:00 committed by GitHub
parent d925e4b812
commit 8e2d4e3aaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -25,6 +25,12 @@ func (g *Generator) generateAgentHCL(node *topology.Node, enableV2, enableV2Tena
var b HCLBuilder 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("server", node.IsServer())
b.add("bind_addr", "0.0.0.0") b.add("bind_addr", "0.0.0.0")
b.add("client_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 // speed up leaves
b.addBlock("performance", func() { b.addBlock("performance", func() {
b.add("leave_drain_time", "50ms") b.add("leave_drain_time", "50ms")
b.add("raft_multiplier", 1)
}) })
b.add("primary_datacenter", node.Datacenter) 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.Segment != nil {
if node.Kind != topology.NodeKindClient {
panic("segment only applies to client agent")
}
b.add("segment", node.Segment.Name) b.add("segment", node.Segment.Name)
b.addSlice("retry_join", []string{ b.addSlice("retry_join", []string{
fmt.Sprintf("server.%s-consulcluster.lan:%d", node.Cluster, node.Segment.Port), fmt.Sprintf("server.%s-consulcluster.lan:%d", node.Cluster, node.Segment.Port),

View File

@ -553,6 +553,9 @@ type Node struct {
// Network segment of the agent - applicable to client agent only // Network segment of the agent - applicable to client agent only
Segment *NetworkSegment Segment *NetworkSegment
// ExtraConfig is the extra config added to the node
ExtraConfig string
} }
func (n *Node) DockerName() string { func (n *Node) DockerName() string {