update taints e2e, respect that taint is unique by key, effect

This commit is contained in:
Kevin
2016-08-30 15:11:49 +08:00
parent 5512104d36
commit fff139ce32
7 changed files with 201 additions and 79 deletions

View File

@@ -144,7 +144,7 @@ func reorganizeTaints(accessor meta.Object, overwrite bool, taintsToAdd []api.Ta
for _, oldTaint := range oldTaints {
existsInNew := false
for _, taint := range newTaints {
if taint.Key == oldTaint.Key && taint.Effect == oldTaint.Effect {
if taint.MatchTaint(oldTaint) {
existsInNew = true
break
}

View File

@@ -2579,23 +2579,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++
}
}
}