-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed deprecated fields from Drain structs and API
node drain: use msgtype on txn so that events are emitted wip: encoding extension to add Node.Drain field back to API responses
- Loading branch information
Showing
16 changed files
with
84 additions
and
211 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
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,37 @@ | ||
package agent | ||
|
||
import ( | ||
"reflect" | ||
|
||
"github.com/hashicorp/go-msgpack/codec" | ||
|
||
"github.com/hashicorp/nomad/nomad/structs" | ||
) | ||
|
||
// Special encoding for structs.Node, to perform the following: | ||
// 1. ensure that Node.SecretID is zeroed out | ||
// 2. provide backwards compatibility for the following fields: | ||
// * Node.Drain | ||
type nodesExt struct{} | ||
|
||
// ConvertExt converts a structs.Node to an anonymous struct with the extra field, Drain | ||
func (n nodesExt) ConvertExt(v interface{}) interface{} { | ||
node := v.(*structs.Node) | ||
copy := node.Copy() | ||
copy.SecretID = "" | ||
return struct { | ||
*structs.Node | ||
Drain bool | ||
}{ | ||
Node: copy, | ||
Drain: node.DrainStrategy != nil, | ||
} | ||
} | ||
|
||
// UpdateExt is not used | ||
func (n nodesExt) UpdateExt(_ interface{}, _ interface{}) {} | ||
|
||
func registerExtensions(h *codec.JsonHandle) *codec.JsonHandle { | ||
h.SetInterfaceExt(reflect.TypeOf(structs.Node{}), 1, nodesExt{}) | ||
return h | ||
} |
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
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
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
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
Oops, something went wrong.