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

Add support for Port to BackendConfig HealthCheckConfig #1092

Merged
merged 1 commit into from
May 20, 2020

Conversation

spencerhance
Copy link
Contributor

@spencerhance spencerhance commented May 2, 2020

Wires in support to override the Port of a HealthCheck via BackendConfig.
This also forces the PortSpecification to be "USE_FIXED_PORT" regardless
of what type the health check is (e.g. neg, ilb etc.)

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 2, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @spencerhance. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 2, 2020
@k8s-ci-robot k8s-ci-robot requested review from bowei and thockin May 2, 2020 00:10
@bowei
Copy link
Member

bowei commented May 2, 2020

/ok-to-test

this may not be sufficient -- you will need to change the type if it is a network endpoint (part of NEG)

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 2, 2020
@spencerhance spencerhance force-pushed the bc-hc-port branch 3 times, most recently from 4eb8d72 to 0104144 Compare May 4, 2020 20:18
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 4, 2020
@spencerhance spencerhance force-pushed the bc-hc-port branch 2 times, most recently from 508181f to dc0c4ab Compare May 5, 2020 02:12
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 5, 2020
@spencerhance
Copy link
Contributor Author

@bowei updated with USE_FIXED_PORT. Tested in a sandbox but adding an e2e-test will take a few changes to the test setup.

@bowei
Copy link
Member

bowei commented May 5, 2020

can you beef up the commit message describing this change and what functionality it is adding (copy paste into github pr desc as well)

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 5, 2020
@spencerhance
Copy link
Contributor Author

@bowei Please take another look when you get a chance

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.

Did you check the behavior for IG and NEG-based LBs?

pkg/apis/backendconfig/v1/types.go Outdated Show resolved Hide resolved
pkg/healthchecks/healthcheck.go Show resolved Hide resolved
@spencerhance
Copy link
Contributor Author

@bowei Ready for another review

@rramkumar1
Copy link
Contributor

@spencerhance Is there an e2e test to go along with this?

@spencerhance
Copy link
Contributor Author

@rramkumar1 Added to the e2e test case

@@ -52,6 +52,7 @@ func TestHealthCheck(t *testing.T) {
TimeoutSec: pint64(3),
HealthyThreshold: pint64(3),
UnhealthyThreshold: pint64(5),
Port: pint64(100),
Copy link
Contributor

Choose a reason for hiding this comment

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

How would this pass? Wouldn't the health checks fail unless the application is serving something on this port?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test passes when I run it locally, I believe we don't actually check for the health check to work, only that it matches the specified config

Copy link
Contributor

Choose a reason for hiding this comment

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

But you call e2e.WaitForIngress() below which verifies the VIP returns a 200 right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I'm totally sure why it's passing. I updated the test so that there's a second test for port that uses negs and updates the port on the service as well. That should give a much clearer signal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rramkumar1 Updated the test again, should be more clear and is passing locally

@spencerhance spencerhance force-pushed the bc-hc-port branch 4 times, most recently from f3d3a39 to 9f83d6a Compare May 19, 2020 20:47
Wire in support to override the Port of a HealthCheck via BackendConfig.
This also forces the PortSpecification to be "USE_FIXED_PORT" regardless
of what type the health check is (e.g. neg, ilb etc.)
@rramkumar1
Copy link
Contributor

@spencerhance I'll LGTM this for now, but I also think we need a test case that configures the health check on a different port from the application port. For example, the app is serving on 8080 but we point the health check to 8081.

We can modify the test code to use the new zoneprinter app (gcr.io/google-samples/gcp-zoneprinter:0.2 ) which allows for customizing the HC port from args.

@rramkumar1
Copy link
Contributor

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rramkumar1, spencerhance

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 May 20, 2020
@k8s-ci-robot k8s-ci-robot merged commit e7083ff into kubernetes:master May 20, 2020
@spencerhance spencerhance deleted the bc-hc-port branch May 20, 2020 21:15
@spencerhance
Copy link
Contributor Author

@rramkumar1 Thanks! That sgtm. I submitted a cherry-pick to release-1.9 here #1108

k8s-ci-robot added a commit that referenced this pull request May 21, 2020
Cherry-Pick #1092 [Add support for Port to BackendConfig HealthCheckConfig] to release-1.9
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants