Skip to content

Commit

Permalink
only conditionally register the tproxy image with terraform
Browse files Browse the repository at this point in the history
  • Loading branch information
rboyer committed Nov 8, 2023
1 parent 588545d commit 22a3e0f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
8 changes: 1 addition & 7 deletions testing/deployer/sprawl/internal/build/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,7 @@ func DockerImages(
built := make(map[string]struct{})
for _, c := range t.Clusters {
for _, n := range c.Nodes {
needsTproxy := false
for _, svc := range n.Services {
if svc.EnableTransparentProxy {
needsTproxy = true
break
}
}
needsTproxy := n.NeedsTransparentProxy()

joint := n.Images.EnvoyConsulImage()
if _, ok := built[joint]; joint != "" && !ok {
Expand Down
4 changes: 3 additions & 1 deletion testing/deployer/sprawl/internal/tfgen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ func (g *Generator) Generate(step Step) error {
addImage("", node.Images.Consul)
addImage("", node.Images.EnvoyConsulImage())
addImage("", node.Images.LocalDataplaneImage())
addImage("", node.Images.LocalDataplaneTProxyImage())
if node.NeedsTransparentProxy() {
addImage("", node.Images.LocalDataplaneTProxyImage())
}

if node.IsAgent() {
addVolume(node.DockerName())
Expand Down
9 changes: 9 additions & 0 deletions testing/deployer/topology/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,15 @@ func (n *Node) SortedServices() []*Service {
return out
}

func (n *Node) NeedsTransparentProxy() bool {
for _, svc := range n.Services {
if svc.EnableTransparentProxy {
return true
}
}
return false
}

// DigestExposedPorts returns true if it was changed.
func (n *Node) DigestExposedPorts(ports map[int]int) bool {
if reflect.DeepEqual(n.usedPorts, ports) {
Expand Down

0 comments on commit 22a3e0f

Please sign in to comment.