mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
vendor files
This commit is contained in:
4
vendor/k8s.io/kubernetes/test/images/logs-generator/BASEIMAGE
generated
vendored
Normal file
4
vendor/k8s.io/kubernetes/test/images/logs-generator/BASEIMAGE
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
amd64=busybox
|
||||
arm=arm32v6/busybox
|
||||
arm64=arm64v8/busybox
|
||||
ppc64le=ppc64le/busybox
|
36
vendor/k8s.io/kubernetes/test/images/logs-generator/BUILD
generated
vendored
Normal file
36
vendor/k8s.io/kubernetes/test/images/logs-generator/BUILD
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_binary",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name = "logs-generator",
|
||||
importpath = "k8s.io/kubernetes/test/images/logs-generator",
|
||||
library = ":go_default_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["logs_generator.go"],
|
||||
importpath = "k8s.io/kubernetes/test/images/logs-generator",
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/rand:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
)
|
22
vendor/k8s.io/kubernetes/test/images/logs-generator/Dockerfile
generated
vendored
Normal file
22
vendor/k8s.io/kubernetes/test/images/logs-generator/Dockerfile
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
# 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 BASEIMAGE
|
||||
|
||||
ENV LOGS_GENERATOR_LINES_TOTAL 1
|
||||
ENV LOGS_GENERATOR_DURATION 1s
|
||||
|
||||
COPY logs-generator /
|
||||
|
||||
CMD ["sh", "-c", "/logs-generator --logtostderr --log-lines-total=${LOGS_GENERATOR_LINES_TOTAL} --run-duration=${LOGS_GENERATOR_DURATION}"]
|
25
vendor/k8s.io/kubernetes/test/images/logs-generator/Makefile
generated
vendored
Normal file
25
vendor/k8s.io/kubernetes/test/images/logs-generator/Makefile
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# 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.
|
||||
|
||||
SRCS=logs-generator
|
||||
ARCH ?= amd64
|
||||
TARGET ?= $(CURDIR)
|
||||
GOLANG_VERSION ?= latest
|
||||
SRC_DIR = $(notdir $(shell pwd))
|
||||
export
|
||||
|
||||
bin:
|
||||
../image-util.sh bin $(SRCS)
|
||||
|
||||
.PHONY: bin
|
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.1
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
docker run -i \
|
||||
-e "LOGS_GENERATOR_LINES_TOTAL=10" \
|
||||
-e "LOGS_GENERATOR_DURATION=1s" \
|
||||
gcr.io/google_containers/logs-generator:v0.1.1
|
||||
```
|
||||
|
||||
```
|
||||
kubectl run logs-generator \
|
||||
--generator=run-pod/v1 \
|
||||
--image=gcr.io/google_containers/logs-generator:v0.1.1 \
|
||||
--restart=Never \
|
||||
--env "LOGS_GENERATOR_LINES_TOTAL=1000" \
|
||||
--env "LOGS_GENERATOR_DURATION=1m"
|
||||
```
|
||||
|
||||
[]()
|
1
vendor/k8s.io/kubernetes/test/images/logs-generator/VERSION
generated
vendored
Normal file
1
vendor/k8s.io/kubernetes/test/images/logs-generator/VERSION
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
1.0
|
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/apimachinery/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)
|
||||
}
|
Reference in New Issue
Block a user