Merge pull request #91 from digitalocean/awg/label-check-stable-output

Make "details" for the label check stable
wwarren/update-k8s-deps
Adam Wolfe Gordon 2020-08-13 13:22:52 -06:00 committed by GitHub
commit 37326c1fc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -18,6 +18,7 @@ package doks
import (
"fmt"
"sort"
"strings"
"github.com/digitalocean/clusterlint/checks"
@ -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.",

View File

@ -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",