From 65c1811755ab5f2e1f5c9d0c09595ef019f37aa0 Mon Sep 17 00:00:00 2001 From: Thomas Wunderlich Date: Thu, 28 Apr 2022 17:09:53 -0400 Subject: [PATCH 1/4] Quick and dirty hack to get interpolated dns values working --- client/allocrunner/taskrunner/task_runner.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/allocrunner/taskrunner/task_runner.go b/client/allocrunner/taskrunner/task_runner.go index b8c3b270c32..11de5346eeb 100644 --- a/client/allocrunner/taskrunner/task_runner.go +++ b/client/allocrunner/taskrunner/task_runner.go @@ -1041,10 +1041,14 @@ func (tr *TaskRunner) buildTaskConfig() *drivers.TaskConfig { if alloc.AllocatedResources != nil && len(alloc.AllocatedResources.Shared.Networks) > 0 { allocDNS := alloc.AllocatedResources.Shared.Networks[0].DNS if allocDNS != nil { + // could potentially interpolate here + interpolatedNetworks := taskenv.InterpolateNetworks(env, alloc.AllocatedResources.Shared.Networks) + tr.logger.Info("allocDNS is set", "dnsserver", allocDNS.Servers) + tr.logger.Info("interpolatedDNS is set", "dnsserver", interpolatedNetworks[0].DNS.Servers) dns = &drivers.DNSConfig{ - Servers: allocDNS.Servers, - Searches: allocDNS.Searches, - Options: allocDNS.Options, + Servers: interpolatedNetworks[0].DNS.Servers, + Searches: interpolatedNetworks[0].DNS.Searches, + Options: interpolatedNetworks[0].DNS.Options, } } } From ed9f8cd19aef06c047f6e7f34d0f99565b6879e0 Mon Sep 17 00:00:00 2001 From: Thomas Wunderlich Date: Thu, 28 Apr 2022 19:14:31 -0400 Subject: [PATCH 2/4] Remove debug log lines --- client/allocrunner/taskrunner/task_runner.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/client/allocrunner/taskrunner/task_runner.go b/client/allocrunner/taskrunner/task_runner.go index 11de5346eeb..b7217e43034 100644 --- a/client/allocrunner/taskrunner/task_runner.go +++ b/client/allocrunner/taskrunner/task_runner.go @@ -1041,10 +1041,7 @@ func (tr *TaskRunner) buildTaskConfig() *drivers.TaskConfig { if alloc.AllocatedResources != nil && len(alloc.AllocatedResources.Shared.Networks) > 0 { allocDNS := alloc.AllocatedResources.Shared.Networks[0].DNS if allocDNS != nil { - // could potentially interpolate here interpolatedNetworks := taskenv.InterpolateNetworks(env, alloc.AllocatedResources.Shared.Networks) - tr.logger.Info("allocDNS is set", "dnsserver", allocDNS.Servers) - tr.logger.Info("interpolatedDNS is set", "dnsserver", interpolatedNetworks[0].DNS.Servers) dns = &drivers.DNSConfig{ Servers: interpolatedNetworks[0].DNS.Servers, Searches: interpolatedNetworks[0].DNS.Searches, From f44de31f3191e65fdddd76ea4d1eed9f6ca13414 Mon Sep 17 00:00:00 2001 From: Thomas Wunderlich Date: Fri, 29 Apr 2022 10:02:20 -0400 Subject: [PATCH 3/4] Fix formatting --- client/allocrunner/taskrunner/task_runner.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/allocrunner/taskrunner/task_runner.go b/client/allocrunner/taskrunner/task_runner.go index b7217e43034..235a6ad870c 100644 --- a/client/allocrunner/taskrunner/task_runner.go +++ b/client/allocrunner/taskrunner/task_runner.go @@ -1041,7 +1041,7 @@ func (tr *TaskRunner) buildTaskConfig() *drivers.TaskConfig { if alloc.AllocatedResources != nil && len(alloc.AllocatedResources.Shared.Networks) > 0 { allocDNS := alloc.AllocatedResources.Shared.Networks[0].DNS if allocDNS != nil { - interpolatedNetworks := taskenv.InterpolateNetworks(env, alloc.AllocatedResources.Shared.Networks) + interpolatedNetworks := taskenv.InterpolateNetworks(env, alloc.AllocatedResources.Shared.Networks) dns = &drivers.DNSConfig{ Servers: interpolatedNetworks[0].DNS.Servers, Searches: interpolatedNetworks[0].DNS.Searches, From 924deb7a5d41bda3805febfec752d46f3d1f3dac Mon Sep 17 00:00:00 2001 From: Seth Hoenig Date: Tue, 17 May 2022 09:14:55 -0500 Subject: [PATCH 4/4] cl: add changelog note for network interpolation --- .changelog/12817.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/12817.txt diff --git a/.changelog/12817.txt b/.changelog/12817.txt new file mode 100644 index 00000000000..e81b1c01cd7 --- /dev/null +++ b/.changelog/12817.txt @@ -0,0 +1,3 @@ +```release-note:bug +client: Fixed a bug where network.dns block was not interpolated +```