mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
test images: Centralizes images into agnhost (part 1)
Centralizes the following images into agnhost: - fakegitserver - hostexec - liveness - logs-generator - no-snat-test - no-snat-test-proxy - port-forward-tester
This commit is contained in:
parent
99e2646067
commit
76550ea8b8
@ -17,17 +17,11 @@ filegroup(
|
|||||||
"//test/images/crd-conversion-webhook:all-srcs",
|
"//test/images/crd-conversion-webhook:all-srcs",
|
||||||
"//test/images/echoserver:all-srcs",
|
"//test/images/echoserver:all-srcs",
|
||||||
"//test/images/entrypoint-tester:all-srcs",
|
"//test/images/entrypoint-tester:all-srcs",
|
||||||
"//test/images/fakegitserver:all-srcs",
|
|
||||||
"//test/images/inclusterclient:all-srcs",
|
"//test/images/inclusterclient:all-srcs",
|
||||||
"//test/images/liveness:all-srcs",
|
|
||||||
"//test/images/logs-generator:all-srcs",
|
|
||||||
"//test/images/metadata-concealment:all-srcs",
|
"//test/images/metadata-concealment:all-srcs",
|
||||||
"//test/images/mounttest:all-srcs",
|
"//test/images/mounttest:all-srcs",
|
||||||
"//test/images/no-snat-test:all-srcs",
|
|
||||||
"//test/images/no-snat-test-proxy:all-srcs",
|
|
||||||
"//test/images/nonewprivs:all-srcs",
|
"//test/images/nonewprivs:all-srcs",
|
||||||
"//test/images/pets/peer-finder:all-srcs",
|
"//test/images/pets/peer-finder:all-srcs",
|
||||||
"//test/images/port-forward-tester:all-srcs",
|
|
||||||
"//test/images/porter:all-srcs",
|
"//test/images/porter:all-srcs",
|
||||||
"//test/images/regression-issue-74839:all-srcs",
|
"//test/images/regression-issue-74839:all-srcs",
|
||||||
"//test/images/resource-consumer:all-srcs",
|
"//test/images/resource-consumer:all-srcs",
|
||||||
|
@ -17,10 +17,16 @@ go_library(
|
|||||||
importpath = "k8s.io/kubernetes/test/images/agnhost",
|
importpath = "k8s.io/kubernetes/test/images/agnhost",
|
||||||
deps = [
|
deps = [
|
||||||
"//test/images/agnhost/dns:go_default_library",
|
"//test/images/agnhost/dns:go_default_library",
|
||||||
|
"//test/images/agnhost/fakegitserver:go_default_library",
|
||||||
|
"//test/images/agnhost/liveness:go_default_library",
|
||||||
|
"//test/images/agnhost/logs-generator:go_default_library",
|
||||||
"//test/images/agnhost/net:go_default_library",
|
"//test/images/agnhost/net:go_default_library",
|
||||||
"//test/images/agnhost/netexec:go_default_library",
|
"//test/images/agnhost/netexec:go_default_library",
|
||||||
"//test/images/agnhost/nettest:go_default_library",
|
"//test/images/agnhost/nettest:go_default_library",
|
||||||
|
"//test/images/agnhost/no-snat-test:go_default_library",
|
||||||
|
"//test/images/agnhost/no-snat-test-proxy:go_default_library",
|
||||||
"//test/images/agnhost/pause:go_default_library",
|
"//test/images/agnhost/pause:go_default_library",
|
||||||
|
"//test/images/agnhost/port-forward-tester:go_default_library",
|
||||||
"//test/images/agnhost/webhook:go_default_library",
|
"//test/images/agnhost/webhook:go_default_library",
|
||||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
"//vendor/k8s.io/klog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
@ -39,10 +45,16 @@ filegroup(
|
|||||||
srcs = [
|
srcs = [
|
||||||
":package-srcs",
|
":package-srcs",
|
||||||
"//test/images/agnhost/dns:all-srcs",
|
"//test/images/agnhost/dns:all-srcs",
|
||||||
|
"//test/images/agnhost/fakegitserver:all-srcs",
|
||||||
|
"//test/images/agnhost/liveness:all-srcs",
|
||||||
|
"//test/images/agnhost/logs-generator:all-srcs",
|
||||||
"//test/images/agnhost/net:all-srcs",
|
"//test/images/agnhost/net:all-srcs",
|
||||||
"//test/images/agnhost/netexec:all-srcs",
|
"//test/images/agnhost/netexec:all-srcs",
|
||||||
"//test/images/agnhost/nettest:all-srcs",
|
"//test/images/agnhost/nettest:all-srcs",
|
||||||
|
"//test/images/agnhost/no-snat-test:all-srcs",
|
||||||
|
"//test/images/agnhost/no-snat-test-proxy:all-srcs",
|
||||||
"//test/images/agnhost/pause:all-srcs",
|
"//test/images/agnhost/pause:all-srcs",
|
||||||
|
"//test/images/agnhost/port-forward-tester:all-srcs",
|
||||||
"//test/images/agnhost/webhook:all-srcs",
|
"//test/images/agnhost/webhook:all-srcs",
|
||||||
],
|
],
|
||||||
tags = ["automanaged"],
|
tags = ["automanaged"],
|
||||||
|
@ -22,6 +22,10 @@ CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
|
|||||||
# - iproute2: includes ss used in NodePort tests
|
# - iproute2: includes ss used in NodePort tests
|
||||||
RUN apk --update add curl netcat-openbsd iproute2 && rm -rf /var/cache/apk/*
|
RUN apk --update add curl netcat-openbsd iproute2 && rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
# from logs-generator
|
||||||
|
ENV LOGS_GENERATOR_LINES_TOTAL 1
|
||||||
|
ENV LOGS_GENERATOR_DURATION 1s
|
||||||
|
|
||||||
# PORT 8080 needed by: netexec, nettest
|
# PORT 8080 needed by: netexec, nettest
|
||||||
# PORT 8081 needed by: netexec
|
# PORT 8081 needed by: netexec
|
||||||
EXPOSE 8080 8081
|
EXPOSE 8080 8081
|
||||||
@ -31,3 +35,4 @@ RUN mkdir /uploads
|
|||||||
|
|
||||||
ADD agnhost agnhost
|
ADD agnhost agnhost
|
||||||
ENTRYPOINT ["/agnhost"]
|
ENTRYPOINT ["/agnhost"]
|
||||||
|
CMD ["pause"]
|
||||||
|
@ -17,18 +17,8 @@ cases for the same tested behaviour.
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
The `agnhost` binary is a CLI with the following subcommands:
|
The `agnhost` binary has several subcommands which are can be used to test different
|
||||||
|
Kubernetes features; their behaviour and output is not affected by the underlying OS.
|
||||||
- `dns-suffix`: It will output the host's configured DNS suffix list, separated by commas.
|
|
||||||
- `dns-server-list`: It will output the host's configured DNS servers, separated by commas.
|
|
||||||
- `etc-hosts`: It will output the contents of host's `hosts` file. This file's location
|
|
||||||
is `/etc/hosts` on Linux, while on Windows it is `C:/Windows/System32/drivers/etc/hosts`.
|
|
||||||
- `pause`: It will pause the execution of the binary. This can be used for containers
|
|
||||||
which have to be kept in a `Running` state for various purposes, including executing
|
|
||||||
other `agnhost` commands.
|
|
||||||
- `help`: Prints the binary's help menu. Additionally, it can be followed by another
|
|
||||||
subcommand in order to get more information about that subcommand, including its
|
|
||||||
possible arguments.
|
|
||||||
|
|
||||||
For example, let's consider the following `pod.yaml` file:
|
For example, let's consider the following `pod.yaml` file:
|
||||||
|
|
||||||
@ -74,6 +64,123 @@ created with the `pause` argument instead, allowing us execute multiple commands
|
|||||||
|
|
||||||
The `agnhost` binary is a CLI with the following subcommands:
|
The `agnhost` binary is a CLI with the following subcommands:
|
||||||
|
|
||||||
|
|
||||||
|
### dns-server-list
|
||||||
|
|
||||||
|
It will output the host's configured DNS servers, separated by commas.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl exec test-agnhost -- /agnhost dns-server-list
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### dns-suffix
|
||||||
|
|
||||||
|
It will output the host's configured DNS suffix list, separated by commas.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl exec test-agnhost -- /agnhost dns-suffix
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### etc-hosts
|
||||||
|
|
||||||
|
It will output the contents of host's `hosts` file. This file's location is `/etc/hosts`
|
||||||
|
on Linux, while on Windows it is `C:/Windows/System32/drivers/etc/hosts`.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl exec test-agnhost -- /agnhost etc-hosts
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### fake-gitserver
|
||||||
|
|
||||||
|
Fakes a git server. When doing `git clone localhost:8000`, you will clone an empty git
|
||||||
|
repo named `8000` on local. You can also use `git clone localhost:8000 my-repo-name` to
|
||||||
|
rename that repo.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl exec test-agnhost -- /agnhost fake-gitserver
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### help
|
||||||
|
|
||||||
|
Prints the binary's help menu. Additionally, it can be followed by another subcommand
|
||||||
|
in order to get more information about that subcommand, including its possible arguments.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl exec test-agnhost -- /agnhost help
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### liveness
|
||||||
|
|
||||||
|
Starts a simple server that is alive for 10 seconds, then reports unhealthy for the rest
|
||||||
|
of its (hopefully) short existence.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl exec test-agnhost -- /agnhost liveness
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### logs-generator
|
||||||
|
|
||||||
|
The `logs-generator` subcommand is a tool to create predictable load on the logs delivery system.
|
||||||
|
It generates random lines with predictable format and predictable average length.
|
||||||
|
Each line can be later uniquely identified to ensure logs delivery.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
```console
|
||||||
|
docker run -i \
|
||||||
|
gcr.io/kubernetes-e2e-test-images/agnhost:1.1 \
|
||||||
|
logs-generator --log-lines-total 10 --run-duration 1
|
||||||
|
```
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl run logs-generator \
|
||||||
|
--generator=run-pod/v1 \
|
||||||
|
--image=gcr.io/kubernetes-e2e-test-images/agnhost:1.1 \
|
||||||
|
--restart=Never \
|
||||||
|
-- logs-generator -t 10 -d 1
|
||||||
|
```
|
||||||
|
|
||||||
|
[]()
|
||||||
|
|
||||||
|
|
||||||
### net
|
### net
|
||||||
|
|
||||||
The goal of this Go project is to consolidate all low-level
|
The goal of this Go project is to consolidate all low-level
|
||||||
@ -173,6 +280,93 @@ Usage:
|
|||||||
kubectl exec test-agnhost -- /agnhost nettest [--port <port>] [--peers <peers>] [--service <service>] [--namespace <namespace>] [--delay-shutdown <delay>]
|
kubectl exec test-agnhost -- /agnhost nettest [--port <port>] [--peers <peers>] [--service <service>] [--namespace <namespace>] [--delay-shutdown <delay>]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### no-snat-test
|
||||||
|
|
||||||
|
The subcommand requires the following environment variables to be set, and they should be
|
||||||
|
valid IP addresses:
|
||||||
|
|
||||||
|
- `POD_IP`
|
||||||
|
- `NODE_IP`
|
||||||
|
|
||||||
|
Serves the following endpoints on the given port (defaults to `8080`).
|
||||||
|
|
||||||
|
- `/whoami` - returns the request's IP address.
|
||||||
|
- `/checknosnat` - queries `ip/whoami` for each provided IP (`/checknosnat?ips=ip1,ip2`),
|
||||||
|
and if all the response bodies match the `POD_IP`, it will return a 200 response, 500 otherwise.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl run test-agnhost \
|
||||||
|
--generator=run-pod/v1 \
|
||||||
|
--image=gcr.io/kubernetes-e2e-test-images/agnhost:1.1 \
|
||||||
|
--restart=Never \
|
||||||
|
--env "POD_IP=<POD_IP>" \
|
||||||
|
--env "NODE_IP=<NODE_IP>" \
|
||||||
|
-- no-snat-test [--port <port>]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### no-snat-test-proxy
|
||||||
|
|
||||||
|
Serves the `/checknosnat` endpoint on the given port (defaults to `31235`). The endpoint
|
||||||
|
proxies the request to the given `target` (`/checknosnat?target=target_ip&ips=ip1,ip2`
|
||||||
|
-> `target_ip/checknosnat?ips=ip1,ip2`) and will return the same status as the status
|
||||||
|
as the proxied request, or 500 on error.
|
||||||
|
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl exec test-agnhost -- /agnhost no-snat-test-proxy [--port <port>]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### pause
|
||||||
|
|
||||||
|
It will pause the execution of the binary. This can be used for containers
|
||||||
|
which have to be kept in a `Running` state for various purposes, including
|
||||||
|
executing other `agnhost` commands.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl exec test-agnhost -- /agnhost pause
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### port-forward-tester
|
||||||
|
|
||||||
|
Listens for TCP connections on a given address and port, optionally checks the data received,
|
||||||
|
and sends a configurable number of data chunks, with a configurable interval between chunks.
|
||||||
|
|
||||||
|
The subcommand is using the following environment variables:
|
||||||
|
|
||||||
|
- `BIND_ADDRESS` (optional): The address on which it will start listening for TCP connections (default value: `localhost`)
|
||||||
|
- `BIND_PORT`: The port on which it will start listening for TCP connections.
|
||||||
|
- `EXPECTED_CLIENT_DATA` (optional): If set, it will check that the request sends the same exact data.
|
||||||
|
- `CHUNKS`: How many chunks of data to write in the response.
|
||||||
|
- `CHUNK_SIZE`: The expected size of each written chunk of data. If it does not match the actual size of the written data, it will exit with the exit code `4`.
|
||||||
|
- `CHUNK_INTERVAL`: The amount of time to wait in between chunks.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl run test-agnhost \
|
||||||
|
--generator=run-pod/v1 \
|
||||||
|
--image=gcr.io/kubernetes-e2e-test-images/agnhost:1.1 \
|
||||||
|
--restart=Never \
|
||||||
|
--env "BIND_ADDRESS=localhost" \
|
||||||
|
--env "BIND_PORT=8080" \
|
||||||
|
--env "EXPECTED_CLIENT_DATA='Hello there!'" \
|
||||||
|
--env "CHUNKS=1" \
|
||||||
|
--env "CHUNK_SIZE=10" \
|
||||||
|
--env "CHUNK_INTERVAL=1" \
|
||||||
|
-- port-forward-tester
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### webhook (Kubernetes External Admission Webhook)
|
### webhook (Kubernetes External Admission Webhook)
|
||||||
|
|
||||||
The subcommand tests MutatingAdmissionWebhook and ValidatingAdmissionWebhook. After deploying
|
The subcommand tests MutatingAdmissionWebhook and ValidatingAdmissionWebhook. After deploying
|
||||||
@ -191,6 +385,6 @@ Usage:
|
|||||||
|
|
||||||
## Image
|
## Image
|
||||||
|
|
||||||
The image can be found at `gcr.io/kubernetes-e2e-test-images/agnhost:2.1` for Linux
|
The image can be found at `gcr.io/kubernetes-e2e-test-images/agnhost:1.1` for Linux
|
||||||
containers, and `e2eteam/agnhost:2.1` for Windows containers. In the future, the same
|
containers, and `e2eteam/agnhost:1.1` for Windows containers. In the future, the same
|
||||||
repository can be used for both OSes.
|
repository can be used for both OSes.
|
||||||
|
@ -23,10 +23,16 @@ import (
|
|||||||
|
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
"k8s.io/kubernetes/test/images/agnhost/dns"
|
"k8s.io/kubernetes/test/images/agnhost/dns"
|
||||||
|
"k8s.io/kubernetes/test/images/agnhost/fakegitserver"
|
||||||
|
"k8s.io/kubernetes/test/images/agnhost/liveness"
|
||||||
|
"k8s.io/kubernetes/test/images/agnhost/logs-generator"
|
||||||
"k8s.io/kubernetes/test/images/agnhost/net"
|
"k8s.io/kubernetes/test/images/agnhost/net"
|
||||||
"k8s.io/kubernetes/test/images/agnhost/netexec"
|
"k8s.io/kubernetes/test/images/agnhost/netexec"
|
||||||
"k8s.io/kubernetes/test/images/agnhost/nettest"
|
"k8s.io/kubernetes/test/images/agnhost/nettest"
|
||||||
|
"k8s.io/kubernetes/test/images/agnhost/no-snat-test"
|
||||||
|
"k8s.io/kubernetes/test/images/agnhost/no-snat-test-proxy"
|
||||||
"k8s.io/kubernetes/test/images/agnhost/pause"
|
"k8s.io/kubernetes/test/images/agnhost/pause"
|
||||||
|
"k8s.io/kubernetes/test/images/agnhost/port-forward-tester"
|
||||||
"k8s.io/kubernetes/test/images/agnhost/webhook"
|
"k8s.io/kubernetes/test/images/agnhost/webhook"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -35,10 +41,16 @@ func main() {
|
|||||||
rootCmd.AddCommand(dns.CmdDNSSuffix)
|
rootCmd.AddCommand(dns.CmdDNSSuffix)
|
||||||
rootCmd.AddCommand(dns.CmdDNSServerList)
|
rootCmd.AddCommand(dns.CmdDNSServerList)
|
||||||
rootCmd.AddCommand(dns.CmdEtcHosts)
|
rootCmd.AddCommand(dns.CmdEtcHosts)
|
||||||
|
rootCmd.AddCommand(fakegitserver.CmdFakeGitServer)
|
||||||
|
rootCmd.AddCommand(liveness.CmdLiveness)
|
||||||
|
rootCmd.AddCommand(logsgen.CmdLogsGenerator)
|
||||||
rootCmd.AddCommand(net.CmdNet)
|
rootCmd.AddCommand(net.CmdNet)
|
||||||
rootCmd.AddCommand(netexec.CmdNetexec)
|
rootCmd.AddCommand(netexec.CmdNetexec)
|
||||||
rootCmd.AddCommand(nettest.CmdNettest)
|
rootCmd.AddCommand(nettest.CmdNettest)
|
||||||
|
rootCmd.AddCommand(nosnat.CmdNoSnatTest)
|
||||||
|
rootCmd.AddCommand(nosnatproxy.CmdNoSnatTestProxy)
|
||||||
rootCmd.AddCommand(pause.CmdPause)
|
rootCmd.AddCommand(pause.CmdPause)
|
||||||
|
rootCmd.AddCommand(portforwardtester.CmdPortForwardTester)
|
||||||
rootCmd.AddCommand(webhook.CmdWebhook)
|
rootCmd.AddCommand(webhook.CmdWebhook)
|
||||||
|
|
||||||
// NOTE(claudiub): Some tests are passing logging related flags, so we need to be able to
|
// NOTE(claudiub): Some tests are passing logging related flags, so we need to be able to
|
||||||
|
@ -2,19 +2,14 @@ package(default_visibility = ["//visibility:public"])
|
|||||||
|
|
||||||
load(
|
load(
|
||||||
"@io_bazel_rules_go//go:def.bzl",
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
"go_binary",
|
|
||||||
"go_library",
|
"go_library",
|
||||||
)
|
)
|
||||||
|
|
||||||
go_binary(
|
|
||||||
name = "fakegitserver",
|
|
||||||
embed = [":go_default_library"],
|
|
||||||
)
|
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = ["gitserver.go"],
|
srcs = ["gitserver.go"],
|
||||||
importpath = "k8s.io/kubernetes/test/images/fakegitserver",
|
importpath = "k8s.io/kubernetes/test/images/agnhost/fakegitserver",
|
||||||
|
deps = ["//vendor/github.com/spf13/cobra:go_default_library"],
|
||||||
)
|
)
|
||||||
|
|
||||||
filegroup(
|
filegroup(
|
@ -14,13 +14,25 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package main
|
package fakegitserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CmdFakeGitServer is used by agnhost Cobra.
|
||||||
|
var CmdFakeGitServer = &cobra.Command{
|
||||||
|
Use: "fake-gitserver",
|
||||||
|
Short: "Fakes a git server",
|
||||||
|
Long: `When doing "git clone localhost:8000", you will clone an empty git repo named "8000" on local.
|
||||||
|
You can also use "git clone localhost:8000 my-repo-name" to rename that repo.`,
|
||||||
|
Args: cobra.MaximumNArgs(0),
|
||||||
|
Run: main,
|
||||||
|
}
|
||||||
|
|
||||||
func hello(w http.ResponseWriter, r *http.Request) {
|
func hello(w http.ResponseWriter, r *http.Request) {
|
||||||
io.WriteString(w, "I am a fake git server")
|
io.WriteString(w, "I am a fake git server")
|
||||||
|
|
||||||
@ -28,7 +40,7 @@ func hello(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
// When doing `git clone localhost:8000`, you will clone an empty git repo named "8000" on local.
|
// When doing `git clone localhost:8000`, you will clone an empty git repo named "8000" on local.
|
||||||
// You can also use `git clone localhost:8000 my-repo-name` to rename that repo.
|
// You can also use `git clone localhost:8000 my-repo-name` to rename that repo.
|
||||||
func main() {
|
func main(cmd *cobra.Command, args []string) {
|
||||||
http.HandleFunc("/", hello)
|
http.HandleFunc("/", hello)
|
||||||
http.ListenAndServe(":8000", nil)
|
http.ListenAndServe(":8000", nil)
|
||||||
}
|
}
|
@ -2,19 +2,16 @@ package(default_visibility = ["//visibility:public"])
|
|||||||
|
|
||||||
load(
|
load(
|
||||||
"@io_bazel_rules_go//go:def.bzl",
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
"go_binary",
|
|
||||||
"go_library",
|
"go_library",
|
||||||
)
|
)
|
||||||
|
|
||||||
go_binary(
|
|
||||||
name = "liveness",
|
|
||||||
embed = [":go_default_library"],
|
|
||||||
)
|
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = ["server.go"],
|
srcs = ["server.go"],
|
||||||
importpath = "k8s.io/kubernetes/test/images/liveness",
|
importpath = "k8s.io/kubernetes/test/images/agnhost/liveness",
|
||||||
|
deps = [
|
||||||
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
filegroup(
|
filegroup(
|
@ -16,7 +16,8 @@ limitations under the License.
|
|||||||
|
|
||||||
// A simple server that is alive for 10 seconds, then reports unhealthy for
|
// A simple server that is alive for 10 seconds, then reports unhealthy for
|
||||||
// the rest of its (hopefully) short existence.
|
// the rest of its (hopefully) short existence.
|
||||||
package main
|
|
||||||
|
package liveness
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -24,9 +25,20 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
// CmdLiveness is used by agnhost Cobra.
|
||||||
|
var CmdLiveness = &cobra.Command{
|
||||||
|
Use: "liveness",
|
||||||
|
Short: "Starts a server that is alive for 10 seconds",
|
||||||
|
Long: "A simple server that is alive for 10 seconds, then reports unhealthy for the rest of its (hopefully) short existence",
|
||||||
|
Args: cobra.MaximumNArgs(0),
|
||||||
|
Run: main,
|
||||||
|
}
|
||||||
|
|
||||||
|
func main(cmd *cobra.Command, args []string) {
|
||||||
started := time.Now()
|
started := time.Now()
|
||||||
http.HandleFunc("/started", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/started", func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(200)
|
w.WriteHeader(200)
|
@ -2,21 +2,16 @@ package(default_visibility = ["//visibility:public"])
|
|||||||
|
|
||||||
load(
|
load(
|
||||||
"@io_bazel_rules_go//go:def.bzl",
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
"go_binary",
|
|
||||||
"go_library",
|
"go_library",
|
||||||
)
|
)
|
||||||
|
|
||||||
go_binary(
|
|
||||||
name = "logs-generator",
|
|
||||||
embed = [":go_default_library"],
|
|
||||||
)
|
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = ["logs_generator.go"],
|
srcs = ["logs_generator.go"],
|
||||||
importpath = "k8s.io/kubernetes/test/images/logs-generator",
|
importpath = "k8s.io/kubernetes/test/images/agnhost/logs-generator",
|
||||||
deps = [
|
deps = [
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/rand:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/rand:go_default_library",
|
||||||
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
"//vendor/k8s.io/klog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
@ -14,13 +14,14 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package main
|
package logsgen
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/util/rand"
|
"k8s.io/apimachinery/pkg/util/rand"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
@ -38,27 +39,35 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CmdLogsGenerator is used by agnhost Cobra.
|
||||||
|
var CmdLogsGenerator = &cobra.Command{
|
||||||
|
Use: "logs-generator",
|
||||||
|
Short: "Outputs lines of logs to stdout uniformly",
|
||||||
|
Long: "Outputs <linesTotal> lines of logs to stdout uniformly for <duration>",
|
||||||
|
Args: cobra.MaximumNArgs(2),
|
||||||
|
Run: generateLogs,
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
linesTotal = flag.Int("log-lines-total", 0, "Total lines that should be generated by the end of the run")
|
linesTotal int
|
||||||
duration = flag.Duration("run-duration", 0, "Total duration of the run")
|
duration time.Duration
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func init() {
|
||||||
flag.Parse()
|
CmdLogsGenerator.Flags().IntVarP(&linesTotal, "log-lines-total", "t", 0, "Total lines that should be generated by the end of the run")
|
||||||
|
CmdLogsGenerator.Flags().DurationVarP(&duration, "run-duration", "d", 0, "Total duration of the run")
|
||||||
if *linesTotal <= 0 {
|
|
||||||
klog.Fatalf("Invalid total number of lines: %d", *linesTotal)
|
|
||||||
}
|
|
||||||
|
|
||||||
if *duration <= 0 {
|
|
||||||
klog.Fatalf("Invalid duration: %v", *duration)
|
|
||||||
}
|
|
||||||
|
|
||||||
generateLogs(*linesTotal, *duration)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Outputs linesTotal lines of logs to stdout uniformly for duration
|
// Outputs linesTotal lines of logs to stdout uniformly for duration
|
||||||
func generateLogs(linesTotal int, duration time.Duration) {
|
func generateLogs(cmd *cobra.Command, args []string) {
|
||||||
|
if linesTotal <= 0 {
|
||||||
|
klog.Fatalf("Invalid total number of lines: %d", linesTotal)
|
||||||
|
}
|
||||||
|
|
||||||
|
if duration <= 0 {
|
||||||
|
klog.Fatalf("Invalid duration: %v", duration)
|
||||||
|
}
|
||||||
|
|
||||||
delay := duration / time.Duration(linesTotal)
|
delay := duration / time.Duration(linesTotal)
|
||||||
|
|
||||||
ticker := time.NewTicker(delay)
|
ticker := time.NewTicker(delay)
|
@ -2,23 +2,16 @@ package(default_visibility = ["//visibility:public"])
|
|||||||
|
|
||||||
load(
|
load(
|
||||||
"@io_bazel_rules_go//go:def.bzl",
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
"go_binary",
|
|
||||||
"go_library",
|
"go_library",
|
||||||
)
|
)
|
||||||
|
|
||||||
go_binary(
|
|
||||||
name = "no-snat-test",
|
|
||||||
embed = [":go_default_library"],
|
|
||||||
)
|
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = ["main.go"],
|
srcs = ["main.go"],
|
||||||
importpath = "k8s.io/kubernetes/test/images/no-snat-test",
|
importpath = "k8s.io/kubernetes/test/images/agnhost/no-snat-test-proxy",
|
||||||
deps = [
|
deps = [
|
||||||
"//staging/src/k8s.io/component-base/cli/flag:go_default_library",
|
|
||||||
"//staging/src/k8s.io/component-base/logs:go_default_library",
|
"//staging/src/k8s.io/component-base/logs:go_default_library",
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package main
|
package nosnatproxy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -22,32 +22,36 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/cobra"
|
||||||
cliflag "k8s.io/component-base/cli/flag"
|
|
||||||
"k8s.io/component-base/logs"
|
"k8s.io/component-base/logs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CmdNoSnatTestProxy is used by agnhost Cobra.
|
||||||
|
var CmdNoSnatTestProxy = &cobra.Command{
|
||||||
|
Use: "no-snat-test-proxy",
|
||||||
|
Short: "Creates a proxy for the /checknosnat endpoint",
|
||||||
|
Long: `Creates the /checknosnat endpoint which proxies the request to the given target (/checknosnat?target=target_ip&ips=ip1,ip2) and returns its response, or a 500 response on error.`,
|
||||||
|
Args: cobra.MaximumNArgs(1),
|
||||||
|
Run: main,
|
||||||
|
}
|
||||||
|
|
||||||
|
var port string
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
CmdNoSnatTestProxy.Flags().StringVar(&port, "port", "31235", "The port to serve /checknosnat endpoint on.")
|
||||||
|
}
|
||||||
|
|
||||||
// This Pod's /checknosnat takes `target` and `ips` arguments, and queries {target}/checknosnat?ips={ips}
|
// This Pod's /checknosnat takes `target` and `ips` arguments, and queries {target}/checknosnat?ips={ips}
|
||||||
|
|
||||||
type masqTestProxy struct {
|
type masqTestProxy struct {
|
||||||
Port string
|
Port string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMasqTestProxy() *masqTestProxy {
|
func main(cmd *cobra.Command, args []string) {
|
||||||
return &masqTestProxy{
|
m := &masqTestProxy{
|
||||||
Port: "31235",
|
Port: port,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func (m *masqTestProxy) AddFlags(fs *pflag.FlagSet) {
|
|
||||||
fs.StringVar(&m.Port, "port", m.Port, "The port to serve /checknosnat endpoint on.")
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
m := newMasqTestProxy()
|
|
||||||
m.AddFlags(pflag.CommandLine)
|
|
||||||
|
|
||||||
cliflag.InitFlags()
|
|
||||||
logs.InitLogs()
|
logs.InitLogs()
|
||||||
defer logs.FlushLogs()
|
defer logs.FlushLogs()
|
||||||
|
|
@ -2,23 +2,16 @@ package(default_visibility = ["//visibility:public"])
|
|||||||
|
|
||||||
load(
|
load(
|
||||||
"@io_bazel_rules_go//go:def.bzl",
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
"go_binary",
|
|
||||||
"go_library",
|
"go_library",
|
||||||
)
|
)
|
||||||
|
|
||||||
go_binary(
|
|
||||||
name = "no-snat-test-proxy",
|
|
||||||
embed = [":go_default_library"],
|
|
||||||
)
|
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = ["main.go"],
|
srcs = ["main.go"],
|
||||||
importpath = "k8s.io/kubernetes/test/images/no-snat-test-proxy",
|
importpath = "k8s.io/kubernetes/test/images/agnhost/no-snat-test",
|
||||||
deps = [
|
deps = [
|
||||||
"//staging/src/k8s.io/component-base/cli/flag:go_default_library",
|
|
||||||
"//staging/src/k8s.io/component-base/logs:go_default_library",
|
"//staging/src/k8s.io/component-base/logs:go_default_library",
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package main
|
package nosnat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -24,11 +24,29 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/cobra"
|
||||||
cliflag "k8s.io/component-base/cli/flag"
|
|
||||||
"k8s.io/component-base/logs"
|
"k8s.io/component-base/logs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CmdNoSnatTest is used by agnhost Cobra.
|
||||||
|
var CmdNoSnatTest = &cobra.Command{
|
||||||
|
Use: "no-snat-test",
|
||||||
|
Short: "Creates the /checknosnat and /whoami endpoints",
|
||||||
|
Long: `Serves the following endpoints on the given port (defaults to "8080").
|
||||||
|
|
||||||
|
- /whoami - returns the request's IP address.
|
||||||
|
- /checknosnat - queries "ip/whoami" for each provided IP ("/checknosnat?ips=ip1,ip2"),
|
||||||
|
and if all the response bodies match the "POD_IP" environment variable, it will return a 200 response, 500 otherwise.`,
|
||||||
|
Args: cobra.MaximumNArgs(1),
|
||||||
|
Run: main,
|
||||||
|
}
|
||||||
|
|
||||||
|
var port string
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
CmdNoSnatTest.Flags().StringVar(&port, "port", "8080", "The port to serve /checknosnat and /whoami endpoints on.")
|
||||||
|
}
|
||||||
|
|
||||||
// ip = target for /whoami query
|
// ip = target for /whoami query
|
||||||
// rip = returned ip
|
// rip = returned ip
|
||||||
// pip = this pod's ip
|
// pip = this pod's ip
|
||||||
@ -38,21 +56,11 @@ type masqTester struct {
|
|||||||
Port string
|
Port string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMasqTester() *masqTester {
|
func main(cmd *cobra.Command, args []string) {
|
||||||
return &masqTester{
|
m := &masqTester{
|
||||||
Port: "8080",
|
Port: port,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func (m *masqTester) AddFlags(fs *pflag.FlagSet) {
|
|
||||||
fs.StringVar(&m.Port, "port", m.Port, "The port to serve /checknosnat and /whoami endpoints on.")
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
m := newMasqTester()
|
|
||||||
m.AddFlags(pflag.CommandLine)
|
|
||||||
|
|
||||||
cliflag.InitFlags()
|
|
||||||
logs.InitLogs()
|
logs.InitLogs()
|
||||||
defer logs.FlushLogs()
|
defer logs.FlushLogs()
|
||||||
|
|
@ -2,19 +2,14 @@ package(default_visibility = ["//visibility:public"])
|
|||||||
|
|
||||||
load(
|
load(
|
||||||
"@io_bazel_rules_go//go:def.bzl",
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
"go_binary",
|
|
||||||
"go_library",
|
"go_library",
|
||||||
)
|
)
|
||||||
|
|
||||||
go_binary(
|
|
||||||
name = "port-forward-tester",
|
|
||||||
embed = [":go_default_library"],
|
|
||||||
)
|
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = ["portforwardtester.go"],
|
srcs = ["portforwardtester.go"],
|
||||||
importpath = "k8s.io/kubernetes/test/images/port-forward-tester",
|
importpath = "k8s.io/kubernetes/test/images/agnhost/port-forward-tester",
|
||||||
|
deps = ["//vendor/github.com/spf13/cobra:go_default_library"],
|
||||||
)
|
)
|
||||||
|
|
||||||
filegroup(
|
filegroup(
|
@ -26,7 +26,8 @@ limitations under the License.
|
|||||||
// Log messages are written to stdout at various stages of the binary's execution.
|
// Log messages are written to stdout at various stages of the binary's execution.
|
||||||
// Test code can retrieve this container's log and validate that the expected
|
// Test code can retrieve this container's log and validate that the expected
|
||||||
// behavior is taking place.
|
// behavior is taking place.
|
||||||
package main
|
|
||||||
|
package portforwardtester
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -35,6 +36,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getEnvInt(name string) int {
|
func getEnvInt(name string) int {
|
||||||
@ -58,7 +61,26 @@ func getEnvInt(name string) int {
|
|||||||
// This timeout is somewhat arbitrary (~latency around the planet).
|
// This timeout is somewhat arbitrary (~latency around the planet).
|
||||||
const rstAvoidanceDelay = 500 * time.Millisecond
|
const rstAvoidanceDelay = 500 * time.Millisecond
|
||||||
|
|
||||||
func main() {
|
// CmdPortForwardTester is used by agnhost Cobra.
|
||||||
|
var CmdPortForwardTester = &cobra.Command{
|
||||||
|
Use: "port-forward-tester",
|
||||||
|
Short: "Creates a TCP server that sends chunks of data",
|
||||||
|
Long: `Listens for TCP connections on a given address and port, optionally checks the data received,
|
||||||
|
and sends a configurable number of data chunks, with a configurable interval between chunks.
|
||||||
|
|
||||||
|
The subcommand is using the following environment variables:
|
||||||
|
|
||||||
|
- BIND_ADDRESS (optional): The address on which it will start listening for TCP connections (default value: localhost)
|
||||||
|
- BIND_PORT: The port on which it will start listening for TCP connections.
|
||||||
|
- EXPECTED_CLIENT_DATA (optional): If set, it will check that the request sends the same exact data.
|
||||||
|
- CHUNKS: How many chunks of data to write in the response.
|
||||||
|
- CHUNK_SIZE: The expected size of each written chunk of data. If it does not match the actual size of the written data, it will exit with the exit code 4.
|
||||||
|
- CHUNK_INTERVAL: The amount of time to wait in between chunks.`,
|
||||||
|
Args: cobra.MaximumNArgs(0),
|
||||||
|
Run: main,
|
||||||
|
}
|
||||||
|
|
||||||
|
func main(cmd *cobra.Command, args []string) {
|
||||||
bindAddress := os.Getenv("BIND_ADDRESS")
|
bindAddress := os.Getenv("BIND_ADDRESS")
|
||||||
if bindAddress == "" {
|
if bindAddress == "" {
|
||||||
bindAddress = "localhost"
|
bindAddress = "localhost"
|
@ -1,19 +0,0 @@
|
|||||||
# 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 scratch
|
|
||||||
COPY GITHASH.txt /
|
|
||||||
COPY fakegitserver /
|
|
||||||
ENTRYPOINT ["/fakegitserver"]
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
# 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 = fakegitserver
|
|
||||||
ARCH ?= amd64
|
|
||||||
TARGET ?= $(CURDIR)
|
|
||||||
GOLANG_VERSION ?= latest
|
|
||||||
SRC_DIR = $(notdir $(shell pwd))
|
|
||||||
export
|
|
||||||
|
|
||||||
IGNORE := $(shell git rev-parse HEAD > $(TARGET)/GITHASH.txt)
|
|
||||||
|
|
||||||
bin:
|
|
||||||
../image-util.sh bin $(SRCS)
|
|
||||||
|
|
||||||
.PHONY: bin
|
|
@ -1 +0,0 @@
|
|||||||
1.0
|
|
@ -1,5 +0,0 @@
|
|||||||
amd64=alpine:3.6
|
|
||||||
arm=arm32v6/alpine:3.6
|
|
||||||
arm64=arm64v8/alpine:3.6
|
|
||||||
ppc64le=ppc64le/alpine:3.6
|
|
||||||
s390x=s390x/alpine:3.6
|
|
@ -1,25 +0,0 @@
|
|||||||
# 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
|
|
||||||
|
|
||||||
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
|
|
||||||
|
|
||||||
# install necessary packages:
|
|
||||||
# - curl, nc: used by a lot of e2e tests
|
|
||||||
# - iproute2: includes ss used in NodePort tests
|
|
||||||
RUN apk --update add curl netcat-openbsd iproute2 && rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
# wait forever
|
|
||||||
CMD while true; do sleep 1d; done
|
|
@ -1 +0,0 @@
|
|||||||
1.1
|
|
@ -1,12 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Pod
|
|
||||||
metadata:
|
|
||||||
name: hostexec
|
|
||||||
labels:
|
|
||||||
app: hostexec
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: hostexec
|
|
||||||
image: gcr.io/kubernetes-e2e-test-images/hostexec-amd64:1.1
|
|
||||||
securityContext:
|
|
||||||
hostNetwork: true
|
|
@ -1,17 +0,0 @@
|
|||||||
# 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 scratch
|
|
||||||
|
|
||||||
COPY liveness /server
|
|
@ -1,25 +0,0 @@
|
|||||||
# 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 = liveness
|
|
||||||
ARCH ?= amd64
|
|
||||||
TARGET ?= $(CURDIR)
|
|
||||||
GOLANG_VERSION ?= latest
|
|
||||||
SRC_DIR = $(notdir $(shell pwd))
|
|
||||||
export
|
|
||||||
|
|
||||||
bin:
|
|
||||||
../image-util.sh bin $(SRCS)
|
|
||||||
|
|
||||||
.PHONY: bin
|
|
@ -1 +0,0 @@
|
|||||||
1.1
|
|
@ -1,4 +0,0 @@
|
|||||||
amd64=busybox
|
|
||||||
arm=arm32v6/busybox
|
|
||||||
arm64=arm64v8/busybox
|
|
||||||
ppc64le=ppc64le/busybox
|
|
@ -1,22 +0,0 @@
|
|||||||
# 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}"]
|
|
@ -1,25 +0,0 @@
|
|||||||
# 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
|
|
@ -1,57 +0,0 @@
|
|||||||
# Logs Generator
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
Logs generator is a tool to create predictable load on the logs delivery system.
|
|
||||||
It 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
|
|
||||||
|
|
||||||
```
|
|
||||||
k8s.gcr.io/logs-generator:v0.1.1
|
|
||||||
```
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
```
|
|
||||||
docker run -i \
|
|
||||||
-e "LOGS_GENERATOR_LINES_TOTAL=10" \
|
|
||||||
-e "LOGS_GENERATOR_DURATION=1s" \
|
|
||||||
k8s.gcr.io/logs-generator:v0.1.1
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
kubectl run logs-generator \
|
|
||||||
--generator=run-pod/v1 \
|
|
||||||
--image=k8s.gcr.io/logs-generator:v0.1.1 \
|
|
||||||
--restart=Never \
|
|
||||||
--env "LOGS_GENERATOR_LINES_TOTAL=1000" \
|
|
||||||
--env "LOGS_GENERATOR_DURATION=1m"
|
|
||||||
```
|
|
||||||
|
|
||||||
[]()
|
|
@ -1 +0,0 @@
|
|||||||
1.0
|
|
@ -1,4 +0,0 @@
|
|||||||
amd64=alpine:3.6
|
|
||||||
arm=arm32v6/alpine:3.6
|
|
||||||
arm64=arm64v8/alpine:3.6
|
|
||||||
ppc64le=ppc64le/alpine:3.6
|
|
@ -1,19 +0,0 @@
|
|||||||
# Copyright 2017 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
|
|
||||||
|
|
||||||
COPY no-snat-test-proxy /
|
|
||||||
|
|
||||||
ENTRYPOINT ["/no-snat-test-proxy"]
|
|
@ -1,25 +0,0 @@
|
|||||||
# Copyright 2017 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=no-snat-test-proxy
|
|
||||||
ARCH ?= amd64
|
|
||||||
TARGET ?= $(CURDIR)
|
|
||||||
GOLANG_VERSION ?= latest
|
|
||||||
SRC_DIR = $(notdir $(shell pwd))
|
|
||||||
export
|
|
||||||
|
|
||||||
bin:
|
|
||||||
../image-util.sh bin $(SRCS)
|
|
||||||
|
|
||||||
.PHONY: bin
|
|
@ -1 +0,0 @@
|
|||||||
1.0
|
|
@ -1,4 +0,0 @@
|
|||||||
amd64=alpine:3.6
|
|
||||||
arm=arm32v6/alpine:3.6
|
|
||||||
arm64=arm64v8/alpine:3.6
|
|
||||||
ppc64le=ppc64le/alpine:3.6
|
|
@ -1,19 +0,0 @@
|
|||||||
# Copyright 2017 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
|
|
||||||
|
|
||||||
COPY no-snat-test /
|
|
||||||
|
|
||||||
ENTRYPOINT ["/no-snat-test"]
|
|
@ -1,25 +0,0 @@
|
|||||||
# Copyright 2017 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=no-snat-test
|
|
||||||
ARCH ?= amd64
|
|
||||||
TARGET ?= $(CURDIR)
|
|
||||||
GOLANG_VERSION ?= latest
|
|
||||||
SRC_DIR = $(notdir $(shell pwd))
|
|
||||||
export
|
|
||||||
|
|
||||||
bin:
|
|
||||||
../image-util.sh bin $(SRCS)
|
|
||||||
|
|
||||||
.PHONY: bin
|
|
@ -1 +0,0 @@
|
|||||||
1.0
|
|
1
test/images/port-forward-tester/.gitignore
vendored
1
test/images/port-forward-tester/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
portforwardtester
|
|
@ -1,18 +0,0 @@
|
|||||||
# Copyright 2015 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 scratch
|
|
||||||
ADD portforwardtester portforwardtester
|
|
||||||
ADD portforwardtester.go portforwardtester.go
|
|
||||||
ENTRYPOINT ["/portforwardtester"]
|
|
@ -1,25 +0,0 @@
|
|||||||
# 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=portforwardtester
|
|
||||||
ARCH ?= amd64
|
|
||||||
TARGET ?= $(CURDIR)
|
|
||||||
GOLANG_VERSION ?= latest
|
|
||||||
SRC_DIR = $(notdir $(shell pwd))
|
|
||||||
export
|
|
||||||
|
|
||||||
bin:
|
|
||||||
../image-util.sh bin $(SRCS)
|
|
||||||
|
|
||||||
.PHONY: bin
|
|
@ -1 +0,0 @@
|
|||||||
1.0
|
|
Loading…
Reference in New Issue
Block a user