Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support excluding nodes when creating workloads #365

Merged
merged 5 commits into from
Mar 23, 2021
Merged

Conversation

tonicmuroq
Copy link
Contributor

No description provided.

return nodenames, nil
}

allNodes, err := c.ListPodNodes(context.Background(), podname, map[string]string{}, false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ctx ! 不要用 background,另外这个函数为啥在这里,不应该在 helper 么

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为了用这个 ListPodNodes

Comment on lines 60 to 66
for _, n := range allNodes {
if _, ok := excludes[n.Name]; ok {
continue
}
rv = append(rv, n.Name)
}
return rv, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得你这样不如直接改 withNodeLocks 了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我其实甚至觉得 withNodeLocks 都不应该有 podname ... 为了保持一致就改这里了

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那你不如抽出整个 node 筛选的函数,包括 pod,all,黑名单白名单,withNodeLocks 就当纯粹的锁……现在就很分裂

@tonicmuroq
Copy link
Contributor Author

updated

@tonicmuroq tonicmuroq requested a review from CMGS March 19, 2021 05:37
@@ -452,6 +452,7 @@ message DeployOptions {
repeated string after_create = 22;
bytes raw_args = 23;
ResourceOptions resource_opts = 24;
repeated string excluded_nodenames = 25;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

似乎可以通用化一点, 引入一个类型 NodeFilter, 以后好扩展

@tonicmuroq
Copy link
Contributor Author

我就想偷个懒你们... 好吧

@CMGS
Copy link
Contributor

CMGS commented Mar 19, 2021 via email

@CMGS
Copy link
Contributor

CMGS commented Mar 21, 2021 via email

@tonicmuroq
Copy link
Contributor Author

updated, 有空看看吧 @CMGS @jschwinger23

types/options.go Outdated
@@ -22,7 +23,7 @@ type DeployOptions struct {
Debug bool // debug mode, use syslog as log driver
OpenStdin bool // OpenStdin for workload
Labels map[string]string // Labels for workloads
NodeLabels map[string]string // NodeLabels for filter node
NodeLabels map[string]string // NodeLabels for filter node, DEPRECATED, use NodeFilter instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't care about the compatibility, can remove it!

@CMGS CMGS merged commit 41c527b into master Mar 23, 2021
@CMGS CMGS deleted the add-exclude-nodenames branch March 23, 2021 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants