connect: do not restrict auto envoy version to docker task driver (#17041)
This PR updates the envoy_bootstrap_hook to no longer disable itself if the task driver in use is not docker. In other words, make it work for podman and other image based task drivers. The hook now only checks that 1. the task is a connect sidecar 2. the task.config block contains an "image" field
This commit is contained in:
parent
922c593203
commit
86f6a38867
|
@ -0,0 +1,3 @@
|
|||
```release-note:improvement
|
||||
connect: do not restrict automatic envoy versioning to docker driver
|
||||
```
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue