Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
Sort labels and taints
Browse files Browse the repository at this point in the history
This avoids, flappy tests, and flappy diffs
  • Loading branch information
errm committed Nov 21, 2018
1 parent 67293a9 commit f88d66d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"fmt"
"log"
"regexp"
"sort"
"time"
)

Expand Down Expand Up @@ -110,6 +111,7 @@ func (n *Node) Labels() []string {
for key, value := range labels {
l = append(l, key+"="+value)
}
sort.Strings(l)
return l
}

Expand All @@ -132,6 +134,7 @@ func (n *Node) Taints() []string {
taints = append(taints, matches[1]+"="+*t.Value)
}
}
sort.Strings(taints)
return taints
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/system/system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func TestConfigureLabels(t *testing.T) {
}

expected := `[Service]
Environment='KUBELET_NODE_LABELS=--node-labels="node-role.kubernetes.io/worker=true,gpu-type=K80"'
Environment='KUBELET_NODE_LABELS=--node-labels="gpu-type=K80,node-role.kubernetes.io/worker=true"'
`
fs.Check(t, "/etc/systemd/system/kubelet.service.d/40-labels.conf", expected, 0640)
}
Expand Down

0 comments on commit f88d66d

Please sign in to comment.