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

Change return type of AggregatedListNetworkEndpointGroup in cloudprovideradapter. #938

Merged
merged 2 commits into from
Nov 14, 2019

Conversation

prameshj
Copy link
Contributor

No description provided.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 13, 2019
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 13, 2019
@prameshj prameshj changed the title Change return type of AggregatedListNetworkEndpoint Change return type of AggregatedListNetworkEndpointGroup in cloudprovideradapter. Nov 13, 2019
@prameshj
Copy link
Contributor Author

/assign @freehan

This implements the review comment in
#926 (comment)

@@ -255,17 +255,23 @@ func (manager *syncerManager) garbageCollectSyncer() {
func (manager *syncerManager) garbageCollectNEG() error {
// Retrieve aggregated NEG list from cloud
// Compare against svcPortMap and Remove unintended NEGs by best effort
zoneNEGList, err := manager.cloud.AggregatedListNetworkEndpointGroup(meta.VersionGA)
NEGList, err := manager.cloud.AggregatedListNetworkEndpointGroup(meta.VersionGA)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: negList

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

}
negNames := map[string]string{}
for key, neg := range NEGList {
if key.Type() == meta.Global {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do this instead?

if key.Type() != meta.Zonal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

if manager.namer.IsNEG(neg.Name) {
negNames.Insert(neg.Name)
}
negNames := map[string]string{}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think negName->zone is not enough.

there may be multiple NEGs with the same name in multiple zones.

// negName -> zones
deleteCandidates := map[string][]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.

Good point, added this and a test case.

continue
}
if manager.namer.IsNEG(neg.Name) {
negNames[neg.Name] = key.Zone
Copy link
Contributor

Choose a reason for hiding this comment

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

if _, ok := deleteCandidates[key.Name]; !ok {
   deleteCandidates[key.Name] = []string{}
}
deleteCandidates[key.Name] = deleteCandidates[key.Name].append(key.Zone)


Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@freehan freehan left a comment

Choose a reason for hiding this comment

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

LGTM
just one nit.

for _, neg := range list {
if manager.namer.IsNEG(neg.Name) {
negNames.Insert(neg.Name)
deleteCandidates := map[string][]string{}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add a comment
// deleteCandidates is a map from neg name to list of zones it is in.

@freehan
Copy link
Contributor

freehan commented Nov 14, 2019

/lgtm

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

freehan commented Nov 14, 2019

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: freehan, prameshj

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 14, 2019
@k8s-ci-robot k8s-ci-robot merged commit 845a5e1 into kubernetes:master Nov 14, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants