Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get vault token in post-stop task if the alloc has failed #24845

Open
markasoftware-aqtc opened this issue Jan 12, 2025 · 0 comments
Open
Labels
stage/accepted Confirmed, and intend to work on. No timeline committment though. type/enhancement

Comments

@markasoftware-aqtc
Copy link

Nomad version

v1.9.4

Issue

If an alloc fails, a post-stop task cannot get the vault token. This breaks eg our use case where we use a post-stop task to detect if the job has failed, and if so get a slack token from vault and send an alert.

Reproduction steps

Write a job spec with a main task that fails and a poststop task that uses vault:

job "mork-job" {
  type = "batch"

  group "mork-group" {
    task "main" {
      driver = "exec"
      config {
        command = "false"
      }
    }

    task "post-stop" {
      driver = "exec"
      config {
        command = "true"
      }

      lifecycle {
        hook = "poststop"
      }

      vault {
        policies = ["foo"]
      }
    }
  }
}

Expected Result

Vault access succeeds.

Actual Result

Error Vault: server failed to derive vault token: Can't request Vault token for terminal allocation

@Juanadelacuesta Juanadelacuesta added stage/accepted Confirmed, and intend to work on. No timeline committment though. type/enhancement and removed type/bug labels Jan 21, 2025
@Juanadelacuesta Juanadelacuesta moved this from Needs Triage to Needs Roadmapping in Nomad - Community Issues Triage Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/accepted Confirmed, and intend to work on. No timeline committment though. type/enhancement
Projects
Status: Needs Roadmapping
Development

No branches or pull requests

2 participants