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

priority: add policy config parsing #3936

Merged
merged 4 commits into from
Oct 29, 2020

Conversation

menghanl
Copy link
Contributor

@menghanl menghanl commented Oct 7, 2020

No description provided.

Copy link
Contributor

@easwars easwars left a comment

Choose a reason for hiding this comment

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

These changes look good to me overall. But should this policy live under xds/internal.

The LB policy refactoring doc says the following:

Note that this policy is not xds-specific.  It does not interact with the XdsClient and 
contains no xds-specific code.  It is intended to be a generic policy that could be used in 
any non-xds context.

prioritiesSet := make(map[string]bool)
for _, name := range cfg.Priorities {
if _, ok := cfg.Children[name]; !ok {
return nil, fmt.Errorf("child name %v is not found in children %+v", name, cfg.Children)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the error message could be something like:

fmt.Errorf("LB policy name %q found in Priorities field (%v) is not found in Children field (%+v)", name, cfg.Priorities, cfg.Children)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}
for name := range cfg.Children {
if _, ok := prioritiesSet[name]; !ok {
return nil, fmt.Errorf("child with name %v is not used in priorities %+v", name, cfg.Children)
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment about this error string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@easwars easwars assigned menghanl and unassigned easwars Oct 8, 2020
Copy link
Contributor Author

@menghanl menghanl left a comment

Choose a reason for hiding this comment

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

Thanks for the review.

This is in xds/internal for the same reason that weighted_target is in xds/internal.
We will use these ourselves, for the xds policies first. When they are proved to work (and also we will be confident about their behavior), we will them out to an exported package.

prioritiesSet := make(map[string]bool)
for _, name := range cfg.Priorities {
if _, ok := cfg.Children[name]; !ok {
return nil, fmt.Errorf("child name %v is not found in children %+v", name, cfg.Children)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}
for name := range cfg.Children {
if _, ok := prioritiesSet[name]; !ok {
return nil, fmt.Errorf("child with name %v is not used in priorities %+v", name, cfg.Children)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@menghanl menghanl added the Type: Feature New features or improvements in behavior label Oct 21, 2020
@menghanl menghanl added this to the 1.34 Release milestone Oct 21, 2020
@menghanl menghanl assigned easwars and unassigned menghanl Oct 22, 2020
@easwars
Copy link
Contributor

easwars commented Oct 23, 2020

Thanks for the review.

This is in xds/internal for the same reason that weighted_target is in xds/internal.
We will use these ourselves, for the xds policies first. When they are proved to work (and also we will be confident about their behavior), we will them out to an exported package.

Can we then make that obvious in doc.go.

Copy link
Contributor

@easwars easwars left a comment

Choose a reason for hiding this comment

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

I think the changes are fine. Please just add some comments for my last set of review comments. Thank you.

type lbConfig struct {
serviceconfig.LoadBalancingConfig

Children map[string]*child
Copy link
Contributor

Choose a reason for hiding this comment

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

Also a comment here about the structure of the config would be useful so that one doesn't have to look at the design doc to understand that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@easwars easwars assigned menghanl and unassigned easwars Oct 23, 2020
@menghanl menghanl merged commit b045bc8 into grpc:master Oct 29, 2020
@menghanl menghanl deleted the priority_policy_config branch October 29, 2020 17:16
davidkhala pushed a commit to Hyperledger-TWGC/grpc that referenced this pull request Dec 7, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants