Skip to content

Commit

Permalink
Merge pull request kubernetes#1 from kubernetes/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
Sakuralbj committed Feb 19, 2020
2 parents 6601ff6 + dbf97e7 commit 3326c7b
Show file tree
Hide file tree
Showing 219 changed files with 3,767 additions and 35,167 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ script:
- ./verify/verify-golint.sh
- ./verify/verify-flags-underscore.py
- ./verify/verify-dashboard-format.sh
- go get -d ./...
- travis_wait go build $(go list ./... | grep -v "/vendor/")
- travis_wait ./verify/go-build.sh
- ./verify/test.sh
9 changes: 9 additions & 0 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
aliases:
sig-scalability-reviewers:
- mm4tt
- shyamjvs
- wojtek-t
sig-scalability-approvers:
- mm4tt
- shyamjvs
- wojtek-t
7 changes: 7 additions & 0 deletions application-benchmarks/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
reviewers:
- sig-scalability-reviewers

approvers:
- sig-scalability-approvers
- jberkus
- wojtek-t
22 changes: 22 additions & 0 deletions application-benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Application Performance and Benchmarking

This directory contains the files for the Application Performance and Benchmarking subproject of SIG-Scalability. The subproject's mission is:

* Develop repeatable benchmarking scripts, tools, and configurations for testing the performance of applications running on Kubernetes together with stack components such as CSI drivers and network overlays
* Share and publish results of benchmarking tests
* Develop automated tests to monitor for application performance regressions

## Discussion and Contacts

- Issues: file issues in this repository
- Chat: #sig-scalability in slack.k8s.io
- Meetings: no meetings scheduled yet

## Owners

Initial subproject owners are:

- Josh Berkus (@jberkus) of Red Hat
- Wojciech Tyczynski (@wojtek-t) of Google

Once we have built out results and test parameters, the owners list will be updated with the actual contributors to the project.
1 change: 1 addition & 0 deletions clusterloader2/OWNERS
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
approvers:
- krzysied
- mborsz
- mm4tt
- oxddr
- wojtek-t
Expand Down
23 changes: 21 additions & 2 deletions clusterloader2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Parameters can be passed from the test definition to the object template
using the ```templateFillMap``` map.
Two always available parameters are ```{{.Name}}``` and ```{{.Index}}```
which specifies object name and object replica index respectively. \
Example of a template can be found here: [load rc template].
Example of a template can be found here: [load deployment template].

### Overrides

Expand All @@ -62,6 +62,25 @@ each reference has to be opaqued with ```DefaultParam``` function that will
handle case if given variable doesn't exist. \
Example of overrides can be found here: [overrides]

#### Passing environment variables

Instead of using overrides in file, it is possible to depend on environment
variables. Only variables that start with `CL2_` prefix will be parsed and
available in script.

Environment variables can be used with `DefaultParam` function to provide sane
default values.

##### Setting variables in shell
```shell
export CL2_ACCESS_TOKENS_QPS=5
```

##### Usage from test definition
```yaml
{{$qpsPerToken := DefaultParam .CL2_ACCESS_TOKENS_QPS 0.1}}
```

## Measurement

