optiopay / klar

Integration of Clair and Docker Registry
MIT License
507 stars 140 forks source link

Longer timeout #81

Closed agius closed 6 years ago

agius commented 6 years ago

Oh, whoops, didn't mean to PR to the main repo. I don't know go, have no clue what I'm doing, but I keep getting timeout errors when trying to push a layer to Clair. A timeout of one minute seems a little low, and there appears to be no way to configure it.

Failed to analyze using API v1: push image https://<redacted>.ecr.us-east-1.amazonaws.com/v2/my-repo:123abc456def789 to Clair failed: can't push layer to Clair: Post http://clair:6060/v1/layers: net/http: request canceled (Client.Timeout exceeded while awaiting headers)

I'm experimenting on my branch to see if increasing the timeout (or setting to 0 for "no timeouts plz") actually fixes my issue, or if it's a red herring. If this fixes my issue I'll figure out how to make the timeout configurable, update the PR and ping for a code review.

hashmap commented 6 years ago

Np. Btw I see you are struggling with with forking go projects and as result had to use relative imports. We all been there. Here is a better way:

agius commented 6 years ago

@hashmap w00t, thanks for the tips! My situation was a bit more complicated, since I was trying to get this to run in a Docker container and working locally with Clair via docker-compose .

My Dockerfile for klar would clone my fork & branch, but it would still require me to go get this repo, and go build was still using the Timeout configuration from here instead of on my branch.

I tried changing all the imports to github.com/agius/klar/etc , but it was still downloading & using optiopay/klar for reasons I couldn't figure out.

And then I started getting this:

clair/api.go:64: cannot use conn (type *"google.golang.org/grpc".ClientConn) as type *"github.com/coreos/clair/vendor/google.golang.org/grpc".ClientConn in argument to clairpb.NewAncestryServiceClient

which was like 😕

anyway, using relative imports I was able to clone my branch, skip the go get , move straight to go build -o klar ., and got it all working!

Thanks for the development here! Even with me blindly hacking at it, klar saved a ton of time & effort vs trying to learn protobuf, figuring out Clair's API, and writing my own adapter.

Cheers,