diff --git a/.changelog/17041.txt b/.changelog/17041.txt new file mode 100644 index 00000000000..a770937d5dd --- /dev/null +++ b/.changelog/17041.txt @@ -0,0 +1,3 @@ +```release-note:improvement +connect: do not restrict automatic envoy versioning to docker driver +``` diff --git a/client/allocrunner/taskrunner/envoy_version_hook.go b/client/allocrunner/taskrunner/envoy_version_hook.go index 9438d6c8e44..eb168608abc 100644 --- a/client/allocrunner/taskrunner/envoy_version_hook.go +++ b/client/allocrunner/taskrunner/envoy_version_hook.go @@ -122,8 +122,6 @@ func (_ *envoyVersionHook) interpolateImage(task *structs.Task, env *taskenv.Tas // its envoy proxy version resolved automatically. func (h *envoyVersionHook) skip(request *ifs.TaskPrestartRequest) bool { switch { - case request.Task.Driver != "docker": - return true case !request.Task.UsesConnectSidecar(): return true case !h.needsVersion(request.Task.Config): @@ -158,6 +156,10 @@ func (h *envoyVersionHook) needsVersion(config map[string]interface{}) bool { return false } + if _, exists := config["image"]; !exists { + return false + } + image := h.taskImage(config) return strings.Contains(image, envoy.VersionVar) diff --git a/client/allocrunner/taskrunner/envoy_version_hook_test.go b/client/allocrunner/taskrunner/envoy_version_hook_test.go index a2dd3be58ea..ca20d7c309e 100644 --- a/client/allocrunner/taskrunner/envoy_version_hook_test.go +++ b/client/allocrunner/taskrunner/envoy_version_hook_test.go @@ -272,6 +272,7 @@ func TestTaskRunner_EnvoyVersionHook_Prestart_custom(t *testing.T) { // Setup an Allocation alloc := mock.ConnectAlloc() alloc.Job.TaskGroups[0].Tasks[0] = mock.ConnectSidecarTask() + alloc.Job.TaskGroups[0].Tasks[0].Driver = "podman" alloc.Job.TaskGroups[0].Tasks[0].Config["image"] = "custom-${NOMAD_envoy_version}:latest" allocDir, cleanupDir := allocdir.TestAllocDir(t, logger, "EnvoyVersionHook", alloc.ID) defer cleanupDir()