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

xds: add new fields to XDSConfig #3100

Merged
merged 4 commits into from Nov 5, 2019

Conversation

menghanl
Copy link
Contributor

Fields are added in: grpc/grpc-proto#64

Other changes:

  • Move XDSConfig from internal to balancer
    • Later we will add a separate config for CDS balancer
  • generate service_config.pb.go and test with json generated from proto message

@menghanl menghanl added this to the 1.25 Release milestone Oct 15, 2019
@menghanl menghanl force-pushed the xds_service_config_new_fields branch from 63e2717 to d5e08e8 Compare October 15, 2019 21:16
@dfawley dfawley self-requested a review October 31, 2019 20:08
@menghanl menghanl force-pushed the xds_service_config_new_fields branch 3 times, most recently from 9071527 to 0db4b77 Compare November 1, 2019 16:59
@menghanl menghanl assigned dfawley and unassigned menghanl Nov 1, 2019
scpb "google.golang.org/grpc/internal/proto/grpc_service_config"
)

// TestExampleMarshalToJSON is an example to print json format of xds_config.
Copy link
Member

Choose a reason for hiding this comment

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

Name doesn't match. I thought this was going to be an example without verification?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Name fixed.

Examples don't output anything. Tests can print the json (to be copied or modified).

// When unmarshalling, we iterate through the childPolicy/fallbackPolicy lists
// and select the first LB policy which has been registered.
func (l *XDSConfig) UnmarshalJSON(data []byte) error {
var val map[string]json.RawMessage
Copy link
Member

Choose a reason for hiding this comment

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

Optional, may not be worth it: would it be easier to define the literal struct, Unmarshal into it, and then post-process:

type xdsConfigJSON struct {
  BalancerName string
  ChildPolicy []*loadBalancingConfig
  FallbackPolicy []*loadBalancingConfig
  EDSServiceName string
  LRSLoadReportingServerName 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.

This is a bit cleaner. Done


// MarshalJSON returns a JSON encoding of l.
func (l *XDSConfig) MarshalJSON() ([]byte, error) {
return nil, nil
Copy link
Member

Choose a reason for hiding this comment

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

Should this return an unimplemented error or grpclog.Fatal() instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Return an error now.

@dfawley dfawley assigned menghanl and unassigned dfawley Nov 4, 2019
[xds_service_config_new_fields] fix underscore in package name

[xds_service_config_new_fields] misspell

[xds_service_config_new_fields] 1

[xds_service_config_new_fields] use xdsconfig.EdsServiceName if not empty
@menghanl menghanl force-pushed the xds_service_config_new_fields branch from 0db4b77 to da20f2e Compare November 4, 2019 21:08
@menghanl menghanl force-pushed the xds_service_config_new_fields branch from d126389 to a9777d3 Compare November 4, 2019 21:29
@menghanl menghanl assigned dfawley and unassigned menghanl Nov 4, 2019
@dfawley dfawley assigned menghanl and unassigned dfawley Nov 4, 2019
@menghanl menghanl merged commit b09352f into grpc:master Nov 5, 2019
@menghanl menghanl deleted the xds_service_config_new_fields branch November 5, 2019 17:17
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants