diff --git a/go.mod b/go.mod index 6bbbe9e7230e..0800a4cf153d 100644 --- a/go.mod +++ b/go.mod @@ -103,7 +103,7 @@ replace ( k8s.io/kube-scheduler => github.com/openshift/kubernetes/staging/src/k8s.io/kube-scheduler v0.0.0-20210205160848-1fb0b6aa7392 k8s.io/kubectl => github.com/openshift/kubernetes/staging/src/k8s.io/kubectl v0.0.0-20210205160848-1fb0b6aa7392 k8s.io/kubelet => github.com/openshift/kubernetes/staging/src/k8s.io/kubelet v0.0.0-20210205160848-1fb0b6aa7392 - k8s.io/kubernetes => github.com/openshift/kubernetes v1.20.1-0.20210205160848-1fb0b6aa7392 + k8s.io/kubernetes => github.com/openshift/kubernetes v1.20.1-0.20210207150259-c3cfb813f909 k8s.io/legacy-cloud-providers => github.com/openshift/kubernetes/staging/src/k8s.io/legacy-cloud-providers v0.0.0-20210205160848-1fb0b6aa7392 k8s.io/metrics => github.com/openshift/kubernetes/staging/src/k8s.io/metrics v0.0.0-20210205160848-1fb0b6aa7392 k8s.io/mount-utils => github.com/openshift/kubernetes/staging/src/k8s.io/mount-utils v0.0.0-20210205160848-1fb0b6aa7392 diff --git a/go.sum b/go.sum index 38acba7bde45..3e146e721223 100644 --- a/go.sum +++ b/go.sum @@ -629,8 +629,8 @@ github.com/openshift/build-machinery-go v0.0.0-20200917070002-f171684f77ab h1:lB github.com/openshift/build-machinery-go v0.0.0-20200917070002-f171684f77ab/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE= github.com/openshift/client-go v0.0.0-20201214125552-e615e336eb49 h1:7NmjUkJtGHpMTE/n8ia6itbCdZ7eYuTCXKc/zsA7OSM= github.com/openshift/client-go v0.0.0-20201214125552-e615e336eb49/go.mod h1:9/jG4I6sh+5QublJpZZ4Zs/P4/QCXMsQQ/K/058bSB8= -github.com/openshift/kubernetes v1.20.1-0.20210205160848-1fb0b6aa7392 h1:vGmEp1aDw9U30IPsbbYh2daJnQ0jN/Bt60Qc9rNDslE= -github.com/openshift/kubernetes v1.20.1-0.20210205160848-1fb0b6aa7392/go.mod h1:WYL8/qQDpjRt1Rh9DNGRWe3V2ovnZnRJMffzC0gC1uc= +github.com/openshift/kubernetes v1.20.1-0.20210207150259-c3cfb813f909 h1:BW58b+c7BAgVlivLcNo7i5qZTVC7GvM7J/TufgPF8ts= +github.com/openshift/kubernetes v1.20.1-0.20210207150259-c3cfb813f909/go.mod h1:WYL8/qQDpjRt1Rh9DNGRWe3V2ovnZnRJMffzC0gC1uc= github.com/openshift/kubernetes/staging/src/k8s.io/api v0.0.0-20210205160848-1fb0b6aa7392 h1:7ewP7GkyG0UQd9LHl8W+T6JeZbvQdsG4pEH2+h8P76g= github.com/openshift/kubernetes/staging/src/k8s.io/api v0.0.0-20210205160848-1fb0b6aa7392/go.mod h1:12gqmOZJjmP0ciWfqR5ANIxYgDdTchaRCQx+nTGBtm4= github.com/openshift/kubernetes/staging/src/k8s.io/apiextensions-apiserver v0.0.0-20210205160848-1fb0b6aa7392 h1:ojHXaZVsWGZjRbkFdv6e7RCrAR5SIBPMPm1mqYc6Fec= diff --git a/test/extended/util/annotate/generated/zz_generated.annotations.go b/test/extended/util/annotate/generated/zz_generated.annotations.go index bd39126a658f..ee40221d66da 100644 --- a/test/extended/util/annotate/generated/zz_generated.annotations.go +++ b/test/extended/util/annotate/generated/zz_generated.annotations.go @@ -503,6 +503,12 @@ var annotations = map[string]string{ "[Top Level] [sig-api-machinery] Secrets should patch a secret [Conformance]": "should patch a secret [Conformance] [Suite:openshift/conformance/parallel/minimal] [Suite:k8s]", + "[Top Level] [sig-api-machinery] Server request timeout default timeout should be used if the specified timeout in the request URL is 0s": "default timeout should be used if the specified timeout in the request URL is 0s [Suite:openshift/conformance/parallel] [Suite:k8s]", + + "[Top Level] [sig-api-machinery] Server request timeout should return HTTP status code 400 if the user specifies an invalid timeout in the request URL": "should return HTTP status code 400 if the user specifies an invalid timeout in the request URL [Suite:openshift/conformance/parallel] [Suite:k8s]", + + "[Top Level] [sig-api-machinery] Server request timeout the request should be served with a default timeout if the specified timeout in the request URL exceeds maximum allowed": "the request should be served with a default timeout if the specified timeout in the request URL exceeds maximum allowed [Suite:openshift/conformance/parallel] [Suite:k8s]", + "[Top Level] [sig-api-machinery] Servers with support for API chunking should return chunks of results for list calls": "should return chunks of results for list calls [Suite:openshift/conformance/parallel] [Suite:k8s]", "[Top Level] [sig-api-machinery] Servers with support for API chunking should support continue listing from the last key if the original version has been compacted away, though the list is inconsistent [Slow]": "should support continue listing from the last key if the original version has been compacted away, though the list is inconsistent [Slow] [Suite:k8s]", diff --git a/vendor/k8s.io/kubernetes/test/e2e/apimachinery/BUILD b/vendor/k8s.io/kubernetes/test/e2e/apimachinery/BUILD index f72675fb0cca..8195ebf0ee4d 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/apimachinery/BUILD +++ b/vendor/k8s.io/kubernetes/test/e2e/apimachinery/BUILD @@ -25,6 +25,7 @@ go_library( "health_handlers.go", "namespace.go", "protocol.go", + "request_timeout.go", "resource_quota.go", "server_version.go", "table_conversion.go", diff --git a/vendor/k8s.io/kubernetes/test/e2e/apimachinery/request_timeout.go b/vendor/k8s.io/kubernetes/test/e2e/apimachinery/request_timeout.go new file mode 100644 index 000000000000..c6e1b4138350 --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/e2e/apimachinery/request_timeout.go @@ -0,0 +1,107 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apimachinery + +import ( + "io/ioutil" + "net/http" + "strings" + + "github.com/onsi/ginkgo" + "k8s.io/client-go/rest" + "k8s.io/kubernetes/test/e2e/framework" +) + +const ( + invalidTimeoutMessageExpected = "invalid timeout specified in the request URL" +) + +var _ = SIGDescribe("Server request timeout", func() { + f := framework.NewDefaultFramework("request-timeout") + + ginkgo.It("should return HTTP status code 400 if the user specifies an invalid timeout in the request URL", func() { + rt := getRoundTripper(f) + req := newRequest(f, "invalid") + + response, err := rt.RoundTrip(req) + framework.ExpectNoError(err) + defer response.Body.Close() + + if response.StatusCode != http.StatusBadRequest { + framework.Failf("expected HTTP status code: %d, but got: %d", http.StatusBadRequest, response.StatusCode) + } + + messageGot := readBody(response) + if !strings.Contains(messageGot, invalidTimeoutMessageExpected) { + framework.Failf("expected HTTP status message to contain: %s, but got: %s", invalidTimeoutMessageExpected, messageGot) + } + }) + + ginkgo.It("the request should be served with a default timeout if the specified timeout in the request URL exceeds maximum allowed", func() { + rt := getRoundTripper(f) + // Choose a timeout that exceeds the default timeout (60s) enforced by the apiserver + req := newRequest(f, "3m") + + response, err := rt.RoundTrip(req) + framework.ExpectNoError(err) + defer response.Body.Close() + + if response.StatusCode != http.StatusOK { + framework.Failf("expected HTTP status code: %d, but got: %d", http.StatusOK, response.StatusCode) + } + }) + + ginkgo.It("default timeout should be used if the specified timeout in the request URL is 0s", func() { + rt := getRoundTripper(f) + req := newRequest(f, "0s") + + response, err := rt.RoundTrip(req) + framework.ExpectNoError(err) + defer response.Body.Close() + + if response.StatusCode != http.StatusOK { + framework.Failf("expected HTTP status code: %d, but got: %d", http.StatusOK, response.StatusCode) + } + }) +}) + +func getRoundTripper(f *framework.Framework) http.RoundTripper { + config := rest.CopyConfig(f.ClientConfig()) + + // ensure we don't enforce any transport timeout from the client side. + config.Timeout = 0 + + roundTripper, err := rest.TransportFor(config) + framework.ExpectNoError(err) + + return roundTripper +} + +func newRequest(f *framework.Framework, timeout string) *http.Request { + req, err := http.NewRequest(http.MethodGet, f.ClientSet.CoreV1().RESTClient().Get(). + Param("timeout", timeout).AbsPath("version").URL().String(), nil) + framework.ExpectNoError(err) + + return req +} + +func readBody(response *http.Response) string { + raw, err := ioutil.ReadAll(response.Body) + framework.ExpectNoError(err) + + return string(raw) +} diff --git a/vendor/k8s.io/kubernetes/test/e2e/scheduling/ubernetes_lite.go b/vendor/k8s.io/kubernetes/test/e2e/scheduling/ubernetes_lite.go index 0e019571c802..0f803b6f8cbc 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/scheduling/ubernetes_lite.go +++ b/vendor/k8s.io/kubernetes/test/e2e/scheduling/ubernetes_lite.go @@ -20,6 +20,7 @@ import ( "context" "fmt" "math" + "time" "github.com/onsi/ginkgo" "github.com/onsi/gomega" @@ -42,6 +43,7 @@ var _ = SIGDescribe("Multi-AZ Clusters", func() { f := framework.NewDefaultFramework("multi-az") var zoneCount int var err error + var cleanUp func() ginkgo.BeforeEach(func() { e2eskipper.SkipUnlessProviderIs("gce", "gke", "aws") if zoneCount <= 0 { @@ -52,6 +54,20 @@ var _ = SIGDescribe("Multi-AZ Clusters", func() { msg := fmt.Sprintf("Zone count is %d, only run for multi-zone clusters, skipping test", zoneCount) e2eskipper.SkipUnlessAtLeast(zoneCount, 2, msg) // TODO: SkipUnlessDefaultScheduler() // Non-default schedulers might not spread + + cs := f.ClientSet + e2enode.WaitForTotalHealthy(cs, time.Minute) + nodeList, err := e2enode.GetReadySchedulableNodes(cs) + framework.ExpectNoError(err) + + // make the nodes have balanced cpu,mem usage + cleanUp, err = createBalancedPodForNodes(f, cs, f.Namespace.Name, nodeList.Items, podRequestedResource, 0.0) + framework.ExpectNoError(err) + }) + ginkgo.AfterEach(func() { + if cleanUp != nil { + cleanUp() + } }) ginkgo.It("should spread the pods of a service across zones", func() { SpreadServiceOrFail(f, 5*zoneCount, imageutils.GetPauseImageName()) diff --git a/vendor/modules.txt b/vendor/modules.txt index 3e53220a3418..49e4846fbb4a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -2079,7 +2079,7 @@ k8s.io/kubelet/pkg/apis/pluginregistration/v1 k8s.io/kubelet/pkg/apis/podresources/v1 k8s.io/kubelet/pkg/apis/podresources/v1alpha1 k8s.io/kubelet/pkg/apis/stats/v1alpha1 -# k8s.io/kubernetes v1.20.0 => github.com/openshift/kubernetes v1.20.1-0.20210205160848-1fb0b6aa7392 +# k8s.io/kubernetes v1.20.0 => github.com/openshift/kubernetes v1.20.1-0.20210207150259-c3cfb813f909 ## explicit k8s.io/kubernetes/cmd/kube-apiserver/app k8s.io/kubernetes/cmd/kube-apiserver/app/options @@ -2952,7 +2952,7 @@ sigs.k8s.io/yaml # k8s.io/kube-scheduler => github.com/openshift/kubernetes/staging/src/k8s.io/kube-scheduler v0.0.0-20210205160848-1fb0b6aa7392 # k8s.io/kubectl => github.com/openshift/kubernetes/staging/src/k8s.io/kubectl v0.0.0-20210205160848-1fb0b6aa7392 # k8s.io/kubelet => github.com/openshift/kubernetes/staging/src/k8s.io/kubelet v0.0.0-20210205160848-1fb0b6aa7392 -# k8s.io/kubernetes => github.com/openshift/kubernetes v1.20.1-0.20210205160848-1fb0b6aa7392 +# k8s.io/kubernetes => github.com/openshift/kubernetes v1.20.1-0.20210207150259-c3cfb813f909 # k8s.io/legacy-cloud-providers => github.com/openshift/kubernetes/staging/src/k8s.io/legacy-cloud-providers v0.0.0-20210205160848-1fb0b6aa7392 # k8s.io/metrics => github.com/openshift/kubernetes/staging/src/k8s.io/metrics v0.0.0-20210205160848-1fb0b6aa7392 # k8s.io/mount-utils => github.com/openshift/kubernetes/staging/src/k8s.io/mount-utils v0.0.0-20210205160848-1fb0b6aa7392