mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
Nomad servers, if upgraded, can return node identities as part of the register and update/heartbeat response objects. The Nomad client will now handle this and store it as appropriate within its memory and statedb. The client will now use any stored identity for RPC authentication with a fallback to the secretID. This supports upgrades paths where the Nomad clients are updated before the Nomad servers.
22 lines
770 B
Go
22 lines
770 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package client
|
|
|
|
// NodeIdentityHandler is an interface that allows setting a node identity
|
|
// token. The client uses this to inform its subsystems about a new node
|
|
// identity that it should use for RPC calls.
|
|
type NodeIdentityHandler interface {
|
|
SetNodeIdentityToken(token string)
|
|
}
|
|
|
|
// assertAndSetNodeIdentityToken expects the passed interface implements
|
|
// NodeIdentityHandler and calls SetNodeIdentityToken. It is a programming error
|
|
// if the interface does not implement NodeIdentityHandler and will panic. The
|
|
// test file performs test assertions.
|
|
func assertAndSetNodeIdentityToken(impl any, token string) {
|
|
if impl != nil {
|
|
impl.(NodeIdentityHandler).SetNodeIdentityToken(token)
|
|
}
|
|
}
|