upgrade to latest dependencies (#423)

bumping knative.dev/pkg ca02ef7...6045ed4:
  > 6045ed4 Allow setting DisableCompression in NewAutoTransport (# 2007)
bumping knative.dev/hack 8d623a0...8368e1f:
  > 8368e1f guard against set -o unset (# 49)
  > 2b4f6fc disable go's proxy and sumdb only for knative deps (# 47)

Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
knative-automation 2021-02-04 09:07:11 -08:00 committed by GitHub
parent 77bb7df833
commit 77321844ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 22 deletions

4
go.mod
View File

@ -17,6 +17,6 @@ require (
k8s.io/client-go v0.19.7
k8s.io/code-generator v0.19.7
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6
knative.dev/hack v0.0.0-20210120165453-8d623a0af457
knative.dev/pkg v0.0.0-20210130001831-ca02ef752ac6
knative.dev/hack v0.0.0-20210203173706-8368e1f6eacf
knative.dev/pkg v0.0.0-20210203171706-6045ed499615
)

6
go.sum
View File

@ -1187,8 +1187,10 @@ k8s.io/utils v0.0.0-20200729134348-d5654de09c73 h1:uJmqzgNWG7XyClnU/mLPBWwfKKF1K
k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
knative.dev/hack v0.0.0-20210120165453-8d623a0af457 h1:jEBITgx/lQydGncM0uetpv/ZqawRzb2aSfEaYoMeDjM=
knative.dev/hack v0.0.0-20210120165453-8d623a0af457/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/pkg v0.0.0-20210130001831-ca02ef752ac6 h1:HIACRvhv/4U7vcFTAakfqYJIlENCSGtTrZOwz/q/A00=
knative.dev/pkg v0.0.0-20210130001831-ca02ef752ac6/go.mod h1:X4NPrCo8NK3hbDVan9Vm7mf5io3ZoINakAdrpSXVB08=
knative.dev/hack v0.0.0-20210203173706-8368e1f6eacf h1:u4cY4jr2LYvhoz/1HBWEPsMiLkm0HMdDTfmmw1RE8zE=
knative.dev/hack v0.0.0-20210203173706-8368e1f6eacf/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/pkg v0.0.0-20210203171706-6045ed499615 h1:Ee0n+axzrQXWkJfGl91B5RRmB25R1plTfC7MDw3NxUU=
knative.dev/pkg v0.0.0-20210203171706-6045ed499615/go.mod h1:X4NPrCo8NK3hbDVan9Vm7mf5io3ZoINakAdrpSXVB08=
pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=

View File

@ -539,7 +539,8 @@ function go_update_deps() {
export GO111MODULE=on
export GOFLAGS=""
export GOSUMDB=off # Do not use the sum.golang.org service.
export GONOSUMDB="${GONOSUMDB:-},knative.dev/*"
export GONOPROXY="${GONOPROXY:-},knative.dev/*"
echo "=== Update Deps for Golang"
@ -559,16 +560,6 @@ function go_update_deps() {
if [[ $UPGRADE == 1 ]]; then
group "Upgrading to ${VERSION}"
# From shell parameter expansion:
# ${parameter:+word}
# If parameter is null or unset, nothing is substituted, otherwise the expansion of word is substituted.
# -z is if the length of the string, so skip setting GOPROXY if GOPROXY is already set.
if [[ -z ${GOPROXY:+skip} ]]; then
export GOPROXY=direct
echo "Using 'GOPROXY=direct'."
else
echo "Respecting 'GOPROXY=${GOPROXY}'."
fi
FLOATING_DEPS+=( $(run_go_tool knative.dev/test-infra/buoy buoy float ${REPO_ROOT_DIR}/go.mod --release ${VERSION} --domain ${DOMAIN}) )
if [[ ${#FLOATING_DEPS[@]} > 0 ]]; then
echo "Floating deps to ${FLOATING_DEPS[@]}"

View File

@ -41,8 +41,13 @@ func NewServer(addr string, h http.Handler) *http.Server {
// to explicitly allow h2c (http2 without TLS) transport.
// See https://github.com/golang/go/issues/14141 for more details.
func NewH2CTransport() http.RoundTripper {
return newH2CTransport(false)
}
func newH2CTransport(disableCompression bool) http.RoundTripper {
return &http2.Transport{
AllowHTTP: true,
AllowHTTP: true,
DisableCompression: disableCompression,
DialTLS: func(netw, addr string, _ *tls.Config) (net.Conn, error) {
return DialWithBackOff(context.Background(),
netw, addr)

View File

@ -94,13 +94,14 @@ func dialBackOffHelper(ctx context.Context, network, address string, bo wait.Bac
return nil, fmt.Errorf("timed out dialing after %.2fs", elapsed.Seconds())
}
func newHTTPTransport(disableKeepAlives bool, maxIdle, maxIdlePerHost int) http.RoundTripper {
func newHTTPTransport(disableKeepAlives, disableCompression bool, maxIdle, maxIdlePerHost int) http.RoundTripper {
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.DialContext = DialWithBackOff
transport.DisableKeepAlives = disableKeepAlives
transport.MaxIdleConns = maxIdle
transport.MaxIdleConnsPerHost = maxIdlePerHost
transport.ForceAttemptHTTP2 = false
transport.DisableCompression = disableCompression
return transport
}
@ -108,7 +109,7 @@ func newHTTPTransport(disableKeepAlives bool, maxIdle, maxIdlePerHost int) http.
// since it will not cache connections.
func NewProberTransport() http.RoundTripper {
return newAutoTransport(
newHTTPTransport(true /*disable keep-alives*/, 0, 0 /*no caching*/),
newHTTPTransport(true /*disable keep-alives*/, false /*disable auto-compression*/, 0, 0 /*no caching*/),
NewH2CTransport())
}
@ -116,8 +117,17 @@ func NewProberTransport() http.RoundTripper {
// based on the request's HTTP version.
func NewAutoTransport(maxIdle, maxIdlePerHost int) http.RoundTripper {
return newAutoTransport(
newHTTPTransport(false /*disable keep-alives*/, maxIdle, maxIdlePerHost),
NewH2CTransport())
newHTTPTransport(false /*disable keep-alives*/, false /*disable auto-compression*/, maxIdle, maxIdlePerHost),
newH2CTransport(false /*disable auto-compression*/))
}
// NewProxyAutoTransport creates a RoundTripper suitable for use by a reverse
// proxy. The returned transport uses HTTP or H2C based on the request's HTTP
// version. The transport has DisableCompression set to true.
func NewProxyAutoTransport(maxIdle, maxIdlePerHost int) http.RoundTripper {
return newAutoTransport(
newHTTPTransport(false /*disable keep-alives*/, true /*disable auto-compression*/, maxIdle, maxIdlePerHost),
newH2CTransport(true /*disable auto-compression*/))
}
// AutoTransport uses h2c for HTTP2 requests and falls back to `http.DefaultTransport` for all others

4
vendor/modules.txt vendored
View File

@ -654,10 +654,10 @@ k8s.io/kube-openapi/pkg/util/sets
k8s.io/utils/buffer
k8s.io/utils/integer
k8s.io/utils/trace
# knative.dev/hack v0.0.0-20210120165453-8d623a0af457
# knative.dev/hack v0.0.0-20210203173706-8368e1f6eacf
## explicit
knative.dev/hack
# knative.dev/pkg v0.0.0-20210130001831-ca02ef752ac6
# knative.dev/pkg v0.0.0-20210203171706-6045ed499615
## explicit
knative.dev/pkg/apis
knative.dev/pkg/apis/duck