From daf20f97881d65f02fbd38616e09b675bd1205ed Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Wed, 27 Oct 2021 07:20:29 -0700 Subject: [PATCH] vault: set JobID in Vault metadata (#11397) Closes: #11395 . --- .changelog/11397.txt | 3 +++ nomad/vault.go | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 .changelog/11397.txt diff --git a/.changelog/11397.txt b/.changelog/11397.txt new file mode 100644 index 000000000..892890f29 --- /dev/null +++ b/.changelog/11397.txt @@ -0,0 +1,3 @@ +```release-note:improvement +vault: Add JobID and TaskGroup to Vault Token metadata +``` diff --git a/nomad/vault.go b/nomad/vault.go index 3fb4abcde..4e8a1ff13 100644 --- a/nomad/vault.go +++ b/nomad/vault.go @@ -997,6 +997,8 @@ func (v *vaultClient) CreateToken(ctx context.Context, a *structs.Allocation, ta Policies: taskVault.Policies, Metadata: map[string]string{ "AllocationID": a.ID, + "JobID": a.JobID, + "TaskGroup": a.TaskGroup, "Task": task, "NodeID": a.NodeID, "Namespace": namespaceForTask,