Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.

Commit 2f3e851

Browse files
authored
agent: do not add taint for edge node (#20) (#21)
1 parent af6242d commit 2f3e851

File tree

2 files changed

+0
-43
lines changed

2 files changed

+0
-43
lines changed

pkg/controllers/agent/yurtcluster_controller.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,6 @@ func (r *YurtClusterReconciler) reconcileEdgeNode(ctx context.Context, yurtClust
163163
return ctrl.Result{}, errors.Errorf("can not convert node %q because it is in NotReady status", node.Name)
164164
}
165165

166-
// add edge taint
167-
util.EnsureEdgeTaintForNode(node)
168-
169166
// add edge label for node
170167
node.Labels[projectinfo.GetEdgeWorkerLabelKey()] = "true"
171168

@@ -177,9 +174,6 @@ func (r *YurtClusterReconciler) reconcileNormalNode(ctx context.Context, yurtClu
177174
return ctrl.Result{}, nil
178175
}
179176

180-
// remove edge taint if exists
181-
util.RemoveEdgeTaintForNode(node)
182-
183177
// remove edge label from node labels
184178
delete(node.Labels, projectinfo.GetEdgeWorkerLabelKey())
185179

pkg/util/kubernetes.go

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ const (
4848
// SkipReconcileAnnotation defines the annotation which marks the object should not be reconciled
4949
SkipReconcileAnnotation = "operator.openyurt.io/skip-reconcile"
5050

51-
// EdgeNodeTaintKey defines the taint key for edge node
52-
EdgeNodeTaintKey = "node-role.openyurt.io/edge"
53-
54-
// EdgeNodeTaintEffect defines the taint effect for edge node
55-
EdgeNodeTaintEffect = "NoSchedule"
56-
5751
// ControlPlaneLabel defines the label for control-plane node
5852
ControlPlaneLabel = "node-role.kubernetes.io/master"
5953
)
@@ -350,34 +344,3 @@ func GetYurtComponentImageByType(yurtCluster *operatorv1alpha1.YurtCluster, imag
350344
}
351345
return fmt.Sprintf("%s/%s:%s", repository, name, tag)
352346
}
353-
354-
// EnsureEdgeTaintForNode adds edge taint for node
355-
func EnsureEdgeTaintForNode(node *corev1.Node) {
356-
found := false
357-
for _, taint := range node.Spec.Taints {
358-
if taint.Key == EdgeNodeTaintKey && taint.Effect == EdgeNodeTaintEffect {
359-
found = true
360-
break
361-
}
362-
}
363-
364-
if !found {
365-
taint := corev1.Taint{
366-
Key: EdgeNodeTaintKey,
367-
Effect: EdgeNodeTaintEffect,
368-
}
369-
node.Spec.Taints = append(node.Spec.Taints, taint)
370-
}
371-
}
372-
373-
// RemoveEdgeTaintForNode removes edge taint for node
374-
func RemoveEdgeTaintForNode(node *corev1.Node) {
375-
var newTaints []corev1.Taint
376-
for _, taint := range node.Spec.Taints {
377-
if taint.Key == EdgeNodeTaintKey && taint.Effect == EdgeNodeTaintEffect {
378-
continue
379-
}
380-
newTaints = append(newTaints, taint)
381-
}
382-
node.Spec.Taints = newTaints
383-
}

0 commit comments

Comments
 (0)