mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
vendor files
This commit is contained in:
5
vendor/k8s.io/kubernetes/test/images/serve-hostname/BASEIMAGE
generated
vendored
Normal file
5
vendor/k8s.io/kubernetes/test/images/serve-hostname/BASEIMAGE
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
amd64=busybox
|
||||
arm=arm32v6/busybox
|
||||
arm64=arm64v8/busybox
|
||||
ppc64le=ppc64le/busybox
|
||||
s390x=s390x/busybox
|
32
vendor/k8s.io/kubernetes/test/images/serve-hostname/BUILD
generated
vendored
Normal file
32
vendor/k8s.io/kubernetes/test/images/serve-hostname/BUILD
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_binary",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["serve_hostname.go"],
|
||||
importpath = "k8s.io/kubernetes/test/images/serve-hostname",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name = "serve-hostname",
|
||||
importpath = "k8s.io/kubernetes/test/images/serve-hostname",
|
||||
library = ":go_default_library",
|
||||
)
|
18
vendor/k8s.io/kubernetes/test/images/serve-hostname/Dockerfile
generated
vendored
Normal file
18
vendor/k8s.io/kubernetes/test/images/serve-hostname/Dockerfile
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# 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
|
||||
COPY serve_hostname /
|
||||
EXPOSE 9376
|
||||
ENTRYPOINT ["/serve_hostname"]
|
25
vendor/k8s.io/kubernetes/test/images/serve-hostname/Makefile
generated
vendored
Normal file
25
vendor/k8s.io/kubernetes/test/images/serve-hostname/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=serve_hostname
|
||||
ARCH ?= amd64
|
||||
TARGET ?= $(CURDIR)
|
||||
GOLANG_VERSION ?= latest
|
||||
SRC_DIR = $(notdir $(shell pwd))
|
||||
export
|
||||
|
||||
bin:
|
||||
../image-util.sh bin $(SRCS)
|
||||
|
||||
.PHONY: bin
|
39
vendor/k8s.io/kubernetes/test/images/serve-hostname/README.md
generated
vendored
Normal file
39
vendor/k8s.io/kubernetes/test/images/serve-hostname/README.md
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
## serve_hostname
|
||||
|
||||
This is a small util app to serve your hostname on TCP and/or UDP. Useful for testing.
|
||||
|
||||
The `serve_hostname` Makefile supports multiple architectures, which means it may cross-compile and build an docker image easily.
|
||||
Arch-specific busybox images serve as base images.
|
||||
|
||||
If you are releasing a new version, please bump the `TAG` value in the `Makefile` before building the images.
|
||||
|
||||
## How to release:
|
||||
|
||||
```
|
||||
# Build cross-platform binaries
|
||||
$ make all-push
|
||||
|
||||
# Build for linux/amd64 (default)
|
||||
$ make push ARCH=amd64
|
||||
# ---> gcr.io/google_containers/serve_hostname-amd64:TAG
|
||||
|
||||
$ make push ARCH=arm
|
||||
# ---> gcr.io/google_containers/serve_hostname-arm:TAG
|
||||
|
||||
$ make push ARCH=arm64
|
||||
# ---> gcr.io/google_containers/serve_hostname-arm64:TAG
|
||||
|
||||
$ make push ARCH=ppc64le
|
||||
# ---> gcr.io/google_containers/serve_hostname-ppc64le:TAG
|
||||
|
||||
$ make push ARCH=s390x
|
||||
# ---> gcr.io/google_containers/serve_hostname-s390x:TAG
|
||||
```
|
||||
|
||||
Of course, if you don't want to push the images, run `make all-container` or `make container ARCH={target_arch}` instead.
|
||||
|
||||
|
||||
[]()
|
||||
|
||||
|
||||
[]()
|
1
vendor/k8s.io/kubernetes/test/images/serve-hostname/VERSION
generated
vendored
Normal file
1
vendor/k8s.io/kubernetes/test/images/serve-hostname/VERSION
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
1.1
|
105
vendor/k8s.io/kubernetes/test/images/serve-hostname/serve_hostname.go
generated
vendored
Normal file
105
vendor/k8s.io/kubernetes/test/images/serve-hostname/serve_hostname.go
generated
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
Copyright 2014 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.
|
||||
*/
|
||||
|
||||
// A small utility to just serve the hostname on TCP and/or UDP.
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
doTCP = flag.Bool("tcp", false, "Serve raw over TCP.")
|
||||
doUDP = flag.Bool("udp", false, "Serve raw over UDP.")
|
||||
doHTTP = flag.Bool("http", true, "Serve HTTP.")
|
||||
port = flag.Int("port", 9376, "Port number.")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if *doHTTP && (*doTCP || *doUDP) {
|
||||
log.Fatalf("Can't server TCP/UDP mode and HTTP mode at the same time")
|
||||
}
|
||||
|
||||
hostname, err := os.Hostname()
|
||||
if err != nil {
|
||||
log.Fatalf("Error from os.Hostname(): %s", err)
|
||||
}
|
||||
|
||||
if *doTCP {
|
||||
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
|
||||
if err != nil {
|
||||
log.Fatalf("Error from net.Listen(): %s", err)
|
||||
}
|
||||
go func() {
|
||||
for {
|
||||
conn, err := listener.Accept()
|
||||
if err != nil {
|
||||
log.Fatalf("Error from Accept(): %s", err)
|
||||
}
|
||||
log.Printf("TCP request from %s", conn.RemoteAddr().String())
|
||||
conn.Write([]byte(hostname))
|
||||
conn.Close()
|
||||
}
|
||||
}()
|
||||
}
|
||||
if *doUDP {
|
||||
addr, err := net.ResolveUDPAddr("udp", fmt.Sprintf(":%d", *port))
|
||||
if err != nil {
|
||||
log.Fatalf("Error from net.ResolveUDPAddr(): %s", err)
|
||||
}
|
||||
sock, err := net.ListenUDP("udp", addr)
|
||||
if err != nil {
|
||||
log.Fatalf("Error from ListenUDP(): %s", err)
|
||||
}
|
||||
go func() {
|
||||
var buffer [16]byte
|
||||
for {
|
||||
_, cliAddr, err := sock.ReadFrom(buffer[0:])
|
||||
if err != nil {
|
||||
log.Fatalf("Error from ReadFrom(): %s", err)
|
||||
}
|
||||
log.Printf("UDP request from %s", cliAddr.String())
|
||||
sock.WriteTo([]byte(hostname), cliAddr)
|
||||
}
|
||||
}()
|
||||
}
|
||||
if *doHTTP {
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
log.Printf("HTTP request from %s", r.RemoteAddr)
|
||||
fmt.Fprintf(w, "%s", hostname)
|
||||
})
|
||||
go func() {
|
||||
// Run in a closure so http.ListenAndServe doesn't block
|
||||
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", *port), nil))
|
||||
}()
|
||||
}
|
||||
log.Printf("Serving on port %d.\n", *port)
|
||||
signals := make(chan os.Signal)
|
||||
signal.Notify(signals, syscall.SIGTERM)
|
||||
sig := <-signals
|
||||
log.Printf("Shutting down after receiving signal: %s.\n", sig)
|
||||
log.Printf("Awaiting pod deletion.\n")
|
||||
time.Sleep(60 * time.Second)
|
||||
}
|
Reference in New Issue
Block a user