Skip to content

Commit

Permalink
feature: make the node's label "node.kubernetes.io/exclude-from-exter…
Browse files Browse the repository at this point in the history
…nal-load-balancers" valuable

The label specifies that the node should not be considered as a target for external load-balancers which use nodes as a second hop.

Signed-off-by: cyclinder <qifeng.guo@daocloud.io>
  • Loading branch information
cyclinder committed Dec 4, 2023
1 parent adfe4cc commit 7e15972
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,11 @@ func selectedNodes(nodes []corev1.Node, selectors []metav1.LabelSelector) (map[s
res := make(map[string]bool)
OUTER:
for _, node := range nodes {
_, ok := node.Labels[corev1.LabelNodeExcludeBalancers]
if ok {
continue
}

if len(labelSelectors) == 0 { // no selector mean all nodes are valid
res[node.Name] = true
}
Expand Down

0 comments on commit 7e15972

Please sign in to comment.