Skip to content

Commit

Permalink
layer2: Rename usableSpeakers param to speakers
Browse files Browse the repository at this point in the history
As requested by Johannes here:
	#662 (comment)

Signed-off-by: Rodrigo Campos <rodrigo@kinvolk.io>
  • Loading branch information
rata authored and johananl committed Oct 14, 2020
1 parent 45f8058 commit 79db52b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions speaker/layer2_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,18 @@ func (c *layer2Controller) SetConfig(log.Logger, *config.Config) error {

// usableNodes returns all nodes that have at least one fully ready
// endpoint on them.
func usableNodes(eps *v1.Endpoints, usableSpeakers map[string]bool) []string {
// The speakers parameter is a map with the node name as key and the readiness
// status as value (true means ready, false means not ready).
// If the speakers map is nil, it is ignored.
func usableNodes(eps *v1.Endpoints, speakers map[string]bool) []string {
usable := map[string]bool{}
for _, subset := range eps.Subsets {
for _, ep := range subset.Addresses {
if ep.NodeName == nil {
continue
}
if usableSpeakers != nil {
if _, ok := usableSpeakers[*ep.NodeName]; !ok {
if speakers != nil {
if _, ok := speakers[*ep.NodeName]; !ok {
continue
}
}
Expand Down

0 comments on commit 79db52b

Please sign in to comment.