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

add deprecation warning for Vault/Consul token usage #18863

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions command/agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,12 @@ func (c *Command) setupAgent(config *Config, logger hclog.InterceptLogger, logOu
}
c.httpServers = httpServers

for _, vault := range config.Vaults {
if vault.Token != "" {
logger.Warn("Setting a Vault token in the agent configuration is deprecated and will be removed in Nomad 1.9. Migrate your Vault configuration to use workload identity.", "cluster", vault.Name)
}
}

// If DisableUpdateCheck is not enabled, set up update checking
// (DisableUpdateCheck is false by default)
if config.DisableUpdateCheck != nil && !*config.DisableUpdateCheck {
Expand Down
11 changes: 11 additions & 0 deletions command/job_revert.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@ func (c *JobRevertCommand) Run(args []string) int {
vaultToken = os.Getenv("VAULT_TOKEN")
}

if consulToken != "" {
c.Ui.Warn(strings.TrimSpace(`
Warning: setting a Consul token when submitting a job is deprecated and will be
removed in Nomad 1.9. Migrate your Consul configuration to use workload identity.`))
}
if vaultToken != "" {
c.Ui.Warn(strings.TrimSpace(`
Warning: setting a Vault token when submitting a job is deprecated and will be
removed in Nomad 1.9. Migrate your Vault configuration to use workload identity.`))
}

// Parse the job version
revertVersion, ok, err := parseVersion(args[1])
if !ok {
Expand Down
6 changes: 6 additions & 0 deletions command/job_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ func (c *JobRunCommand) Run(args []string) int {
}

if consulToken != "" {
c.Ui.Warn(strings.TrimSpace(`
Warning: setting a Consul token when submitting a job is deprecated and will be
removed in Nomad 1.9. Migrate your Consul configuration to use workload identity.`))
job.ConsulToken = pointer.Of(consulToken)
}

Expand All @@ -294,6 +297,9 @@ func (c *JobRunCommand) Run(args []string) int {
}

if vaultToken != "" {
c.Ui.Warn(strings.TrimSpace(`
Warning: setting a Vault token when submitting a job is deprecated and will be
removed in Nomad 1.9. Migrate your Vault configuration to use workload identity.`))
job.VaultToken = pointer.Of(vaultToken)
}

Expand Down