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

Restructure NEG controller #489

Merged
merged 1 commit into from
Sep 24, 2018

Conversation

freehan
Copy link
Contributor

@freehan freehan commented Sep 21, 2018

No functional changes. Only refactoring:

  • Created sub-package for /metrics and /syncer
  • Move common types and interfaces into /types
  • Rename syncer to batchSyncer

cc: @agau4779

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 21, 2018
@freehan freehan force-pushed the unblocking-syncer branch 2 times, most recently from f3381c0 to bd8019c Compare September 24, 2018 17:54
@@ -17,36 +17,15 @@ limitations under the License.
package neg
Copy link
Contributor

Choose a reason for hiding this comment

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

Does there need to be an interfaces file at all? Could the below types just live in neg/types and neg/syncer?

Copy link
Contributor Author

@freehan freehan Sep 24, 2018

Choose a reason for hiding this comment

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

All the interfaces here are internal interfaces for controller and manager.
The rest are shared or imported in some other packages.

type syncer struct {
servicePort
// batchSyncer handles synchorizing NEGs for one service port. It handles sync, resync and retry on error.
// It syncs NEG in batch and waits for all operation to complete before continue to the next batch.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is called batch because we're batch-processing multiple NetworkEndpoints right? Can we make a note of that?

Copy link
Contributor Author

@freehan freehan Sep 24, 2018

Choose a reason for hiding this comment

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

I could not think of a better name. Calling it batch just because it process the NEG changes in batch and wait for all operation to finish before continue.

@@ -46,25 +48,26 @@ const (
maxRetryDelay = 600 * time.Second
Copy link
Contributor

Choose a reason for hiding this comment

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

this should probably be a flag

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -25,14 +25,16 @@ import (
"time"

"github.com/golang/glog"
compute "google.golang.org/api/compute/v0.beta"
Copy link
Contributor

Choose a reason for hiding this comment

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

if we're removing the compute prefix here, we should do it for all files touched

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm. Not sure why this is removed accidentally. Will add it back.

Copy link
Contributor

@agau4779 agau4779 left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -438,3 +438,7 @@ func TraverseIngressBackends(ing *extensions.Ingress, process func(id ServicePor
}
return
}

func ServiceKeyFunc(namespace, name string) string {
Copy link
Member

Choose a reason for hiding this comment

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

docstring

@bowei
Copy link
Member

bowei commented Sep 24, 2018

/approve

@bowei
Copy link
Member

bowei commented Sep 24, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 24, 2018
@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

1 similar comment
@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 2b6d216 into kubernetes:master Sep 24, 2018
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants