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

tolerate non zonal NEG included in the AggregatedList API response #820

Merged
merged 1 commit into from
Aug 12, 2019

Conversation

freehan
Copy link
Contributor

@freehan freehan commented Aug 9, 2019

Will send a follow up PR to switch to use meta.scope as key.

This PR is mostly for simple cherry-pick

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 9, 2019
Copy link
Member

@bowei bowei left a 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
Copy link
Member

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" {
Copy link
Member

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
Copy link
Member

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?

Copy link
Member

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, "/")
Copy link
Member

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
Copy link
Member

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

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 9, 2019
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 9, 2019
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)
Copy link
Member

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
}

@bowei
Copy link
Member

bowei commented Aug 12, 2019

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 12, 2019
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit f3e8bad into kubernetes:master Aug 12, 2019
k8s-ci-robot added a commit that referenced this pull request Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants