-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fingerprint: add support for fingerprinting multiple Consul clusters
Add fingerprinting we'll need to accept multiple Consul clusters in upcoming Nomad Enterprise features. The fingerprinter will create a map of Consul clients by cluster name. In Nomad CE, all but the default cluster will be ignored and there will be no visible behavior change. Ref: hashicorp/team-nomad#404
- Loading branch information
Showing
3 changed files
with
274 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
//go:build !ent | ||
|
||
package fingerprint | ||
|
||
import "github.com/hashicorp/nomad/nomad/structs/config" | ||
|
||
// consulConfigs returns the set of Consul configurations the fingerprint needs | ||
// to check. In Nomad CE we only check the default Consul. | ||
func (f *ConsulFingerprint) consulConfigs(req *FingerprintRequest) map[string]*config.ConsulConfig { | ||
agentCfg := req.Config | ||
if agentCfg.ConsulConfig == nil { | ||
return nil | ||
} | ||
|
||
if len(req.Config.ConsulConfigs) > 1 { | ||
f.logger.Warn("multiple Consul configurations are only supported in Nomad Enterprise") | ||
} | ||
|
||
return map[string]*config.ConsulConfig{"default": agentCfg.ConsulConfig} | ||
} |
Oops, something went wrong.