Add glide.yaml and vendor deps
This commit is contained in:
parent
db918f12ad
commit
5b3d5e81bd
18880 changed files with 5166045 additions and 1 deletions
21
vendor/k8s.io/kubernetes/test/images/logs-generator/BUILD
generated
vendored
Normal file
21
vendor/k8s.io/kubernetes/test/images/logs-generator/BUILD
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_binary",
|
||||
"go_library",
|
||||
"go_test",
|
||||
"cgo_library",
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name = "logs-generator",
|
||||
srcs = ["logs_generator.go"],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//pkg/util/rand:go_default_library",
|
||||
"//vendor:github.com/golang/glog",
|
||||
],
|
||||
)
|
||||
23
vendor/k8s.io/kubernetes/test/images/logs-generator/Dockerfile
generated
vendored
Normal file
23
vendor/k8s.io/kubernetes/test/images/logs-generator/Dockerfile
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Copyright 2016 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.
|
||||
|
||||
FROM gcr.io/google_containers/ubuntu-slim:0.4
|
||||
|
||||
MAINTAINER Mik Vyatskov <vmik@google.com>
|
||||
|
||||
COPY logs-generator /
|
||||
|
||||
CMD /logs-generator --logtostderr \
|
||||
--log-lines-total=${LOGS_GENERATOR_LINES_TOTAL} \
|
||||
--run-duration=${LOGS_GENERATOR_DURATION}
|
||||
32
vendor/k8s.io/kubernetes/test/images/logs-generator/Makefile
generated
vendored
Normal file
32
vendor/k8s.io/kubernetes/test/images/logs-generator/Makefile
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Copyright 2016 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.
|
||||
|
||||
TAG = v0.1.0
|
||||
PREFIX = gcr.io/google_containers
|
||||
|
||||
all: build
|
||||
|
||||
build: binary container
|
||||
|
||||
binary:
|
||||
go build -a --ldflags '-w' -o logs-generator .
|
||||
|
||||
container:
|
||||
docker build -t $(PREFIX)/logs-generator:$(TAG) .
|
||||
|
||||
push:
|
||||
gcloud docker -- push $(PREFIX)/logs-generator:$(TAG)
|
||||
|
||||
clean:
|
||||
rm -f logs-generator
|
||||
57
vendor/k8s.io/kubernetes/test/images/logs-generator/README.md
generated
vendored
Normal file
57
vendor/k8s.io/kubernetes/test/images/logs-generator/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# Logs Generator
|
||||
|
||||
## Overview
|
||||
|
||||
Logs generator is a tool to create predictable load on the logs delivery system.
|
||||
Is generates random lines with predictable format and predictable average length.
|
||||
Each line can be later uniquely identified to ensure logs delivery.
|
||||
|
||||
## Usage
|
||||
|
||||
Tool is parametrized with the total number of number that should be generated and the duration of
|
||||
the generation process. For example, if you want to create a throughput of 100 lines per second
|
||||
for a minute, you set total number of lines to 6000 and duration to 1 minute.
|
||||
|
||||
Parameters are passed through environment variables. There are no defaults, you should always
|
||||
set up container parameters. Total number of line is parametrized through env variable
|
||||
`LOGS_GENERATOR_LINES_TOTAL` and duration in go format is parametrized through env variable
|
||||
`LOGS_GENERATOR_DURATION`.
|
||||
|
||||
Inside the container all log lines are written to the stdout.
|
||||
|
||||
Each line is on average 100 bytes long and follows this pattern:
|
||||
|
||||
```
|
||||
2000-12-31T12:59:59Z <id> <method> /api/v1/namespaces/<namespace>/endpoints/<random_string> <random_number>
|
||||
```
|
||||
|
||||
Where `<id>` refers to the number from 0 to `total_lines - 1`, which is unique for each
|
||||
line in a given run of the container.
|
||||
|
||||
## Image
|
||||
|
||||
Image is located in the public repository of Google Container Registry under the name
|
||||
|
||||
```
|
||||
gcr.io/google_containers/logs-generator:v0.1.0
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
docker run -i \
|
||||
-e "LOGS_GENERATOR_LINES_TOTAL=10" \
|
||||
-e "LOGS_GENERATOR_DURATION=1s" \
|
||||
gcr.io/google_containers/logs-generator:v0.1.0
|
||||
```
|
||||
|
||||
```
|
||||
kubectl run logs-generator \
|
||||
--generator=run-pod/v1 \
|
||||
--image=gcr.io/google_containers/logs-generator:v0.1.0 \
|
||||
--restart=Never \
|
||||
--env "LOGS_GENERATOR_LINES_TOTAL=1000" \
|
||||
--env "LOGS_GENERATOR_DURATION=1m"
|
||||
```
|
||||
|
||||
[]()
|
||||
82
vendor/k8s.io/kubernetes/test/images/logs-generator/logs_generator.go
generated
vendored
Normal file
82
vendor/k8s.io/kubernetes/test/images/logs-generator/logs_generator.go
generated
vendored
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
Copyright 2016 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 main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/kubernetes/pkg/util/rand"
|
||||
)
|
||||
|
||||
var (
|
||||
httpMethods = []string{
|
||||
"GET",
|
||||
"POST",
|
||||
"PUT",
|
||||
}
|
||||
namespaces = []string{
|
||||
"kube-system",
|
||||
"default",
|
||||
"ns",
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
linesTotal = flag.Int("log-lines-total", 0, "Total lines that should be generated by the end of the run")
|
||||
duration = flag.Duration("run-duration", 0, "Total duration of the run")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
if *linesTotal <= 0 {
|
||||
glog.Fatalf("Invalid total number of lines: %d", *linesTotal)
|
||||
}
|
||||
|
||||
if *duration <= 0 {
|
||||
glog.Fatalf("Invalid duration: %v", *duration)
|
||||
}
|
||||
|
||||
generateLogs(*linesTotal, *duration)
|
||||
}
|
||||
|
||||
// Outputs linesTotal lines of logs to stdout uniformly for duration
|
||||
func generateLogs(linesTotal int, duration time.Duration) {
|
||||
delay := duration / time.Duration(linesTotal)
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
tick := time.Tick(delay)
|
||||
for id := 0; id < linesTotal; id++ {
|
||||
glog.Info(generateLogLine(id))
|
||||
<-tick
|
||||
}
|
||||
}
|
||||
|
||||
// Generates apiserver-like line with average length of 100 symbols
|
||||
func generateLogLine(id int) string {
|
||||
method := httpMethods[rand.Intn(len(httpMethods))]
|
||||
namespace := namespaces[rand.Intn(len(namespaces))]
|
||||
|
||||
podName := rand.String(rand.IntnRange(3, 5))
|
||||
url := fmt.Sprintf("/api/v1/namespaces/%s/pods/%s", namespace, podName)
|
||||
status := rand.IntnRange(200, 600)
|
||||
|
||||
return fmt.Sprintf("%d %s %s %d", id, method, url, status)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue