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

Pass k8s Service data through to the TCP balancer script. #3615

Merged
merged 2 commits into from
Jan 3, 2019

Conversation

kppullin
Copy link
Contributor

@kppullin kppullin commented Jan 2, 2019

What this PR does / why we need it:

Fixes broken L4 ExternalName services.

The tcp_udp_balancer.lua script checks if the property
backend.service.spec["type"] equals "ExternalName". If so,
the script does a DNS lookup on the name in order to configure
the backend configuration.

However, before this commit, the k8s Service data was
not set on the Backend struct passed into the tcp_udp_balancer.lua
script and therefore the ExternalName check always returned false.

This commit fixes the issue by setting the Service field on
the Backend struct. This also requires adding a new field to the
L4Backend struct, so that it's available to set on the Backend.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 2, 2019
Fixes broken L4 ExternalName services.

Details
---------

The `tcp_udp_balancer.lua` script checks if the property
`backend.service.spec["type"]` equals "ExternalName".  If so,
the script does a DNS lookup on the name in order to configure
the backend configuration.

However, before this commit, the k8s `Service` data was
_not_ set on the `Backend` struct passed into the `tcp_udp_balancer.lua`
script and therefore the ExternalName check always returned false.

This commit fixes the issue by setting the `Service` field on
the `Backend` struct. This also requires adding a new field to the
`L4Backend` struct first, so that it's available to set on the `Backend`.
@kppullin kppullin force-pushed the fix-l4-external-names branch from f7a4558 to f0173f0 Compare January 2, 2019 04:51
@@ -829,6 +830,7 @@ func configureDynamically(pcfg *ingress.Configuration, port int, isDynamicCertif
Name: key,
Endpoints: ep.Endpoints,
Port: intstr.FromInt(ep.Port),
Service: ep.Service,
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the callout @ElvinEfendi. I've addressed this in the latest commit.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 2, 2019
@ElvinEfendi
Copy link
Member

/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 Jan 3, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ElvinEfendi, kppullin

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 Jan 3, 2019
@ElvinEfendi
Copy link
Member

Thanks @kppullin !

Would be more complete to create an e2e test for this to make sure ExternalName works in stream mode.

@k8s-ci-robot k8s-ci-robot merged commit c62dc22 into kubernetes:master Jan 3, 2019
@kppullin kppullin deleted the fix-l4-external-names branch January 22, 2019 17:37
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.

4 participants