mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 02:15:43 +03:00
services: get Consul token from hook resources (#18600)
When Workload Identity is being used with Consul, the `consul_hook` will add Consul tokens to the alloc hook resources. Update the `group_service_hook` and `service_hook` to use those tokens when available for registering and deregistering Consul workloads.
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/hashicorp/nomad/client/serviceregistration"
|
||||
regMock "github.com/hashicorp/nomad/client/serviceregistration/mock"
|
||||
"github.com/hashicorp/nomad/client/serviceregistration/wrapper"
|
||||
cstructs "github.com/hashicorp/nomad/client/structs"
|
||||
"github.com/hashicorp/nomad/client/taskenv"
|
||||
agentconsul "github.com/hashicorp/nomad/command/agent/consul"
|
||||
"github.com/hashicorp/nomad/helper/testlog"
|
||||
@@ -260,6 +261,7 @@ func TestScript_TaskEnvInterpolation(t *testing.T) {
|
||||
task: task,
|
||||
serviceRegWrapper: regWrap,
|
||||
logger: logger,
|
||||
hookResources: cstructs.NewAllocHookResources(),
|
||||
})
|
||||
// emulate prestart having been fired
|
||||
svcHook.taskEnv = env
|
||||
|
||||
Reference in New Issue
Block a user