Merge pull request #32378 from kevin-wangzefeng/update-taints-e2e

Automatic merge from submit-queue

update taints e2e, restrict taints operation with key, effect

Since taints are now unique by key, effect on a node, this PR is to restrict existing taints adding/removing/updating operations in taints e2e.
Also fixes https://github.com/kubernetes/kubernetes/issues/31066#issuecomment-242870101
Related prior Issue/PR #29362 and #30590
This commit is contained in:
Kubernetes Submit Queue
2016-09-10 13:20:51 -07:00
committed by GitHub
7 changed files with 201 additions and 79 deletions

View File

@@ -2608,23 +2608,19 @@ func printTaintsMultilineWithIndent(out io.Writer, initialIndent, title, innerIn
// to print taints in the sorted order
keys := make([]string, 0, len(taints))
for _, taint := range taints {
keys = append(keys, taint.Key)
keys = append(keys, string(taint.Effect)+","+taint.Key)
}
sort.Strings(keys)
effects := []api.TaintEffect{api.TaintEffectNoSchedule, api.TaintEffectPreferNoSchedule}
for i, key := range keys {
for _, effect := range effects {
for _, taint := range taints {
if taint.Key == key && taint.Effect == effect {
if i != 0 {
fmt.Fprint(out, initialIndent)
fmt.Fprint(out, innerIndent)
}
fmt.Fprintf(out, "%s=%s:%s\n", taint.Key, taint.Value, taint.Effect)
i++
for _, taint := range taints {
if string(taint.Effect)+","+taint.Key == key {
if i != 0 {
fmt.Fprint(out, initialIndent)
fmt.Fprint(out, innerIndent)
}
fmt.Fprintf(out, "%s\n", taint.ToString())
i++
}
}
}