From 454841d1000423592701436870c732f344a25fe2 Mon Sep 17 00:00:00 2001 From: danielqsj Date: Wed, 23 Jan 2019 12:01:21 +0800 Subject: [PATCH 1/8] Add missing dependency to zk install --- test/images/pets/zookeeper-installer/Dockerfile | 2 +- test/images/pets/zookeeper-installer/VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/images/pets/zookeeper-installer/Dockerfile b/test/images/pets/zookeeper-installer/Dockerfile index 020de082fee..579862ee713 100644 --- a/test/images/pets/zookeeper-installer/Dockerfile +++ b/test/images/pets/zookeeper-installer/Dockerfile @@ -18,7 +18,7 @@ FROM BASEIMAGE CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ -RUN clean-install wget netcat +RUN clean-install wget bash netcat ADD on-start.sh / diff --git a/test/images/pets/zookeeper-installer/VERSION b/test/images/pets/zookeeper-installer/VERSION index 5625e59da88..7e32cd56983 100644 --- a/test/images/pets/zookeeper-installer/VERSION +++ b/test/images/pets/zookeeper-installer/VERSION @@ -1 +1 @@ -1.2 +1.3 From 404c057b67fcd843e2a4828139b53304c9a1e9a2 Mon Sep 17 00:00:00 2001 From: Chao Xu Date: Mon, 28 Jan 2019 17:42:01 -0800 Subject: [PATCH 2/8] update json-patch to pick up bug fixes --- Godeps/Godeps.json | 4 +- .../Godeps/Godeps.json | 2 +- .../k8s.io/apimachinery/Godeps/Godeps.json | 2 +- .../src/k8s.io/apiserver/Godeps/Godeps.json | 2 +- .../src/k8s.io/cli-runtime/Godeps/Godeps.json | 2 +- .../src/k8s.io/client-go/Godeps/Godeps.json | 2 +- staging/src/k8s.io/csi-api/Godeps/Godeps.json | 2 +- .../k8s.io/kube-aggregator/Godeps/Godeps.json | 2 +- staging/src/k8s.io/metrics/Godeps/Godeps.json | 2 +- .../src/k8s.io/node-api/Godeps/Godeps.json | 2 +- .../sample-apiserver/Godeps/Godeps.json | 2 +- .../sample-cli-plugin/Godeps/Godeps.json | 2 +- .../sample-controller/Godeps/Godeps.json | 2 +- .../github.com/evanphx/json-patch/README.md | 17 +++++ vendor/github.com/evanphx/json-patch/patch.go | 68 ++++++++++++++++--- 15 files changed, 90 insertions(+), 23 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 0febbc8e827..e004508adc8 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1555,8 +1555,8 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Comment": "v4.0.0-3-g36442dbdb58521", - "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" + "Comment": "v4.1.0-11-gd4020504c68b6b", + "Rev": "d4020504c68b6bfa818032bedfb48e33e9638506" }, { "ImportPath": "github.com/exponent-io/jsonpath", diff --git a/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json b/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json index 5c303ad9b53..2a9790e4fe4 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json @@ -372,7 +372,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" + "Rev": "d4020504c68b6bfa818032bedfb48e33e9638506" }, { "ImportPath": "github.com/ghodss/yaml", diff --git a/staging/src/k8s.io/apimachinery/Godeps/Godeps.json b/staging/src/k8s.io/apimachinery/Godeps/Godeps.json index 52655ff968b..ce90141c15b 100644 --- a/staging/src/k8s.io/apimachinery/Godeps/Godeps.json +++ b/staging/src/k8s.io/apimachinery/Godeps/Godeps.json @@ -24,7 +24,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" + "Rev": "d4020504c68b6bfa818032bedfb48e33e9638506" }, { "ImportPath": "github.com/gogo/protobuf/proto", diff --git a/staging/src/k8s.io/apiserver/Godeps/Godeps.json b/staging/src/k8s.io/apiserver/Godeps/Godeps.json index c3ee8cbccda..5e66542adcf 100644 --- a/staging/src/k8s.io/apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/apiserver/Godeps/Godeps.json @@ -372,7 +372,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" + "Rev": "d4020504c68b6bfa818032bedfb48e33e9638506" }, { "ImportPath": "github.com/ghodss/yaml", diff --git a/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json b/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json index 2f973b487dc..2f48ea106e8 100644 --- a/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json +++ b/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json @@ -12,7 +12,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" + "Rev": "d4020504c68b6bfa818032bedfb48e33e9638506" }, { "ImportPath": "github.com/gogo/protobuf/proto", diff --git a/staging/src/k8s.io/client-go/Godeps/Godeps.json b/staging/src/k8s.io/client-go/Godeps/Godeps.json index 69318cbc89b..963b5084c16 100644 --- a/staging/src/k8s.io/client-go/Godeps/Godeps.json +++ b/staging/src/k8s.io/client-go/Godeps/Godeps.json @@ -56,7 +56,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" + "Rev": "d4020504c68b6bfa818032bedfb48e33e9638506" }, { "ImportPath": "github.com/gogo/protobuf/proto", diff --git a/staging/src/k8s.io/csi-api/Godeps/Godeps.json b/staging/src/k8s.io/csi-api/Godeps/Godeps.json index 1218aa5cc2e..09b584f212c 100644 --- a/staging/src/k8s.io/csi-api/Godeps/Godeps.json +++ b/staging/src/k8s.io/csi-api/Godeps/Godeps.json @@ -12,7 +12,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" + "Rev": "d4020504c68b6bfa818032bedfb48e33e9638506" }, { "ImportPath": "github.com/gogo/protobuf/proto", diff --git a/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json b/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json index bf8d2e15685..ba20fb5c172 100644 --- a/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json @@ -96,7 +96,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" + "Rev": "d4020504c68b6bfa818032bedfb48e33e9638506" }, { "ImportPath": "github.com/go-openapi/jsonpointer", diff --git a/staging/src/k8s.io/metrics/Godeps/Godeps.json b/staging/src/k8s.io/metrics/Godeps/Godeps.json index 80d6aa9b7c5..59b1b7470d3 100644 --- a/staging/src/k8s.io/metrics/Godeps/Godeps.json +++ b/staging/src/k8s.io/metrics/Godeps/Godeps.json @@ -12,7 +12,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" + "Rev": "d4020504c68b6bfa818032bedfb48e33e9638506" }, { "ImportPath": "github.com/gogo/protobuf/proto", diff --git a/staging/src/k8s.io/node-api/Godeps/Godeps.json b/staging/src/k8s.io/node-api/Godeps/Godeps.json index 945acb3adc9..d3bbc82cda7 100644 --- a/staging/src/k8s.io/node-api/Godeps/Godeps.json +++ b/staging/src/k8s.io/node-api/Godeps/Godeps.json @@ -12,7 +12,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" + "Rev": "d4020504c68b6bfa818032bedfb48e33e9638506" }, { "ImportPath": "github.com/gogo/protobuf/proto", diff --git a/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json b/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json index b920ad905a8..bdd07fa415a 100644 --- a/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json @@ -88,7 +88,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" + "Rev": "d4020504c68b6bfa818032bedfb48e33e9638506" }, { "ImportPath": "github.com/go-openapi/jsonpointer", diff --git a/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json b/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json index d881a452c5f..4d1dcd31138 100644 --- a/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json @@ -12,7 +12,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" + "Rev": "d4020504c68b6bfa818032bedfb48e33e9638506" }, { "ImportPath": "github.com/gogo/protobuf/proto", diff --git a/staging/src/k8s.io/sample-controller/Godeps/Godeps.json b/staging/src/k8s.io/sample-controller/Godeps/Godeps.json index 9f77150d79d..2d268b9c921 100644 --- a/staging/src/k8s.io/sample-controller/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-controller/Godeps/Godeps.json @@ -12,7 +12,7 @@ }, { "ImportPath": "github.com/evanphx/json-patch", - "Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" + "Rev": "d4020504c68b6bfa818032bedfb48e33e9638506" }, { "ImportPath": "github.com/gogo/protobuf/proto", diff --git a/vendor/github.com/evanphx/json-patch/README.md b/vendor/github.com/evanphx/json-patch/README.md index 13b90420ca1..ad011b2fac6 100644 --- a/vendor/github.com/evanphx/json-patch/README.md +++ b/vendor/github.com/evanphx/json-patch/README.md @@ -25,6 +25,23 @@ go get -u github.com/evanphx/json-patch * [Comparing JSON documents](#comparing-json-documents) * [Combine merge patches](#combine-merge-patches) + +# Configuration + +* There is a global configuration variable `jsonpatch.SupportNegativeIndices`. + This defaults to `true` and enables the non-standard practice of allowing + negative indices to mean indices starting at the end of an array. This + functionality can be disabled by setting `jsonpatch.SupportNegativeIndices = + false`. + +* There is a global configuration variable `jsonpatch.ArraySizeLimit`, which + limits the length of any array the patched object can have. It defaults to 0, + which means there is no limit. + +* There is a global configuration variable `jsonpatch.ArraySizeAdditionLimit`, + which limits the increase of array length caused by each operation. It + defaults to 0, which means there is no limit. + ## Create and apply a merge patch Given both an original JSON document and a modified JSON document, you can create a [Merge Patch](https://tools.ietf.org/html/rfc7396) document. diff --git a/vendor/github.com/evanphx/json-patch/patch.go b/vendor/github.com/evanphx/json-patch/patch.go index 3d76e9e38b0..b1ec06ae173 100644 --- a/vendor/github.com/evanphx/json-patch/patch.go +++ b/vendor/github.com/evanphx/json-patch/patch.go @@ -14,6 +14,10 @@ const ( eAry ) +var SupportNegativeIndices bool = true +var ArraySizeLimit int = 0 +var ArraySizeAdditionLimit int = 0 + type lazyNode struct { raw *json.RawMessage doc partialDoc @@ -61,6 +65,19 @@ func (n *lazyNode) UnmarshalJSON(data []byte) error { return nil } +func deepCopy(src *lazyNode) (*lazyNode, error) { + if src == nil { + return nil, nil + } + a, err := src.MarshalJSON() + if err != nil { + return nil, err + } + ra := make(json.RawMessage, len(a)) + copy(ra, a) + return newLazyNode(&ra), nil +} + func (n *lazyNode) intoDoc() (*partialDoc, error) { if n.which == eDoc { return &n.doc, nil @@ -354,10 +371,19 @@ func (d *partialArray) set(key string, val *lazyNode) error { } sz := len(*d) + + if diff := idx + 1 - sz; ArraySizeAdditionLimit > 0 && diff > ArraySizeAdditionLimit { + return fmt.Errorf("Unable to increase the array size by %d, the limit is %d", diff, ArraySizeAdditionLimit) + } + if idx+1 > sz { sz = idx + 1 } + if ArraySizeLimit > 0 && sz > ArraySizeLimit { + return fmt.Errorf("Unable to create array of size %d, limit is %d", sz, ArraySizeLimit) + } + ary := make([]*lazyNode, sz) cur := *d @@ -385,17 +411,29 @@ func (d *partialArray) add(key string, val *lazyNode) error { return err } - ary := make([]*lazyNode, len(*d)+1) + sz := len(*d) + 1 + if ArraySizeLimit > 0 && sz > ArraySizeLimit { + return fmt.Errorf("Unable to create array of size %d, limit is %d", sz, ArraySizeLimit) + } + + ary := make([]*lazyNode, sz) cur := *d - if idx < -len(ary) || idx >= len(ary) { + if idx >= len(ary) { return fmt.Errorf("Unable to access invalid index: %d", idx) } - if idx < 0 { - idx += len(ary) + if SupportNegativeIndices { + if idx < -len(ary) { + return fmt.Errorf("Unable to access invalid index: %d", idx) + } + + if idx < 0 { + idx += len(ary) + } } + copy(ary[0:idx], cur[0:idx]) ary[idx] = val copy(ary[idx+1:], cur[idx:]) @@ -426,11 +464,18 @@ func (d *partialArray) remove(key string) error { cur := *d - if idx < -len(cur) || idx >= len(cur) { - return fmt.Errorf("Unable to remove invalid index: %d", idx) + if idx >= len(cur) { + return fmt.Errorf("Unable to access invalid index: %d", idx) } - if idx < 0 { - idx += len(cur) + + if SupportNegativeIndices { + if idx < -len(cur) { + return fmt.Errorf("Unable to access invalid index: %d", idx) + } + + if idx < 0 { + idx += len(cur) + } } ary := make([]*lazyNode, len(cur)-1) @@ -567,7 +612,12 @@ func (p Patch) copy(doc *container, op operation) error { return fmt.Errorf("jsonpatch copy operation does not apply: doc is missing destination path: %s", path) } - return con.set(key, val) + valCopy, err := deepCopy(val) + if err != nil { + return err + } + + return con.add(key, valCopy) } // Equal indicates if 2 JSON documents have the same structural equality. From 01df1464e5eb433de3dc5927af13a055a6ddf4d0 Mon Sep 17 00:00:00 2001 From: "Bobby (Babak) Salamat" Date: Tue, 29 Jan 2019 15:17:19 -0800 Subject: [PATCH 3/8] Graduate Pod priority and preemption to GA --- pkg/features/kube_features.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/features/kube_features.go b/pkg/features/kube_features.go index 89d67e63521..86acccdf42b 100644 --- a/pkg/features/kube_features.go +++ b/pkg/features/kube_features.go @@ -121,6 +121,7 @@ const ( // owner: @bsalamat // alpha: v1.8 // beta: v1.11 + // GA: v1.14 // // Add priority to pods. Priority affects scheduling and preemption of pods. PodPriority utilfeature.Feature = "PodPriority" @@ -432,7 +433,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS Sysctls: {Default: true, PreRelease: utilfeature.Beta}, DebugContainers: {Default: false, PreRelease: utilfeature.Alpha}, PodShareProcessNamespace: {Default: true, PreRelease: utilfeature.Beta}, - PodPriority: {Default: true, PreRelease: utilfeature.Beta}, + PodPriority: {Default: true, PreRelease: utilfeature.GA}, TaintNodesByCondition: {Default: true, PreRelease: utilfeature.Beta}, MountPropagation: {Default: true, PreRelease: utilfeature.GA, LockToDefault: true}, // remove in 1.14 QOSReserved: {Default: false, PreRelease: utilfeature.Alpha}, From 6cd03ab8ae2df8cfe12c453fa7af157c73952eab Mon Sep 17 00:00:00 2001 From: Shyam Jeedigunta Date: Tue, 29 Jan 2019 16:24:53 -0800 Subject: [PATCH 4/8] Fix TLS config in load test clients --- test/e2e/scalability/load.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/e2e/scalability/load.go b/test/e2e/scalability/load.go index 5e2a95e2d9c..a89067886cd 100644 --- a/test/e2e/scalability/load.go +++ b/test/e2e/scalability/load.go @@ -377,9 +377,13 @@ func createClients(numberOfClients int) ([]clientset.Interface, []internalclient KeepAlive: 30 * time.Second, }).DialContext, }) + config.WrapTransport = transportConfig.WrapTransport + config.Dial = transportConfig.Dial // Overwrite TLS-related fields from config to avoid collision with // Transport field. config.TLSClientConfig = restclient.TLSClientConfig{} + config.AuthProvider = nil + config.ExecProvider = nil c, err := clientset.NewForConfig(config) if err != nil { From 44a36ea36eb189c3b1e136966eb2ad5d73371ada Mon Sep 17 00:00:00 2001 From: Bin Lu Date: Fri, 11 Jan 2019 11:26:31 +0800 Subject: [PATCH 5/8] Bug fix: ./hack/local-up-cluster.sh is not work on Arm64 platform Signed-off-by: Bin Lu --- hack/lib/util.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hack/lib/util.sh b/hack/lib/util.sh index cf6bb0edb0e..642b7c5e316 100755 --- a/hack/lib/util.sh +++ b/hack/lib/util.sh @@ -697,6 +697,15 @@ function kube::util::ensure-cfssl { return 0 fi + host_arch=$(kube::util::host_arch) + + if [[ "${host_arch}" != "amd64" ]]; then + echo "Cannot download cfssl on non-amd64 hosts and cfssl does not appear to be installed." + echo "Please install cfssl and cfssljson and verify they are in \$PATH." + echo "Hint: export PATH=\$PATH:\$GOPATH/bin; go get -u github.com/cloudflare/cfssl/cmd/..." + exit 1 + fi + # Create a temp dir for cfssl if no directory was given local cfssldir=${1:-} if [[ -z "${cfssldir}" ]]; then From e5b634bb68103ccaf24384774e3bdee286d7bb26 Mon Sep 17 00:00:00 2001 From: danielqsj Date: Thu, 24 Jan 2019 14:09:01 +0800 Subject: [PATCH 6/8] fix shellcheck in k8s.io/apiextensions-apiserver --- hack/.shellcheck_failures | 5 ----- .../examples/client-go/hack/update-codegen.sh | 8 ++++---- .../examples/client-go/hack/verify-codegen.sh | 2 +- .../k8s.io/apiextensions-apiserver/hack/build-image.sh | 5 ++++- .../apiextensions-apiserver/hack/update-codegen.sh | 10 +++++----- .../apiextensions-apiserver/hack/verify-codegen.sh | 3 +-- 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/hack/.shellcheck_failures b/hack/.shellcheck_failures index 2ef9f636eb8..8bad3cf36d2 100644 --- a/hack/.shellcheck_failures +++ b/hack/.shellcheck_failures @@ -158,11 +158,6 @@ ./pkg/kubectl/cmd/edit/testdata/record_testcase.sh ./pkg/util/verify-util-pkg.sh ./plugin/pkg/admission/imagepolicy/gencerts.sh -./staging/src/k8s.io/apiextensions-apiserver/examples/client-go/hack/update-codegen.sh -./staging/src/k8s.io/apiextensions-apiserver/examples/client-go/hack/verify-codegen.sh -./staging/src/k8s.io/apiextensions-apiserver/hack/build-image.sh -./staging/src/k8s.io/apiextensions-apiserver/hack/update-codegen.sh -./staging/src/k8s.io/apiextensions-apiserver/hack/verify-codegen.sh ./staging/src/k8s.io/code-generator/generate-groups.sh ./staging/src/k8s.io/code-generator/generate-internal-groups.sh ./staging/src/k8s.io/code-generator/hack/update-codegen.sh diff --git a/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/hack/update-codegen.sh b/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/hack/update-codegen.sh index ea26ad63cca..809ee02feef 100755 --- a/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/hack/update-codegen.sh +++ b/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/hack/update-codegen.sh @@ -18,17 +18,17 @@ set -o errexit set -o nounset set -o pipefail -SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/.. -CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)} +SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. +CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)} # generate the code with: # --output-base because this script should also be able to run inside the vendor dir of # k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir # instead of the $GOPATH directly. For normal projects this can be dropped. -${CODEGEN_PKG}/generate-groups.sh all \ +"${CODEGEN_PKG}/generate-groups.sh" all \ k8s.io/apiextensions-apiserver/examples/client-go/pkg/client k8s.io/apiextensions-apiserver/examples/client-go/pkg/apis \ cr:v1 \ - --output-base "$(dirname ${BASH_SOURCE})/../../../../.." + --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../../.." # To use your own boilerplate text append: # --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt diff --git a/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/hack/verify-codegen.sh b/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/hack/verify-codegen.sh index d02a6fa395e..d91566e6228 100755 --- a/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/hack/verify-codegen.sh +++ b/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/hack/verify-codegen.sh @@ -18,7 +18,7 @@ set -o errexit set -o nounset set -o pipefail -SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/.. +SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. DIFFROOT="${SCRIPT_ROOT}/pkg" TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/pkg" diff --git a/staging/src/k8s.io/apiextensions-apiserver/hack/build-image.sh b/staging/src/k8s.io/apiextensions-apiserver/hack/build-image.sh index d0d129078f3..1f7bb58c334 100755 --- a/staging/src/k8s.io/apiextensions-apiserver/hack/build-image.sh +++ b/staging/src/k8s.io/apiextensions-apiserver/hack/build-image.sh @@ -14,8 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. +set -o errexit +set -o nounset +set -o pipefail -KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../../../../.. +KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../../../../.. source "${KUBE_ROOT}/hack/lib/util.sh" # Register function to be called on EXIT to remove generated binary. diff --git a/staging/src/k8s.io/apiextensions-apiserver/hack/update-codegen.sh b/staging/src/k8s.io/apiextensions-apiserver/hack/update-codegen.sh index 0dc83d07f21..d5b08c6c5da 100755 --- a/staging/src/k8s.io/apiextensions-apiserver/hack/update-codegen.sh +++ b/staging/src/k8s.io/apiextensions-apiserver/hack/update-codegen.sh @@ -18,8 +18,8 @@ set -o errexit set -o nounset set -o pipefail -SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/.. -CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)} +SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. +CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)} # generate the code with: # --output-base because this script should also be able to run inside the vendor dir of @@ -27,8 +27,8 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge # instead of the $GOPATH directly. For normal projects this can be dropped. CLIENTSET_NAME_VERSIONED=clientset \ CLIENTSET_NAME_INTERNAL=internalclientset \ -${CODEGEN_PKG}/generate-internal-groups.sh all \ +"${CODEGEN_PKG}/generate-internal-groups.sh" all \ k8s.io/apiextensions-apiserver/pkg/client k8s.io/apiextensions-apiserver/pkg/apis k8s.io/apiextensions-apiserver/pkg/apis \ "apiextensions:v1beta1" \ - --output-base "$(dirname ${BASH_SOURCE})/../../.." \ - --go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt + --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \ + --go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" diff --git a/staging/src/k8s.io/apiextensions-apiserver/hack/verify-codegen.sh b/staging/src/k8s.io/apiextensions-apiserver/hack/verify-codegen.sh index ab43ba23d01..d91566e6228 100755 --- a/staging/src/k8s.io/apiextensions-apiserver/hack/verify-codegen.sh +++ b/staging/src/k8s.io/apiextensions-apiserver/hack/verify-codegen.sh @@ -18,8 +18,7 @@ set -o errexit set -o nounset set -o pipefail -SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/.. -SCRIPT_BASE=${SCRIPT_ROOT}/../.. +SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. DIFFROOT="${SCRIPT_ROOT}/pkg" TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/pkg" From 0b4397f928cd9dac0c824ae8912708acfb9a1246 Mon Sep 17 00:00:00 2001 From: danielqsj Date: Wed, 23 Jan 2019 20:16:42 +0800 Subject: [PATCH 7/8] fix shellcheck in sample-apiserver --- hack/.shellcheck_failures | 3 --- .../sample-apiserver/hack/build-image.sh | 5 ++++- .../sample-apiserver/hack/update-codegen.sh | 18 +++++++++--------- .../sample-apiserver/hack/verify-codegen.sh | 3 +-- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/hack/.shellcheck_failures b/hack/.shellcheck_failures index 2ef9f636eb8..1472a1d2f63 100644 --- a/hack/.shellcheck_failures +++ b/hack/.shellcheck_failures @@ -178,9 +178,6 @@ ./staging/src/k8s.io/metrics/hack/verify-codegen.sh ./staging/src/k8s.io/node-api/hack/update-codegen.sh ./staging/src/k8s.io/node-api/hack/verify-codegen.sh -./staging/src/k8s.io/sample-apiserver/hack/build-image.sh -./staging/src/k8s.io/sample-apiserver/hack/update-codegen.sh -./staging/src/k8s.io/sample-apiserver/hack/verify-codegen.sh ./test/cmd/apply.sh ./test/cmd/apps.sh ./test/cmd/authorization.sh diff --git a/staging/src/k8s.io/sample-apiserver/hack/build-image.sh b/staging/src/k8s.io/sample-apiserver/hack/build-image.sh index c1b3c768589..1402e366a9a 100755 --- a/staging/src/k8s.io/sample-apiserver/hack/build-image.sh +++ b/staging/src/k8s.io/sample-apiserver/hack/build-image.sh @@ -14,8 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. +set -o errexit +set -o nounset +set -o pipefail -KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../../../../.. +KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../../../../.. source "${KUBE_ROOT}/hack/lib/util.sh" # Register function to be called on EXIT to remove generated binary. diff --git a/staging/src/k8s.io/sample-apiserver/hack/update-codegen.sh b/staging/src/k8s.io/sample-apiserver/hack/update-codegen.sh index 98c9ae9e1aa..d4883f401b4 100755 --- a/staging/src/k8s.io/sample-apiserver/hack/update-codegen.sh +++ b/staging/src/k8s.io/sample-apiserver/hack/update-codegen.sh @@ -18,24 +18,24 @@ set -o errexit set -o nounset set -o pipefail -SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/.. -CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)} +SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. +CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)} # generate the code with: # --output-base because this script should also be able to run inside the vendor dir of # k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir # instead of the $GOPATH directly. For normal projects this can be dropped. -${CODEGEN_PKG}/generate-groups.sh all \ +"${CODEGEN_PKG}/generate-groups.sh" all \ k8s.io/sample-apiserver/pkg/client k8s.io/sample-apiserver/pkg/apis \ "wardle:v1alpha1,v1beta1" \ - --output-base "$(dirname ${BASH_SOURCE})/../../.." \ - --go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt + --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \ + --go-header-file "${SCRIPT_ROOT}"/hack/boilerplate.go.txt -${CODEGEN_PKG}/generate-internal-groups.sh "deepcopy,defaulter,conversion" \ +"${CODEGEN_PKG}/generate-internal-groups.sh" "deepcopy,defaulter,conversion" \ k8s.io/sample-apiserver/pkg/client k8s.io/sample-apiserver/pkg/apis k8s.io/sample-apiserver/pkg/apis \ "wardle:v1alpha1,v1beta1" \ - --output-base "$(dirname ${BASH_SOURCE})/../../.." \ - --go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt + --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \ + --go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" # To use your own boilerplate text use: -# --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt +# --go-header-file "${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt" diff --git a/staging/src/k8s.io/sample-apiserver/hack/verify-codegen.sh b/staging/src/k8s.io/sample-apiserver/hack/verify-codegen.sh index ab43ba23d01..d91566e6228 100755 --- a/staging/src/k8s.io/sample-apiserver/hack/verify-codegen.sh +++ b/staging/src/k8s.io/sample-apiserver/hack/verify-codegen.sh @@ -18,8 +18,7 @@ set -o errexit set -o nounset set -o pipefail -SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/.. -SCRIPT_BASE=${SCRIPT_ROOT}/../.. +SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. DIFFROOT="${SCRIPT_ROOT}/pkg" TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/pkg" From aa93e2bb946ae4b90535e5c9980a467ae4cec5ee Mon Sep 17 00:00:00 2001 From: Krzysztof Siedlecki Date: Wed, 30 Jan 2019 10:36:32 +0100 Subject: [PATCH 8/8] reverting test to apiserver_request_latencies_summary metric --- test/e2e/framework/metrics_util.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/e2e/framework/metrics_util.go b/test/e2e/framework/metrics_util.go index fce60531681..83adb80b4c6 100644 --- a/test/e2e/framework/metrics_util.go +++ b/test/e2e/framework/metrics_util.go @@ -137,7 +137,9 @@ var SchedulingLatencyMetricName = model.LabelValue(schedulermetric.SchedulerSubs var InterestingApiServerMetrics = []string{ "apiserver_request_total", - "apiserver_request_latency_seconds_summary", + // TODO(krzysied): apiserver_request_latencies_summary is a deprecated metric. + // It should be replaced with new metric. + "apiserver_request_latencies_summary", "etcd_helper_cache_entry_total", "etcd_helper_cache_hit_total", "etcd_helper_cache_miss_total", @@ -475,9 +477,9 @@ func readLatencyMetrics(c clientset.Interface) (*APIResponsiveness, error) { for _, sample := range samples { // Example line: - // apiserver_request_latency_seconds_summary{resource="namespaces",verb="LIST",quantile="0.99"} 0.000908 + // apiserver_request_latencies_summary{resource="namespaces",verb="LIST",quantile="0.99"} 908 // apiserver_request_total{resource="pods",verb="LIST",client="kubectl",code="200",contentType="json"} 233 - if sample.Metric[model.MetricNameLabel] != "apiserver_request_latency_seconds_summary" && + if sample.Metric[model.MetricNameLabel] != "apiserver_request_latencies_summary" && sample.Metric[model.MetricNameLabel] != "apiserver_request_total" { continue } @@ -491,13 +493,13 @@ func readLatencyMetrics(c clientset.Interface) (*APIResponsiveness, error) { } switch sample.Metric[model.MetricNameLabel] { - case "apiserver_request_latency_seconds_summary": + case "apiserver_request_latencies_summary": latency := sample.Value quantile, err := strconv.ParseFloat(string(sample.Metric[model.QuantileLabel]), 64) if err != nil { return nil, err } - a.addMetricRequestLatency(resource, subresource, verb, scope, quantile, time.Duration(int64(latency))*time.Second) + a.addMetricRequestLatency(resource, subresource, verb, scope, quantile, time.Duration(int64(latency))*time.Microsecond) case "apiserver_request_total": count := sample.Value a.addMetricRequestCount(resource, subresource, verb, scope, int(count))