Currently available measurements are:
Expand Down Expand Up @@ -120,7 +139,7 @@ Vendor is created using [govendor].
[API call latencies SLO]: https://github.com/kubernetes/community/blob/master/sig-scalability/slos/api_call_latency.md
[design doc]: https://github.com/kubernetes/perf-tests/blob/master/clusterloader2/docs/design.md
[govendor]: https://github.com/kardianos/govendor
[load rc template]: https://github.com/kubernetes/perf-tests/blob/master/clusterloader2/testing/load/rc.yaml
[load deployment template]: https://github.com/kubernetes/perf-tests/blob/master/clusterloader2/testing/load/deployment.yaml
[load test]: https://github.com/kubernetes/perf-tests/blob/master/clusterloader2/testing/load/config.yaml
[overrides]: https://github.com/kubernetes/perf-tests/blob/master/clusterloader2/testing/density/5000_nodes/override.yaml
[pod startup SLO]: https://github.com/kubernetes/community/blob/master/sig-scalability/slos/pod_startup_latency.md
13 changes: 12 additions & 1 deletion clusterloader2/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ type ListUnknownObjectOptions struct {
type NamespaceRange struct {
// Min is the lower index of namespace range.
Min int32 `json: min`
// Min is the upper index of namespace range.
// Max is the upper index of namespace range.
Max int32 `json: max`
// Basename defines the group of selected namespaces.
// All of the namespaces, with name "<Basename>-<i>"
Expand Down Expand Up @@ -138,6 +138,8 @@ type TuningSet struct {
RandomizedTimeLimitedLoad *RandomizedTimeLimitedLoad `json: randomizedTimeLimitedLoad`
// ParallelismLimitedLoad is a definition for ParallelismLimitedLoad tuning set.
ParallelismLimitedLoad *ParallelismLimitedLoad `json: parallelismLimitedLoad`
// GlobalQPSLoad is a definition for GlobalQPSLoad tuning set.
GlobalQPSLoad *GlobalQPSLoad `json: globalQPSLoad`
}

// Measurement is a structure that defines the measurement method call.
Expand Down Expand Up @@ -191,6 +193,15 @@ type ParallelismLimitedLoad struct {
ParallelismLimit int32 `json: parallelismLimit`
}

// GlobalQPSLoad defines a uniform load with a given QPS.
// The rate limiter is shared across all phases using this tuning set.
type GlobalQPSLoad struct {
// QPS defines desired average rate of actions.
QPS float64 `json: qps`
// Burst defines maxumim number of actions that can happen at the same time.
Burst int `json: burst`
}

// ChaosMonkeyConfig descibes simulated component failures.
type ChaosMonkeyConfig struct {
// NodeFailure is a config for simulated node failures.
Expand Down
97 changes: 97 additions & 0 deletions clusterloader2/clean-up-old-snapshots.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/usr/bin/env bash

# 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.

set -o errexit
set -o nounset
set -o pipefail

print-usage-and-exit() {
>&2 echo "Usage:"
>&2 echo " $0 delete|list <comma-sep-projects> <comma-sep-prefixes> <days-old>"
>&2 echo "Example:"
>&2 echo " $0 list k8s-e2e-gce-1-1,k8s-e2e-gce-1-2 ci-e2e-scalability,ci-e2e-kubemark 30"
exit $1
}

list-old-snapshots() {
project=$1
regexp=$2
days_old=$3
(
set -o xtrace
gcloud compute snapshots list \
--project "$project" \
--filter="creationTimestamp < -P${days_old}D AND name~\"${regexp}\"" \
--format="value(name)"
)
}

process-old-snapshots() {
command=$1
project=$2
regexp=$3
days_old=$4
for snapshot in $(list-old-snapshots "$project" "$regexp" "$days_old"); do
if [[ "$command" == "delete" ]]; then
echo "Removing $snapshot ..."
gcloud compute snapshots delete -q --project "$project" "$snapshot"
else
echo "Found: $snapshot"
fi
done
}

main() {
if [ "$#" -ne 4 ]; then
>&2 echo "Wrong number of parameters, expected 4, got $#"
print-usage-and-exit 1
fi

command=$1
projects=$2
prefixes=$3
days_old=$4

if ! [[ "$command" =~ ^(list|delete)$ ]]; then
>&2 echo "Invalid command: $command"
print-usage-and-exit 2
fi
if ! [[ "$projects" =~ ^[a-z0-9,-]+$ ]]; then
>&2 echo "Illegal characters in projects parameter: $projects"
print-usage-and-exit 3
fi
if ! [[ "$prefixes" =~ ^[a-z0-9,.-]+$ ]]; then
>&2 echo "Illegal characters in prefixes parameter: $prefixes"
print-usage-and-exit 4
fi
if ! [[ "$days_old" =~ ^[0-9]+$ ]]; then
>&2 echo "Days-old parameter must be an integer: $days_old"
print-usage-and-exit 5
fi

prefixes_alt="${prefixes//,/|}"
regexp="^(${prefixes_alt}).*-[0-9]{19}$"
echo "Looking for snapshots matched by $regexp"

IFS=',' read -ra projects_arr <<< "$projects"

for project in "${projects_arr[@]}"; do
echo "Processing project $project"
process-old-snapshots "$command" "$project" "$regexp" "$days_old"
done
}

main $@
1 change: 1 addition & 0 deletions clusterloader2/cmd/clusterloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func initClusterFlags() {
flags.StringEnvVar(&clusterLoaderConfig.ClusterConfig.KubeConfigPath, "kubeconfig", "KUBECONFIG", "", "Path to the kubeconfig file")
flags.IntEnvVar(&clusterLoaderConfig.ClusterConfig.Nodes, "nodes", "NUM_NODES", 0, "number of nodes")
flags.StringEnvVar(&clusterLoaderConfig.ClusterConfig.Provider, "provider", "PROVIDER", "", "Cluster provider")
flags.IntEnvVar(&clusterLoaderConfig.ClusterConfig.EtcdInsecurePort, "etcd-insecure-port", "ETCD_INSECURE_PORT", 2382, "Inscure http port")
flags.StringEnvVar(&clusterLoaderConfig.ClusterConfig.MasterName, "mastername", "MASTER_NAME", "", "Name of the masternode")
// TODO(#595): Change the name of the MASTER_IP and MASTER_INTERNAL_IP flags and vars to plural
flags.StringSliceEnvVar(&clusterLoaderConfig.ClusterConfig.MasterIPs, "masterip", "MASTER_IP", nil /*defaultValue*/, "Hostname/IP of the master node, supports multiple values when separated by commas")
Expand Down
1 change: 1 addition & 0 deletions clusterloader2/pkg/config/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type ClusterConfig struct {
KubeConfigPath string
Nodes int
Provider string
EtcdInsecurePort int
MasterIPs []string
MasterInternalIPs []string
MasterName string
Expand Down
25 changes: 24 additions & 1 deletion clusterloader2/pkg/config/template_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"time"

"gopkg.in/yaml.v2"
"k8s.io/klog"
)

func init() {
Expand All @@ -45,6 +46,7 @@ func GetFuncs() template.FuncMap {
"DivideInt": divideInt,
"IfThenElse": ifThenElse,
"IncludeFile": includeFile,
"Loop": loop,
"MaxFloat": maxFloat,
"MaxInt": maxInt,
"MinFloat": minFloat,
Expand All @@ -55,14 +57,18 @@ func GetFuncs() template.FuncMap {
"RandInt": randInt,
"RandIntRange": randIntRange,
"Seq": seq,
"SliceOfZeros": sliceOfZeros,
"SubtractFloat": subtractFloat,
"SubtractInt": subtractInt,
"YamlQuote": yamlQuote,
}
}

// seq returns a slice of size 'size' filled with zeros.
// Deprecated: Naming generates confusion. Please use 'SliceOfZeros' for explicit zero values or 'Loop' for incremential integer generation.
func seq(size interface{}) []int {
return make([]int, int(toFloat64(size)))
klog.Warningf("Seq is deprecated. Instead please use 'SliceOfZeros' to replicate current behaviour or 'Loop' for simple incremential integer generation.")
return sliceOfZeros(size)
}

func toFloat64(val interface{}) float64 {
Expand Down Expand Up @@ -244,3 +250,20 @@ func ifThenElse(conditionVal interface{}, thenVal interface{}, elseVal interface
}
return elseVal, nil
}

// sliceOfZeros returns a slice of a constant size all filed with zero.
//
// In-place replacement for deprecated 'Seq'.
func sliceOfZeros(size interface{}) []int {
return make([]int, int(toFloat64(size)))
}

// loop returns a slice with incremential values starting from zero.
func loop(size interface{}) []int {
sizeInt := int(toFloat64(size))
slice := make([]int, sizeInt)
for i := range slice {
slice[i] = i
}
return slice
}
26 changes: 22 additions & 4 deletions clusterloader2/pkg/framework/client/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ func RetryWithExponentialBackOff(fn wait.ConditionFunc) error {
func IsRetryableAPIError(err error) bool {
// These errors may indicate a transient error that we can retry in tests.
if apierrs.IsInternalError(err) || apierrs.IsTimeout(err) || apierrs.IsServerTimeout(err) ||
apierrs.IsTooManyRequests(err) || utilnet.IsProbableEOF(err) || utilnet.IsConnectionReset(err) {
apierrs.IsTooManyRequests(err) || utilnet.IsProbableEOF(err) || utilnet.IsConnectionReset(err) ||
// Retryable resource-quotas conflict errors may be returned in some cases, e.g. https://github.com/kubernetes/kubernetes/issues/67761
isResourceQuotaConflictError(err) ||
// Our client is using OAuth2 where 401 (unauthorized) can mean that our token has expired and we need to retry with a new one.
apierrs.IsUnauthorized(err) {
return true
}
// If the error sends the Retry-After header, we respect it as an explicit confirmation we should retry.
Expand All @@ -73,6 +77,17 @@ func IsRetryableAPIError(err error) bool {
return false
}

func isResourceQuotaConflictError(err error) bool {
apiErr, ok := err.(apierrs.APIStatus)
if !ok {
return false
}
if apiErr.Status().Reason != metav1.StatusReasonConflict {
return false
}
return apiErr.Status().Details != nil && apiErr.Status().Details.Kind == "resourcequotas"
}

// IsRetryableNetError determines whether the error is a retryable net error.
func IsRetryableNetError(err error) bool {
if netError, ok := err.(net.Error); ok {
Expand Down Expand Up @@ -262,7 +277,7 @@ func PatchObject(dynamicClient dynamic.Interface, namespace string, name string,
if err != nil {
return fmt.Errorf("creating patch diff error: %v", err)
}
_, err = dynamicClient.Resource(gvr).Namespace(namespace).Patch(obj.GetName(), types.StrategicMergePatchType, patch, metav1.UpdateOptions{})
_, err = dynamicClient.Resource(gvr).Namespace(namespace).Patch(obj.GetName(), types.MergePatchType, patch, metav1.UpdateOptions{})
return err
}
return RetryWithExponentialBackOff(RetryFunction(updateFunc, options...))
Expand Down Expand Up @@ -309,6 +324,9 @@ func createPatch(current, modified *unstructured.Unstructured) ([]byte, error) {
}
preconditions := []mergepatch.PreconditionFunc{mergepatch.RequireKeyUnchanged("apiVersion"),
mergepatch.RequireKeyUnchanged("kind"), mergepatch.RequireMetadataKeyUnchanged("name")}
// TODO(krzysied): Figure out way to pass original object or figure out way to use CreateTwoWayMergePatch.
return jsonmergepatch.CreateThreeWayJSONMergePatch(nil, modifiedJson, currentJson, preconditions...)
// We are passing nil as original object to CreateThreeWayJSONMergePatch which has a drawback that
// if some field has been deleted between `original` and `modified` object
// (e.g. by removing field in object's yaml), we will never remove that field from 'current'.
// TODO(mborsz): Pass here the original object.
return jsonmergepatch.CreateThreeWayJSONMergePatch(nil /* original */, modifiedJson, currentJson, preconditions...)
}
Loading

0 comments on commit 3326c7b

Please sign in to comment.