Skip to content

Commit

Permalink
Review comments #2.
Browse files Browse the repository at this point in the history
  • Loading branch information
easwars committed Mar 4, 2020
1 parent fe7abec commit 6202967
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions balancer/rls/internal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@ func (*rlsBB) ParseConfig(c json.RawMessage) (serviceconfig.LoadBalancingConfig,
if cfgJSON.ChildPolicyConfigTargetFieldName == "" {
return nil, fmt.Errorf("rls: childPolicyConfigTargetFieldName field is not set in service config {%+v}", string(c))
}
// TODO(easwars): When we start instantiating the child policy from the
// parent RLS LB policy, we could make this function a method on the
// lbConfig object and share the code. We would be parsing the child policy
// config again during that time. The only difference betweeen now and then
// would be that we would be using real targetField name instead of the
// dummy. So, we could make the targetName field a parameter to this
// function during the refactor.
cpCfg, err := validateChildPolicyConfig(childPolicy, cfgJSON.ChildPolicyConfigTargetFieldName)
if err != nil {
return nil, err
Expand All @@ -232,9 +239,15 @@ func (*rlsBB) ParseConfig(c json.RawMessage) (serviceconfig.LoadBalancingConfig,
staleAge: staleAge,
cacheSizeBytes: cacheSizeBytes,
rpStrategy: rpStrategy,
cpName: childPolicy.Name,
cpTargetField: cfgJSON.ChildPolicyConfigTargetFieldName,
cpConfig: cpCfg,
// TODO(easwars): Once we refactor validateChildPolicyConfig and make
// it a method on the lbConfig object, we could directly store the
// balancer.Builder and/or balancer.ConfigParser here instead of the
// Name. That would mean that we would have to create the lbConfig
// object here first before validating the childPolicy config, but
// that's a minor detail.
cpName: childPolicy.Name,
cpTargetField: cfgJSON.ChildPolicyConfigTargetFieldName,
cpConfig: cpCfg,
}, nil
}

Expand Down

0 comments on commit 6202967

Please sign in to comment.