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

NEG Namedport Fix #917

Merged
merged 1 commit into from
Nov 5, 2019
Merged

NEG Namedport Fix #917

merged 1 commit into from
Nov 5, 2019

Conversation

freehan
Copy link
Contributor

@freehan freehan commented Oct 26, 2019

Fixes: #832

  • Introduce Port Tuple for service port
  • Refactor NegSyncerKey to include portTuple
  • Use service port name to retrieve wanted endpoints instead of target port.
  • adjust all existing unit test to work with it

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 26, 2019
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 26, 2019
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 30, 2019
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 31, 2019
@freehan freehan changed the title WIP: NEG Namedport Fix NEG Namedport Fix Oct 31, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 31, 2019
@freehan freehan force-pushed the namedport-fix branch 2 times, most recently from 5033005 to 49b138d Compare October 31, 2019 23:14
Copy link
Member

@MrHohn MrHohn left a comment

Choose a reason for hiding this comment

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

Discussed offline with @freehan and have scanned through the change but didn't spot any obvious mistake.
/lgtm
Holding this so it is up to @freehan to merge if he feels ready.
/hold

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Nov 5, 2019
// TargetPort is the target port of the service port
// This can be port number or a named port
TargetPort string
// Tuple is port tuple of a service.
Copy link
Member

Choose a reason for hiding this comment

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

Tuple -> PortTuple

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed


// Get returns the SvcPortTuple with matching svc port if found
func (set SvcPortTupleSet) Get(svcPort int32) (SvcPortTuple, bool) {
for tuple := range set {
Copy link
Member

Choose a reason for hiding this comment

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

Would there be any concern for this operation being O(N)?

Copy link
Member

Choose a reason for hiding this comment

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

Assuming SvcPortTupleSet's scope is for all neg enabled services - would there be a possibility for conflicting svcPort?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One SvcPortTupleSet is usually extracted from one service. It was not used to store SvcPortTuple for multiple services.

So I guess it should not be too much a concern for efficiency. Also, Service Spec sort of guarantee uniqueness.

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

freehan commented Nov 5, 2019

Added more unit test cases.

/hold cancel

@MrHohn
Copy link
Member

MrHohn commented Nov 5, 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 5, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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

@freehan freehan removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 5, 2019
@k8s-ci-robot k8s-ci-robot merged commit 2351e2b into kubernetes:master Nov 5, 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/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.

GCE Ingress creates a Network Endpoint Group with 0 configured
3 participants