| 838 | } |
| 839 | |
| 840 | func addTaintToSpec(node *corev1.Node, taintKey string, taintValue string, effect corev1.TaintEffect) bool { |
| 841 | for _, taint := range node.Spec.Taints { |
| 842 | if taint.Key == taintKey { |
| 843 | log.Debug(). |
| 844 | Str("taint_key", taintKey). |
| 845 | Interface("taint", taint). |
| 846 | Str("node_name", node.Name). |
| 847 | Msg("Taint key already present on node") |
| 848 | return false |
| 849 | } |
| 850 | } |
| 851 | node.Spec.Taints = append(node.Spec.Taints, corev1.Taint{ |
| 852 | Key: taintKey, |
| 853 | Value: taintValue, |
| 854 | Effect: effect, |
| 855 | }) |
| 856 | return true |
| 857 | } |
| 858 | |
| 859 | func removeTaint(node *corev1.Node, client kubernetes.Interface, taintKey string) (bool, error) { |
| 860 | retryDeadline := time.Now().Add(maxRetryDeadline) |