From 3b806d41c007226c9d8fab60f7e6b508150434cd Mon Sep 17 00:00:00 2001 From: cskh Date: Thu, 26 Oct 2023 13:12:20 -0400 Subject: [PATCH] test deployer: fix a bug when deploying cluster with various ent images (#19381) --- testing/deployer/topology/compile.go | 2 +- testing/deployer/topology/images.go | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/testing/deployer/topology/compile.go b/testing/deployer/topology/compile.go index 98f1c1e917e8..7faf74d01a0e 100644 --- a/testing/deployer/topology/compile.go +++ b/testing/deployer/topology/compile.go @@ -203,7 +203,7 @@ func compile(logger hclog.Logger, raw *Config, prev *Topology) (*Topology, error n.Index = nextIndex nextIndex++ - n.Images = c.Images.OverrideWith(n.Images).ChooseNode(n.Kind) + n.Images = c.Images.OverrideWith(n.Images.ChooseConsul(c.Enterprise)).ChooseNode(n.Kind) n.Cluster = c.Name n.Datacenter = c.Datacenter diff --git a/testing/deployer/topology/images.go b/testing/deployer/topology/images.go index 836ddb091c91..7adb8d3f7ee6 100644 --- a/testing/deployer/topology/images.go +++ b/testing/deployer/topology/images.go @@ -8,8 +8,12 @@ import ( ) type Images struct { - Consul string `json:",omitempty"` - ConsulCE string `json:",omitempty"` + // Consul is the image used for creating the container, + // Use ChooseConsul() to control which image (ConsulCE or ConsulEnterprise) assign to Consul + Consul string `json:",omitempty"` + // ConsulCE sets the CE image + ConsulCE string `json:",omitempty"` + // ConsulEnterprise sets the ent image ConsulEnterprise string `json:",omitempty"` Envoy string Dataplane string @@ -82,6 +86,7 @@ func (i Images) ChooseNode(kind NodeKind) Images { return i } +// ChooseConsul controls which image assigns to Consul func (i Images) ChooseConsul(enterprise bool) Images { if enterprise { i.Consul = i.ConsulEnterprise