Skip to content

Commit

Permalink
Merge pull request #91 from digitalocean/awg/label-check-stable-output
Browse files Browse the repository at this point in the history
Make "details" for the label check stable
  • Loading branch information
adamwg authored Aug 13, 2020
2 parents 6b6f1ed + a1e68fd commit 37326c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions checks/doks/node_labels_taints.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package doks

import (
"fmt"
"sort"
"strings"

"github.com/digitalocean/clusterlint/checks"
Expand Down Expand Up @@ -57,6 +58,9 @@ func (c *nodeLabelsTaintsCheck) Run(objects *kube.Objects) ([]checks.Diagnostic,
}
}
if len(customLabels) > 0 {
// The order of the map iteration above is non-deterministic, so
// sort the labels for stable output.
sort.Strings(customLabels)
d := checks.Diagnostic{
Severity: checks.Warning,
Message: "Custom node labels will be lost if node is replaced or upgraded. Add custom labels on node pools instead.",
Expand Down
2 changes: 1 addition & 1 deletion checks/doks/node_labels_taints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestNodeLabels(t *testing.T) {
Severity: checks.Warning,
Message: "Custom node labels will be lost if node is replaced or upgraded. Add custom labels on node pools instead.",
Kind: checks.Node,
Details: "Custom node labels: [example.com/custom-label example.com/another-label]",
Details: "Custom node labels: [example.com/another-label example.com/custom-label]",
Object: &metav1.ObjectMeta{
Labels: map[string]string{
"doks.digitalocean.com/foo": "bar",
Expand Down

0 comments on commit 37326c1

Please sign in to comment.