-
Notifications
You must be signed in to change notification settings - Fork 303
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
tolerate non zonal NEG included in the AggregatedList API response #820
Conversation
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.
where is the unit test
parts := strings.Split(key, "/") | ||
if len(parts) != 2 { | ||
return nil, fmt.Errorf("invalid key for AggregatedListNetworkEndpointGroup: %q", key) | ||
continue |
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.
we should log at level V(3)
return nil, fmt.Errorf("invalid key for AggregatedListNetworkEndpointGroup: %q", key) | ||
continue | ||
} | ||
if parts[0] != "zones" { |
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.
const? at the top
continue | ||
} | ||
if parts[0] != "zones" { | ||
continue |
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.
this should definitely be logged as a warning?
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.
warning
// zonal key is "zones/<zone name>" | ||
// regional key is "regions/<region name>" | ||
// global key is "global" | ||
// TODO: use meta.scope as key | ||
parts := strings.Split(key, "/") |
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.
log.V(4) the parts
@@ -72,10 +71,17 @@ func (a *cloudProviderAdapter) AggregatedListNetworkEndpointGroup() (map[string] | |||
} | |||
ret := map[string][]*compute.NetworkEndpointGroup{} | |||
for key, byZone := range all { | |||
// key is "zones/<zone name>" | |||
// key is scope |
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.
is there a documentation link
parts := strings.Split(key, "/") | ||
if len(parts) != 2 { | ||
return nil, fmt.Errorf("invalid key for AggregatedListNetworkEndpointGroup: %q", key) | ||
klog.V(4).Infof("Ignoring key %q from AggregatedListNetworkEndpointGroup response.", key) |
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.
let's do this to be more precise:
if len(parts) == 1 && parts[0] == "global" {
klog.V(4).Infof("Ignoring key %q as it is global", key)
continue
}
if len(parts) != 2 || parts[0] != aggregatedListZonalKeyPrefix {
klog.Warningf("Key %q is not in a known format, ignoring", key)
continue
}
… is included in the API response
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bowei, freehan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Will send a follow up PR to switch to use meta.scope as key.
This PR is mostly for simple cherry-pick