mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
fix sorting tolerations in case the keys are equal
This commit is contained in:
parent
9f77657538
commit
3df1b30d27
@ -3829,33 +3829,26 @@ func printTolerationsMultilineWithIndent(w PrefixWriter, initialIndent, title, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to print tolerations in the sorted order
|
// to print tolerations in the sorted order
|
||||||
keys := make([]string, 0, len(tolerations))
|
sort.Slice(tolerations, func(i, j int) bool {
|
||||||
for _, toleration := range tolerations {
|
return tolerations[i].Key < tolerations[j].Key
|
||||||
keys = append(keys, toleration.Key)
|
})
|
||||||
}
|
|
||||||
sort.Strings(keys)
|
|
||||||
|
|
||||||
for i, key := range keys {
|
for i, toleration := range tolerations {
|
||||||
for _, toleration := range tolerations {
|
if i != 0 {
|
||||||
if toleration.Key == key {
|
w.Write(LEVEL_0, "%s", initialIndent)
|
||||||
if i != 0 {
|
w.Write(LEVEL_0, "%s", innerIndent)
|
||||||
w.Write(LEVEL_0, "%s", initialIndent)
|
|
||||||
w.Write(LEVEL_0, "%s", innerIndent)
|
|
||||||
}
|
|
||||||
w.Write(LEVEL_0, "%s", toleration.Key)
|
|
||||||
if len(toleration.Value) != 0 {
|
|
||||||
w.Write(LEVEL_0, "=%s", toleration.Value)
|
|
||||||
}
|
|
||||||
if len(toleration.Effect) != 0 {
|
|
||||||
w.Write(LEVEL_0, ":%s", toleration.Effect)
|
|
||||||
}
|
|
||||||
if toleration.TolerationSeconds != nil {
|
|
||||||
w.Write(LEVEL_0, " for %ds", *toleration.TolerationSeconds)
|
|
||||||
}
|
|
||||||
w.Write(LEVEL_0, "\n")
|
|
||||||
i++
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
w.Write(LEVEL_0, "%s", toleration.Key)
|
||||||
|
if len(toleration.Value) != 0 {
|
||||||
|
w.Write(LEVEL_0, "=%s", toleration.Value)
|
||||||
|
}
|
||||||
|
if len(toleration.Effect) != 0 {
|
||||||
|
w.Write(LEVEL_0, ":%s", toleration.Effect)
|
||||||
|
}
|
||||||
|
if toleration.TolerationSeconds != nil {
|
||||||
|
w.Write(LEVEL_0, " for %ds", *toleration.TolerationSeconds)
|
||||||
|
}
|
||||||
|
w.Write(LEVEL_0, "\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user