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

Update ggcr, use remote.Head #9442

Merged
merged 3 commits into from
Sep 17, 2020
Merged

Conversation

mattmoor
Copy link
Member

@mattmoor mattmoor commented Sep 16, 2020

Some additional context: https://knative.slack.com/archives/CDJ8M6R34/p1600293665001500

This is to pull in google/go-containerregistry#770 and enable the use of remote.Head, which bypasses the rate limiting that DockerHub is instituting.

Uses HEAD rather than GET for resolving image digests, which avoids counting image digest resolution against dockerhub pull quotas.

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Sep 16, 2020
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. area/API API objects and controllers approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 16, 2020
@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-serving-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/revision/resolve.go 95.5% 90.9% -4.5

@jonjohnsonjr
Copy link
Contributor

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 16, 2020
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 16, 2020
@mattmoor
Copy link
Member Author

I had to update the tests 😇

@jonjohnsonjr
Copy link
Contributor

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 16, 2020
Copy link
Contributor

@vagababov vagababov left a comment

Choose a reason for hiding this comment

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

/lgtm
/hold
if you wanna fix the nits

pkg/reconciler/revision/resolve_test.go Outdated Show resolved Hide resolved
pkg/reconciler/revision/resolve_test.go Outdated Show resolved Hide resolved
pkg/reconciler/revision/resolve_test.go Outdated Show resolved Hide resolved
pkg/reconciler/revision/resolve_test.go Outdated Show resolved Hide resolved
@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 16, 2020
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 17, 2020
@mattmoor
Copy link
Member Author

RFAL

@mattmoor
Copy link
Member Author

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 17, 2020
@vagababov
Copy link
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 17, 2020
@mattmoor
Copy link
Member Author

/retest

@mattmoor
Copy link
Member Author

This is a legit failure...

errorcondition_test.go:86: Reason: RevisionFailed; Message: Revision "container-error-msg-iggovilu-kpd7r" failed with message: Unable to fetch image "gcr.io/knative-boskos-84/serving-e2e-img/997/invalidhelloworld:latest": failed to resolve image to digest: HEAD https://gcr.io/v2/knative-boskos-84/serving-e2e-img/997/invalidhelloworld/manifests/latest: unsupported status code 404.; Status False

@mattmoor
Copy link
Member Author

/hold

So this is definitely breaking, it breaks with GCR. 🙃

@jonjohnsonjr ping me once a fix has been rolled out for the couple issues I sent you and we can /retest this, but this shouldn't land until early next release.

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 17, 2020
@knative-test-reporter-robot

The following jobs failed:

Test name Triggers Retries
pull-knative-serving-integration-tests 2020-09-17 02:15:04.923 +0000 UTC
2020-09-17 03:03:05.029 +0000 UTC
2020-09-17 03:52:05.006 +0000 UTC
2020-09-17 04:41:05.43 +0000 UTC
3/3

Job pull-knative-serving-integration-tests expended all 3 retries without success.

@julz
Copy link
Member

julz commented Sep 17, 2020

Should we add something to the release note in the description for this? Seems worth making sure we remember to mention

@jonjohnsonjr
Copy link
Contributor

I'd argue for just changing the test, or checking the status code in the resolver and setting the error to something stable based on that.

Per https://tools.ietf.org/html/rfc7231#section-4.3.2

The HEAD method is identical to GET except that the server MUST NOT
send a message body in the response (i.e., the response terminates at
the end of the header section). The server SHOULD send the same
header fields in response to a HEAD request as it would have sent if
the request had been a GET, except that the payload header fields
(Section 3.3) MAY be omitted. This method can be used for obtaining
metadata about the selected representation without transferring the
representation data and is often used for testing hypertext links for
validity, accessibility, and recent modification.

As far as I can tell from testing, both GCR and Docker Hub return an empty response body for HEAD requests.

I think checking the specific error message you get back from ggcr is going to be fragile, but you could consider looking for "404" too?

@jonjohnsonjr
Copy link
Contributor

Should we add something to the release note in the description for this? Seems worth making sure we remember to mention

+1

  1. If anyone is concerned about the rate limiting, seeing this is helpful (at least we don't make the situation worse).
  2. If this breaks against certain registries, having release notes can help identify the issue.

@mattmoor
Copy link
Member Author

As far as I can tell from testing, both GCR and Docker Hub return an empty response body for HEAD requests.

Actually one of the bugs I found last night is that GCR is returning a body with HEAD. Ack that the semantics of HEAD should be no body, but I guess that dogma on 4xx and 5xx status codes surprises me a bit.

@mattmoor
Copy link
Member Author

I added your release notes @julz (thanks!) 😉

@knative-prow-robot knative-prow-robot added area/test-and-release It flags unit/e2e/conformance/perf test issues for product features and removed lgtm Indicates that a PR is ready to be merged. labels Sep 17, 2020
@mattmoor
Copy link
Member Author

Changed it to look for a 404 instead, which is about the only useful information we get with this request type 🤷

@jonjohnsonjr
Copy link
Contributor

jonjohnsonjr commented Sep 17, 2020

Actually one of the bugs I found last night is that GCR is returning a body with HEAD. Ack that the semantics of HEAD should be no body, but I guess that dogma on 4xx and 5xx status codes surprises me a bit.

I couldn't repro this when I tried -- I can get the same curl error as you but I'm not sure that means there was a body?

$ curl -X HEAD https://gcr.io/v2/distroless/static/manifests/latest
Warning: Setting custom HTTP method to HEAD with -X/--request may not work the 
Warning: way you want. Consider using -I/--head instead.
curl: (18) transfer closed with 526 bytes remaining to read

Presumably, these warnings are exactly about this scenario. I would guess --head causes curl to interpret the content-length headers differently than just doing -X HEAD:

$ curl --head https://gcr.io/v2/distroless/static/manifests/latest
HTTP/2 200 
docker-distribution-api-version: registry/2.0
content-type: application/vnd.docker.distribution.manifest.v2+json
content-length: 526
docker-content-digest: sha256:08cce4d65b19780e10b555578a0f9c9af51310308ec31e648577122d40e6922a
date: Thu, 17 Sep 2020 18:33:36 GMT
server: Docker Registry
...

@jonjohnsonjr
Copy link
Contributor

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 17, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jonjohnsonjr, mattmoor

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

@mattmoor
Copy link
Member Author

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 17, 2020
@knative-prow-robot knative-prow-robot merged commit 4b0fdc6 into knative:master Sep 17, 2020
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. area/API API objects and controllers area/test-and-release It flags unit/e2e/conformance/perf test issues for product features cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants