-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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: handle errors in xds_client #3658
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,11 +88,20 @@ func (c *Client) newLDSUpdate(d map[string]ldsUpdate) { | |
c.ldsCache[name] = update | ||
} | ||
} | ||
// TODO: handle removing resources, which means if a resource exists in the | ||
// previous update, but not in the new update. This needs the balancers and | ||
// resolvers to handle errors correctly. | ||
|
||
// TODO: remove item from cache and remove corresponding RDS cached data. | ||
for name := range c.ldsCache { | ||
if _, ok := d[name]; !ok { | ||
// If resource exists in cache, but not in the new update, delete it | ||
// from cache, and also send an resource not found error to indicate | ||
// resource removed. | ||
delete(c.ldsCache, name) | ||
for wi := range c.ldsWatchers[name] { | ||
wi.resourceNotFound() | ||
} | ||
} | ||
} | ||
// When LDS resource is removed, we don't delete corresponding RDS cached | ||
// data. The RDS watch will be canceled, and cache is removed when the last | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/cache/cache entry/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
// watch is canceled. | ||
} | ||
|
||
// newRDSUpdate is called by the underlying xdsv2Client when it receives an xDS | ||
|
@@ -135,11 +144,20 @@ func (c *Client) newCDSUpdate(d map[string]ClusterUpdate) { | |
c.cdsCache[name] = update | ||
} | ||
} | ||
// TODO: handle removing resources, which means if a resource exists in the | ||
// previous update, but not in the new update. This needs the balancers and | ||
// resolvers to handle errors correctly. | ||
|
||
// TODO: remove item from cache and remove corresponding EDS cached data. | ||
for name := range c.cdsCache { | ||
if _, ok := d[name]; !ok { | ||
// If resource exists in cache, but not in the new update, delete it | ||
// from cache, and also send an resource not found error to indicate | ||
// resource removed. | ||
delete(c.cdsCache, name) | ||
for wi := range c.cdsWatchers[name] { | ||
wi.resourceNotFound() | ||
} | ||
} | ||
} | ||
// When CDS resource is removed, we don't delete corresponding EDS cached | ||
// data. The EDS watch will be canceled, and cache is removed when the last | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
// watch is canceled. | ||
} | ||
|
||
// newEDSUpdate is called by the underlying xdsv2Client when it receives an xDS | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a better variable name for
d
whose scope has now gotten bigger.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to
updates