Skip to content

Commit

Permalink
Merge pull request #62 from unmarshall/master
Browse files Browse the repository at this point in the history
Fix for Incorrect scaling down of KCM, MCM and CA due to broken TCP connection
  • Loading branch information
unmarshall authored Aug 2, 2022
2 parents d09ccc6 + da8d5ac commit f057fe5
Show file tree
Hide file tree
Showing 301 changed files with 21,257 additions and 9,213 deletions.
2 changes: 1 addition & 1 deletion .ci/check
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if [[ "${SOURCE_PATH}" != *"src/${REPOSITORY}" ]]; then
fi

# Install Golint (linting tool).
go get -u golang.org/x/lint/golint
go install golang.org/x/lint/golint@latest

###############################################################################

Expand Down
4 changes: 2 additions & 2 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ RUN make build

FROM gcr.io/distroless/static-debian11:nonroot

COPY --from=builder /go/src/github.com/gardener/dependency-watchdog/bin/dependency-watchdog /dependency-watchdog
COPY --from=builder /go/src/github.com/gardener/dependency-watchdog/bin/dependency-watchdog /usr/local/bin/dependency-watchdog
WORKDIR /
ENTRYPOINT ["/dependency-watchdog"]
ENTRYPOINT ["/usr/local/bin/dependency-watchdog"]
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ require (
github.com/prometheus/common v0.6.0 // indirect
github.com/prometheus/procfs v0.0.2 // indirect
github.com/sirupsen/logrus v1.4.2 // indirect
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6 // indirect
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
golang.org/x/tools v0.1.10 // indirect
golang.org/x/tools v0.1.12 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gomodules.xyz/jsonpatch/v2 v2.0.1 // indirect
google.golang.org/appengine v1.6.5 // indirect
Expand Down
23 changes: 22 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
Expand Down Expand Up @@ -522,8 +523,9 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 h1:/Tl7pH94bvbAAHBdZJT947M/+gp0+CqQXDtMRC0fseo=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand All @@ -550,6 +552,8 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o=
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -579,8 +583,11 @@ golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand All @@ -592,6 +599,7 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -627,13 +635,24 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200317113312-5766fd39f98d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -680,6 +699,8 @@ golang.org/x/tools v0.0.0-20200408032209-46bd65c8538f/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20200422205258-72e4a01eba43/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20=
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
30 changes: 30 additions & 0 deletions pkg/scaler/httputil.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package scaler

import (
"k8s.io/client-go/rest"
"net/http"
)

// DisableKeepAlive sets `DisableKeepAlive` to true on the transport that is use by the underline rest client
// Fixes https://github.com/gardener/dependency-watchdog/issues/61
func DisableKeepAlive(config *rest.Config) error {
transport, err := createTransportWithDisableKeepAlive(config)
if err != nil {
return err
}
config.Wrap(func(rt http.RoundTripper) http.RoundTripper {
return transport
})
return nil
}

func createTransportWithDisableKeepAlive(config *rest.Config) (*http.Transport, error) {
tlsConfig, err := rest.TLSConfigFor(config)
if err != nil {
return nil, err
}
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.DisableKeepAlives = true
transport.TLSClientConfig = tlsConfig
return transport, nil
}
57 changes: 57 additions & 0 deletions pkg/scaler/httputil_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package scaler_test

import (
"github.com/gardener/dependency-watchdog/pkg/scaler"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"net/http"
)

var (
kubeConfig = `apiVersion: v1
kind: Config
clusters:
- cluster:
name: test
certificate-authority-date: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURvRENDQW9nQ0NRQ1NWMElyenhoaEdUQU5CZ2txaGtpRzl3MEJBUXNGQURDQmtERUxNQWtHQTFVRUJoTUMKUkVVeEdqQVlCZ05WQkFnTUVVSmhaR1Z1TFZkMWNuUjBaVzFpWlhKbk1SRXdEd1lEVlFRSERBaFhZV3hzWkc5eQpaakVQTUEwR0ExVUVDZ3dHVTBGUUlGTkZNUkV3RHdZRFZRUUxEQWhIWVhKa1pXNWxjakVQTUEwR0ExVUVBd3dHClkyRjBaWE4wTVIwd0d3WUpLb1pJaHZjTkFRa0JGZzVqWVhSbGMzUkFjMkZ3TG1OdmJUQWdGdzB5TWpBNE1ERXcKTmpRNU1qQmFHQTh6TURJeE1USXdNakEyTkRreU1Gb3dnWkF4Q3pBSkJnTlZCQVlUQWtSRk1Sb3dHQVlEVlFRSQpEQkZDWVdSbGJpMVhkWEowZEdWdFltVnlaekVSTUE4R0ExVUVCd3dJVjJGc2JHUnZjbVl4RHpBTkJnTlZCQW9NCkJsTkJVQ0JUUlRFUk1BOEdBMVVFQ3d3SVIyRnlaR1Z1WlhJeER6QU5CZ05WQkFNTUJtTmhkR1Z6ZERFZE1Cc0cKQ1NxR1NJYjNEUUVKQVJZT1kyRjBaWE4wUUhOaGNDNWpiMjB3Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQgpEd0F3Z2dFS0FvSUJBUURHaUFTNGJFVlFUMm1LM000TlFVaW1iRnRiRE5JU2NkdDNUWWpUcVk0WGZXd09vRXFnCjdyM2VnSFNoVEhxdGtqa1hqZjJJWW8yL05SL1gyelpmNFJHTWNORTc4RkhMdVQ2QkltNHdVTXdIMU9sWkY0R2cKRjRaT0cvckt3dlNOTndJUThhczRZbmo1d1lHUWpBaVZjRm5SUkNjajFGd2dnalpMQklzeVRNd1laV2EyWHRCbQpOL0lENHc0QkZ4T3NlZ3JhK1hSQWt4dm5SMCtOd0xHbkNjM1hWVGpTWEFzc1oraVdYMFozc1hIRFZQd3U0bTg0Cm9ocTVFbXFoZ21wQ0ZVOEYvSVBmRDFkektDTFZNWVdOQkJqSTBXSFQweHlLZTBlRXd5NFVVN0VNSGdMTU5EeXcKRnllRGt4L1UyRDZYK2RJaFpYOTh6d0NCdktvQlh2Q0ZsTzJaQWdNQkFBRXdEUVlKS29aSWh2Y05BUUVMQlFBRApnZ0VCQUdYM3Vod0xKSGxhNUU2UDBiUlA4QmJiZ25pUDB3VURydUw4RXJxZXZ0SWRZOW5MSFRXV05QcXFSVlQrCjRydFJ5b0ZZSGxzVm9ycE5wQ250RmhKYkJYM05hTGhFQjJlamROVmx3VXlVaUV6WktES09XN1I4YzY3czY0SE8Ka0dUTjJhcFV3TGhoNlZnVkFneHROdmp6dXo1QTRLM0pQV1I4emZYUzJZbVdNcVZIZ1plQi9UeFdyaTRXRkdUSgpmV2FtZVg4YlhXRFE3dWdBMnFlMkw3R1EycWxSaVN0THpsRm1yR1VKaUx0ZEZ0cnFEK0VHdmM4MTlDNUgxOURQClFYV1ZxanVndDJmTEFaMW56VmhsQWowT2lqQ29PbVZWdjl0ZUpCQVhyK1Fjc2RTc21vKzFuZTlpazJLak5oVzQKdk0xQklNajE4dmpaaWR5UDBvZitkODZnT0hFPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server: https://kube-apiserver.shoot--test--local.svc
contexts:
- context:
cluster: shoot--test--local
user: admin
name: shoot--test--local
users:
- name: admin
user:
username: admin
password: admin@bingo
`
)

var _ = Describe("Checking KeepAlive setting on rest.config", func() {
var config *rest.Config
BeforeEach(func() {
clientConfig, err := clientcmd.NewClientConfigFromBytes([]byte(kubeConfig))
Expect(err).To(BeNil())
config, err = clientConfig.ClientConfig()
Expect(err).To(BeNil())
})
It("defaults to KeepAlive enabled", func() {
roundTripper, err := rest.TransportFor(config)
Expect(err).To(BeNil())
transport := roundTripper.(*http.Transport)
Expect(transport).ToNot(BeNil())
Expect(transport.DisableKeepAlives).To(BeFalse())
})
It("can set KeepAlive to disabled", func() {
err := scaler.DisableKeepAlive(config)
Expect(err).To(BeNil())
roundTripper, err := rest.TransportFor(config)
Expect(err).To(BeNil())
t := roundTripper.(*http.Transport)
Expect(t).ToNot(BeNil())
Expect(t.DisableKeepAlives).To(BeTrue())
})
})
8 changes: 5 additions & 3 deletions pkg/scaler/prober.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (p *prober) getClientFromSecret(secretName string, oldSHA []byte) (kubernet
return nil, nil, errors.New("Invalid empty kubeconfig")
}

newSHAArr := (sha256.Sum256(kubeconfig))
newSHAArr := sha256.Sum256(kubeconfig)
newSHA := newSHAArr[:]
if reflect.DeepEqual(oldSHA, newSHA) {
return nil, nil, apierrors.NewAlreadyExists(schema.GroupResource{Resource: "secret"}, secretName)
Expand All @@ -159,9 +159,11 @@ func (p *prober) getClientFromSecret(secretName string, oldSHA []byte) (kubernet
if err != nil {
return nil, newSHA, err
}

err = DisableKeepAlive(config)
if err != nil {
return nil, newSHA, err
}
config.Timeout = toDuration(p.probeDeps.Probe.ProbeTimeoutSeconds, defaultProbeTimeoutSeconds)

client, err := kubernetes.NewForConfig(config)
return client, newSHA, err
}
Expand Down
4 changes: 2 additions & 2 deletions vendor/golang.org/x/crypto/chacha20/chacha_arm64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/golang.org/x/crypto/chacha20/chacha_arm64.s

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f057fe5

Please sign in to comment.