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 http response code 301 and 503 to check. #81347

Merged
merged 1 commit into from Aug 16, 2019

Conversation

@jfbai
Copy link
Contributor

commented Aug 13, 2019

What type of PR is this?

/kind bug

What this PR does / why we need it:

Retry-After header would be used in 301 and 503, these should be checked as well

Which issue(s) this PR fixes:

xref #81143

Special notes for your reviewer:

This PR just fix one bug (No.3) mentioned in the issue.

  1. strconv.Atoi uses strconv.ParseInt, which has edge cases for parser failures, which will return MAXINT for values too large and zero for values that fail to parse as integers.
  2. linkcheck does not set an explicit redirect policy via CheckRedirect, meaning that Go’s core HTTP library will follow redirects. While linkcheck has a whitelist for URLs, redirects are not checked against the whitelist.
  3. The Retry-After response header is used only in the case of “Too many Requests” (HTTP status code 429). However, the Retry-After header may also be returned with both 301 (Redirect) and 503 (Service Unavailable) status codes as well.

Does this PR introduce a user-facing change?:

None

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

None
@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Aug 13, 2019

Hi @jfbai. 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 requested review from lavalamp and mikedanese Aug 13, 2019

@Zyqsempai
Copy link
Contributor

left a comment

LGTM

@jfbai

This comment has been minimized.

Copy link
Contributor Author

commented Aug 15, 2019

ping @liggitt @mikedanese to review, thanks a lot. :)

if resp.StatusCode == http.StatusTooManyRequests {
// This header is used in 301, 429 and 503.
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
if resp.StatusCode == http.StatusTooManyRequests || resp.StatusCode == http.StatusMovedPermanently || resp.StatusCode == http.StatusServiceUnavailable {

This comment has been minimized.

Copy link
@mikedanese

mikedanese Aug 15, 2019

Member

Go client will follow redirects automatically so the 301 check is probably unnecessary.

This comment has been minimized.

Copy link
@jfbai

jfbai Aug 15, 2019

Author Contributor

Thanks a lot, Fixed.

@jfbai jfbai force-pushed the jfbai:tob-k8s-003 branch from 0513809 to 1d75a16 Aug 15, 2019

@mikedanese

This comment has been minimized.

Copy link
Member

commented Aug 15, 2019

/lgtm
/approve

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Aug 15, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jfbai, mikedanese

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

@jfbai

This comment has been minimized.

Copy link
Contributor Author

commented Aug 16, 2019

/sig release

@k8s-ci-robot k8s-ci-robot added sig/release and removed needs-sig labels Aug 16, 2019

@k8s-ci-robot k8s-ci-robot merged commit b0dbdbe into kubernetes:master Aug 16, 2019

23 checks passed

cla/linuxfoundation jfbai authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-conformance-image-test Skipped.
pull-kubernetes-cross Skipped.
pull-kubernetes-dependencies Job succeeded.
Details
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-csi-serial Skipped.
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gce-iscsi Skipped.
pull-kubernetes-e2e-gce-iscsi-serial Skipped.
pull-kubernetes-e2e-gce-storage-slow Skipped.
pull-kubernetes-godeps Skipped.
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped.
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-node-e2e-containerd Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
pull-publishing-bot-validate Skipped.
tide In merge pool.
Details

@k8s-ci-robot k8s-ci-robot added this to the v1.16 milestone Aug 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.