mirror of
https://github.com/stefanprodan/podinfo.git
synced 2026-04-09 20:46:51 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c8a85a5ab | ||
|
|
c9dc78f29c | ||
|
|
6a9b0253ac | ||
|
|
198211e20b | ||
|
|
e1ca9e227d | ||
|
|
4fc593f42c | ||
|
|
18af1ea3a6 | ||
|
|
2e9917a6b9 | ||
|
|
bf00d07b17 | ||
|
|
aab8e464e8 | ||
|
|
1475a2da00 |
@@ -38,6 +38,7 @@ Web API:
|
||||
* `POST /store` writes the posted content to disk at /data/hash and returns the SHA1 hash of the content
|
||||
* `GET /store/{hash}` returns the content of the file /data/hash if exists
|
||||
* `GET /ws/echo` echos content via websockets `podcli ws ws://localhost:9898/ws/echo`
|
||||
* `GET /chunked/{seconds}` uses `transfer-encoding` type `chunked` to give a partial response and then waits for the specified period
|
||||
|
||||
### Guides
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
apiVersion: v1
|
||||
version: 1.5.0
|
||||
appVersion: 1.5.0
|
||||
version: 1.7.0
|
||||
appVersion: 1.7.1
|
||||
name: podinfo
|
||||
engine: gotpl
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
|
||||
@@ -12,7 +12,7 @@ faults:
|
||||
|
||||
image:
|
||||
repository: quay.io/stefanprodan/podinfo
|
||||
tag: 1.5.0
|
||||
tag: 1.7.1
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -3,9 +3,9 @@ entries:
|
||||
ambassador:
|
||||
- apiVersion: v1
|
||||
appVersion: 0.29.0
|
||||
created: 2019-04-19T12:42:59.847673+03:00
|
||||
created: 2019-06-15T18:31:59.598479+03:00
|
||||
description: A Helm chart for Datawire Ambassador
|
||||
digest: 36f7ae95835b3a154f2d21c3ea2ad30602f8b568dd9ee8d0b73a4cc4de381924
|
||||
digest: 25c0c9c71410dfc279eb013586bdaf82d5bccf45068d9d1b2261c6d731826f41
|
||||
engine: gotpl
|
||||
maintainers:
|
||||
- email: stefanprodan@users.noreply.github.com
|
||||
@@ -19,9 +19,9 @@ entries:
|
||||
grafana:
|
||||
- apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
created: 2019-04-19T12:42:59.848514+03:00
|
||||
created: 2019-06-15T18:31:59.599191+03:00
|
||||
description: A Helm chart for Kubernetes
|
||||
digest: d642d9249ca793b0bbf7bbf73b1fe51f6d29d051a43f12c5d12f05e3bdcdca56
|
||||
digest: 4a40019b6789e047f8ca720f3400c60277cc8c19f493367c2014b97942acdf10
|
||||
name: grafana
|
||||
urls:
|
||||
- https://stefanprodan.github.io/k8s-podinfo/grafana-0.1.0.tgz
|
||||
@@ -29,9 +29,9 @@ entries:
|
||||
loadtest:
|
||||
- apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
created: 2019-04-19T12:42:59.84877+03:00
|
||||
created: 2019-06-15T18:31:59.599397+03:00
|
||||
description: Hey load test Helm chart for Kubernetes
|
||||
digest: 1d386e6ea8450d766e39371fc264c2c56ebfe5fc74cef36327db706ce5fcd61a
|
||||
digest: 30e7bb670bb0fca08ee9746f2b81369d3a7a3fcbc9f38c2f9d69c36625cc75b5
|
||||
name: loadtest
|
||||
urls:
|
||||
- https://stefanprodan.github.io/k8s-podinfo/loadtest-0.1.0.tgz
|
||||
@@ -39,16 +39,16 @@ entries:
|
||||
ngrok:
|
||||
- apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
created: 2019-04-19T12:42:59.849747+03:00
|
||||
created: 2019-06-15T18:31:59.600312+03:00
|
||||
description: A Ngrok Helm chart for Kubernetes
|
||||
digest: 790f0c729c1880578c7724928c31d3582cfb9aac00212de47cd13c671ca5dd1e
|
||||
digest: 89ebf8bcfd09eb19da3c73acd5ad5dd56791781171e4bc6d1fd883832ca3c628
|
||||
name: ngrok
|
||||
urls:
|
||||
- https://stefanprodan.github.io/k8s-podinfo/ngrok-0.2.0.tgz
|
||||
version: 0.2.0
|
||||
- apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
created: 2019-04-19T12:42:59.849427+03:00
|
||||
created: 2019-06-15T18:31:59.600036+03:00
|
||||
description: A Ngrok Helm chart for Kubernetes
|
||||
digest: 5678de7c8aac246df507f40b3f4f8fd6d06f4447e636398819a232dd26e1fc41
|
||||
name: ngrok
|
||||
@@ -56,9 +56,25 @@ entries:
|
||||
- https://stefanprodan.github.io/k8s-podinfo/ngrok-0.1.0.tgz
|
||||
version: 0.1.0
|
||||
podinfo:
|
||||
- apiVersion: v1
|
||||
appVersion: 1.6.1
|
||||
created: 2019-06-15T18:31:59.614364+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: 4427173ee540f1f222030d8f4b38fbd812cd5bad3d2f55ec862e2db5f966cdbc
|
||||
engine: gotpl
|
||||
home: https://github.com/stefanprodan/k8s-podinfo
|
||||
maintainers:
|
||||
- email: stefanprodan@users.noreply.github.com
|
||||
name: stefanprodan
|
||||
name: podinfo
|
||||
sources:
|
||||
- https://github.com/stefanprodan/k8s-podinfo
|
||||
urls:
|
||||
- https://stefanprodan.github.io/k8s-podinfo/podinfo-1.6.0.tgz
|
||||
version: 1.6.0
|
||||
- apiVersion: v1
|
||||
appVersion: 1.5.0
|
||||
created: 2019-04-19T12:42:59.86172+03:00
|
||||
created: 2019-06-15T18:31:59.613942+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: 88207baab1922f6ba64d0f5b67650562a948bd0236c290e2bdad4b3ac2005be3
|
||||
engine: gotpl
|
||||
@@ -74,7 +90,7 @@ entries:
|
||||
version: 1.5.0
|
||||
- apiVersion: v1
|
||||
appVersion: 1.4.1
|
||||
created: 2019-04-19T12:42:59.861283+03:00
|
||||
created: 2019-06-15T18:31:59.612612+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: 0a1a25b12a2882e2641094b235f57dee6d95f9175823936be1dce73b75e808c3
|
||||
engine: gotpl
|
||||
@@ -90,7 +106,7 @@ entries:
|
||||
version: 1.4.2
|
||||
- apiVersion: v1
|
||||
appVersion: 1.4.1
|
||||
created: 2019-04-19T12:42:59.860514+03:00
|
||||
created: 2019-06-15T18:31:59.611788+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: 91ea71d56bf74135b3115a723f345a12022d5910abf21a8ee8d77d74385bc127
|
||||
engine: gotpl
|
||||
@@ -106,7 +122,7 @@ entries:
|
||||
version: 1.4.1
|
||||
- apiVersion: v1
|
||||
appVersion: 1.4.0
|
||||
created: 2019-04-19T12:42:59.859528+03:00
|
||||
created: 2019-06-15T18:31:59.610465+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: d30a844229125217f85d5c52ceb48c980f47027a5a1f9ee5c41bac44b9d18088
|
||||
engine: gotpl
|
||||
@@ -122,7 +138,7 @@ entries:
|
||||
version: 1.4.0
|
||||
- apiVersion: v1
|
||||
appVersion: 1.3.1
|
||||
created: 2019-04-19T12:42:59.858436+03:00
|
||||
created: 2019-06-15T18:31:59.609318+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: 9116966f2b1300655be11669789842a3d01e326fe1feb205198df3ba22bac3a5
|
||||
engine: gotpl
|
||||
@@ -138,7 +154,7 @@ entries:
|
||||
version: 1.3.1
|
||||
- apiVersion: v1
|
||||
appVersion: 1.3.0
|
||||
created: 2019-04-19T12:42:59.857461+03:00
|
||||
created: 2019-06-15T18:31:59.608378+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: 7111b868a11014ab56da11b7edbea9ce0d1a483500969252f66c9ae1943bac67
|
||||
engine: gotpl
|
||||
@@ -154,7 +170,7 @@ entries:
|
||||
version: 1.3.0
|
||||
- apiVersion: v1
|
||||
appVersion: 1.2.1
|
||||
created: 2019-04-19T12:42:59.856659+03:00
|
||||
created: 2019-06-15T18:31:59.607605+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: c750c1d4a7606a06cd89ae4433431c7e3ecf2ccc9a0e5f6baa26095397bd72da
|
||||
engine: gotpl
|
||||
@@ -170,7 +186,7 @@ entries:
|
||||
version: 1.2.1
|
||||
- apiVersion: v1
|
||||
appVersion: 1.2.0
|
||||
created: 2019-04-19T12:42:59.85536+03:00
|
||||
created: 2019-06-15T18:31:59.606836+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: 24460e15e6da77106eb5212cd683dc2c1d4404b927be6b9f0c89433ba865722e
|
||||
engine: gotpl
|
||||
@@ -186,7 +202,7 @@ entries:
|
||||
version: 1.2.0
|
||||
- apiVersion: v1
|
||||
appVersion: 1.1.0
|
||||
created: 2019-04-19T12:42:59.854575+03:00
|
||||
created: 2019-06-15T18:31:59.6062+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: 973d60c629d7ae476776098ad6b654d78d91f91b3faa8bc016b94c73c42be094
|
||||
engine: gotpl
|
||||
@@ -202,7 +218,7 @@ entries:
|
||||
version: 1.1.0
|
||||
- apiVersion: v1
|
||||
appVersion: 1.0.0
|
||||
created: 2019-04-19T12:42:59.853776+03:00
|
||||
created: 2019-06-15T18:31:59.605471+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: 82068727ba5b552341b14a980e954e27a8517f0ef76aab314c160b0f075e6de4
|
||||
engine: gotpl
|
||||
@@ -218,7 +234,7 @@ entries:
|
||||
version: 1.0.0
|
||||
- apiVersion: v1
|
||||
appVersion: 0.6.0
|
||||
created: 2019-04-19T12:42:59.852965+03:00
|
||||
created: 2019-06-15T18:31:59.603735+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: bd25a710eddb3985d3bd921a11022b5c68a04d37cf93a1a4aab17eeda35aa2f8
|
||||
engine: gotpl
|
||||
@@ -234,7 +250,7 @@ entries:
|
||||
version: 0.2.2
|
||||
- apiVersion: v1
|
||||
appVersion: 0.5.1
|
||||
created: 2019-04-19T12:42:59.852194+03:00
|
||||
created: 2019-06-15T18:31:59.602991+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: 631ca3e2db5553541a50b625f538e6a1f2a103c13aa8148fdd38baf2519e5235
|
||||
engine: gotpl
|
||||
@@ -250,7 +266,7 @@ entries:
|
||||
version: 0.2.1
|
||||
- apiVersion: v1
|
||||
appVersion: 0.5.0
|
||||
created: 2019-04-19T12:42:59.8515+03:00
|
||||
created: 2019-06-15T18:31:59.602221+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: dfe7cf44aef0d170549918b00966422a07e7611f9d0081fb34f5b5beb0641c00
|
||||
engine: gotpl
|
||||
@@ -266,7 +282,7 @@ entries:
|
||||
version: 0.2.0
|
||||
- apiVersion: v1
|
||||
appVersion: 0.3.0
|
||||
created: 2019-04-19T12:42:59.850712+03:00
|
||||
created: 2019-06-15T18:31:59.601433+03:00
|
||||
description: Podinfo Helm chart for Kubernetes
|
||||
digest: 4865a2d8b269cf453935cda9661c2efb82c16411471f8c11221a6d03d9bb58b1
|
||||
engine: gotpl
|
||||
@@ -283,9 +299,9 @@ entries:
|
||||
podinfo-istio:
|
||||
- apiVersion: v1
|
||||
appVersion: 1.2.1
|
||||
created: 2019-04-19T12:42:59.864903+03:00
|
||||
created: 2019-06-15T18:31:59.617629+03:00
|
||||
description: Podinfo Helm chart for Istio
|
||||
digest: 2014e4e4577f74d22a6cccfda015720a00bacc3895c47bea52d14f6cea4fef6a
|
||||
digest: 3dd09269a03a55252da332a9d0260ff31b47b3dd96b7e7a547273bb5ccb6167d
|
||||
engine: gotpl
|
||||
home: https://github.com/stefanprodan/k8s-podinfo
|
||||
maintainers:
|
||||
@@ -299,7 +315,7 @@ entries:
|
||||
version: 1.2.1
|
||||
- apiVersion: v1
|
||||
appVersion: 1.2.0
|
||||
created: 2019-04-19T12:42:59.864325+03:00
|
||||
created: 2019-06-15T18:31:59.617041+03:00
|
||||
description: Podinfo Helm chart for Istio
|
||||
digest: 8115e72f232f82eb3e6da1965364cfede7c069f95a627dddac45cfbe6cb90dc4
|
||||
engine: gotpl
|
||||
@@ -315,7 +331,7 @@ entries:
|
||||
version: 1.2.0
|
||||
- apiVersion: v1
|
||||
appVersion: 1.1.0
|
||||
created: 2019-04-19T12:42:59.86345+03:00
|
||||
created: 2019-06-15T18:31:59.616155+03:00
|
||||
description: Podinfo Helm chart for Istio
|
||||
digest: bcceb63ff780a8f0ba0b30997040e4e82170f9cce17c26ec817648ed024c83f5
|
||||
engine: gotpl
|
||||
@@ -331,7 +347,7 @@ entries:
|
||||
version: 0.2.0
|
||||
- apiVersion: v1
|
||||
appVersion: 0.6.0
|
||||
created: 2019-04-19T12:42:59.862621+03:00
|
||||
created: 2019-06-15T18:31:59.615212+03:00
|
||||
description: Podinfo Helm chart for Istio
|
||||
digest: f12f8aa1eca1328e9eaa30bd757f6ed3ff97205e2bf016a47265bc2de6a63d8f
|
||||
engine: gotpl
|
||||
@@ -345,4 +361,4 @@ entries:
|
||||
urls:
|
||||
- https://stefanprodan.github.io/k8s-podinfo/podinfo-istio-0.1.0.tgz
|
||||
version: 0.1.0
|
||||
generated: 2019-04-19T12:42:59.846718+03:00
|
||||
generated: 2019-06-15T18:31:59.597729+03:00
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
docs/podinfo-1.6.0.tgz
Normal file
BIN
docs/podinfo-1.6.0.tgz
Normal file
Binary file not shown.
Binary file not shown.
36
pkg/api/chunked.go
Normal file
36
pkg/api/chunked.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
func (s *Server) chunkedHandler(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
|
||||
delay, err := strconv.Atoi(vars["wait"])
|
||||
if err != nil {
|
||||
delay = rand.Intn(int(s.config.HttpServerTimeout*time.Second)-10) + 10
|
||||
}
|
||||
|
||||
flusher, ok := w.(http.Flusher)
|
||||
if !ok {
|
||||
s.ErrorResponse(w, r, "Streaming unsupported!", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Connection", "Keep-Alive")
|
||||
w.Header().Set("Transfer-Encoding", "chunked")
|
||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
|
||||
flusher.Flush()
|
||||
|
||||
time.Sleep(time.Duration(delay) * time.Second)
|
||||
s.JSONResponse(w, r, map[string]int{"delay": delay})
|
||||
|
||||
flusher.Flush()
|
||||
}
|
||||
35
pkg/api/chunked_test.go
Normal file
35
pkg/api/chunked_test.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"regexp"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestChunkedHandler(t *testing.T) {
|
||||
req, err := http.NewRequest("GET", "/chunked/0", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
rr := httptest.NewRecorder()
|
||||
srv := NewMockServer()
|
||||
|
||||
srv.router.HandleFunc("/chunked/{wait}", srv.chunkedHandler)
|
||||
srv.router.ServeHTTP(rr, req)
|
||||
|
||||
// Check the status code is what we expect.
|
||||
if status := rr.Code; status != http.StatusOK {
|
||||
t.Errorf("handler returned wrong status code: got %v want %v",
|
||||
status, http.StatusOK)
|
||||
}
|
||||
|
||||
// Check the response body is what we expect.
|
||||
expected := ".*delay.*0.*"
|
||||
r := regexp.MustCompile(expected)
|
||||
if !r.MatchString(rr.Body.String()) {
|
||||
t.Fatalf("handler returned unexpected body:\ngot \n%v \nwant \n%s",
|
||||
rr.Body.String(), expected)
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package api
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"regexp"
|
||||
@@ -51,7 +52,7 @@ func (p *PrometheusMiddleware) Handler(next http.Handler) http.Handler {
|
||||
begin := time.Now()
|
||||
interceptor := &interceptor{ResponseWriter: w, statusCode: http.StatusOK}
|
||||
path := p.getRouteName(r)
|
||||
next.ServeHTTP(interceptor, r)
|
||||
next.ServeHTTP(interceptor.wrappedResponseWriter(), r)
|
||||
var (
|
||||
status = strconv.Itoa(interceptor.statusCode)
|
||||
took = time.Since(begin)
|
||||
@@ -94,6 +95,14 @@ type interceptor struct {
|
||||
recorded bool
|
||||
}
|
||||
|
||||
func (i *interceptor) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
||||
hj, ok := i.ResponseWriter.(http.Hijacker)
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("interceptor: can't cast parent ResponseWriter to Hijacker")
|
||||
}
|
||||
return hj.Hijack()
|
||||
}
|
||||
|
||||
func (i *interceptor) WriteHeader(code int) {
|
||||
if !i.recorded {
|
||||
i.statusCode = code
|
||||
@@ -102,10 +111,262 @@ func (i *interceptor) WriteHeader(code int) {
|
||||
i.ResponseWriter.WriteHeader(code)
|
||||
}
|
||||
|
||||
func (i *interceptor) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
||||
hj, ok := i.ResponseWriter.(http.Hijacker)
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("interceptor: can't cast parent ResponseWriter to Hijacker")
|
||||
// Returns a wrapped http.ResponseWriter that implements the same optional interfaces
|
||||
// that the underlying ResponseWriter has.
|
||||
// Handle every possible combination so that code that checks for the existence of each
|
||||
// optional interface functions properly.
|
||||
// Based on https://github.com/felixge/httpsnoop/blob/eadd4fad6aac69ae62379194fe0219f3dbc80fd3/wrap_generated_gteq_1.8.go#L66
|
||||
func (i *interceptor) wrappedResponseWriter() http.ResponseWriter {
|
||||
closeNotifier, isCloseNotifier := i.ResponseWriter.(http.CloseNotifier)
|
||||
flush, isFlusher := i.ResponseWriter.(http.Flusher)
|
||||
hijack, isHijacker := i.ResponseWriter.(http.Hijacker)
|
||||
push, isPusher := i.ResponseWriter.(http.Pusher)
|
||||
readFrom, isReaderFrom := i.ResponseWriter.(io.ReaderFrom)
|
||||
|
||||
switch {
|
||||
case !isCloseNotifier && !isFlusher && !isHijacker && !isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
}{i}
|
||||
|
||||
case isCloseNotifier && !isFlusher && !isHijacker && !isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
}{i, closeNotifier}
|
||||
|
||||
case !isCloseNotifier && isFlusher && !isHijacker && !isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Flusher
|
||||
}{i, flush}
|
||||
|
||||
case !isCloseNotifier && !isFlusher && isHijacker && !isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
}{i, hijack}
|
||||
|
||||
case !isCloseNotifier && !isFlusher && !isHijacker && isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Pusher
|
||||
}{i, push}
|
||||
|
||||
case !isCloseNotifier && !isFlusher && !isHijacker && !isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
io.ReaderFrom
|
||||
}{i, readFrom}
|
||||
|
||||
case isCloseNotifier && isFlusher && !isHijacker && !isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Flusher
|
||||
}{i, closeNotifier, flush}
|
||||
|
||||
case isCloseNotifier && !isFlusher && isHijacker && !isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Hijacker
|
||||
}{i, closeNotifier, hijack}
|
||||
|
||||
case isCloseNotifier && !isFlusher && !isHijacker && isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Pusher
|
||||
}{i, closeNotifier, push}
|
||||
|
||||
case isCloseNotifier && !isFlusher && !isHijacker && !isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
io.ReaderFrom
|
||||
}{i, closeNotifier, readFrom}
|
||||
|
||||
case !isCloseNotifier && isFlusher && isHijacker && !isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Flusher
|
||||
http.Hijacker
|
||||
}{i, flush, hijack}
|
||||
|
||||
case !isCloseNotifier && isFlusher && !isHijacker && isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Flusher
|
||||
http.Pusher
|
||||
}{i, flush, push}
|
||||
|
||||
case !isCloseNotifier && isFlusher && !isHijacker && !isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Flusher
|
||||
io.ReaderFrom
|
||||
}{i, flush, readFrom}
|
||||
|
||||
case !isCloseNotifier && !isFlusher && isHijacker && isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.Pusher
|
||||
}{i, hijack, push}
|
||||
|
||||
case !isCloseNotifier && !isFlusher && isHijacker && !isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
io.ReaderFrom
|
||||
}{i, hijack, readFrom}
|
||||
|
||||
case !isCloseNotifier && !isFlusher && !isHijacker && isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Pusher
|
||||
io.ReaderFrom
|
||||
}{i, push, readFrom}
|
||||
|
||||
case isCloseNotifier && isFlusher && isHijacker && !isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Flusher
|
||||
http.Hijacker
|
||||
}{i, closeNotifier, flush, hijack}
|
||||
|
||||
case isCloseNotifier && isFlusher && !isHijacker && isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Flusher
|
||||
http.Pusher
|
||||
}{i, closeNotifier, flush, push}
|
||||
|
||||
case isCloseNotifier && isFlusher && !isHijacker && !isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Flusher
|
||||
io.ReaderFrom
|
||||
}{i, closeNotifier, flush, readFrom}
|
||||
|
||||
case isCloseNotifier && !isFlusher && isHijacker && isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Hijacker
|
||||
http.Pusher
|
||||
}{i, closeNotifier, hijack, push}
|
||||
|
||||
case isCloseNotifier && !isFlusher && isHijacker && !isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Hijacker
|
||||
io.ReaderFrom
|
||||
}{i, closeNotifier, hijack, readFrom}
|
||||
|
||||
case isCloseNotifier && !isFlusher && !isHijacker && isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Pusher
|
||||
io.ReaderFrom
|
||||
}{i, closeNotifier, push, readFrom}
|
||||
|
||||
case !isCloseNotifier && isFlusher && isHijacker && isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Flusher
|
||||
http.Hijacker
|
||||
http.Pusher
|
||||
}{i, flush, hijack, push}
|
||||
|
||||
case !isCloseNotifier && isFlusher && isHijacker && !isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Flusher
|
||||
http.Hijacker
|
||||
io.ReaderFrom
|
||||
}{i, flush, hijack, readFrom}
|
||||
|
||||
case !isCloseNotifier && isFlusher && !isHijacker && isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Flusher
|
||||
http.Pusher
|
||||
io.ReaderFrom
|
||||
}{i, flush, push, readFrom}
|
||||
|
||||
case !isCloseNotifier && !isFlusher && isHijacker && isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Hijacker
|
||||
http.Pusher
|
||||
io.ReaderFrom
|
||||
}{i, hijack, push, readFrom}
|
||||
|
||||
case isCloseNotifier && isFlusher && isHijacker && isPusher && !isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Flusher
|
||||
http.Hijacker
|
||||
http.Pusher
|
||||
}{i, closeNotifier, flush, hijack, push}
|
||||
|
||||
case isCloseNotifier && isFlusher && isHijacker && !isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Flusher
|
||||
http.Hijacker
|
||||
io.ReaderFrom
|
||||
}{i, closeNotifier, flush, hijack, readFrom}
|
||||
|
||||
case isCloseNotifier && isFlusher && !isHijacker && isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Flusher
|
||||
http.Pusher
|
||||
io.ReaderFrom
|
||||
}{i, closeNotifier, flush, push, readFrom}
|
||||
|
||||
case isCloseNotifier && !isFlusher && isHijacker && isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Hijacker
|
||||
http.Pusher
|
||||
io.ReaderFrom
|
||||
}{i, closeNotifier, hijack, push, readFrom}
|
||||
|
||||
case !isCloseNotifier && isFlusher && isHijacker && isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.Flusher
|
||||
http.Hijacker
|
||||
http.Pusher
|
||||
io.ReaderFrom
|
||||
}{i, flush, hijack, push, readFrom}
|
||||
|
||||
case isCloseNotifier && isFlusher && isHijacker && isPusher && isReaderFrom:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
http.CloseNotifier
|
||||
http.Flusher
|
||||
http.Hijacker
|
||||
http.Pusher
|
||||
io.ReaderFrom
|
||||
}{i, closeNotifier, flush, hijack, push, readFrom}
|
||||
|
||||
default:
|
||||
return struct {
|
||||
http.ResponseWriter
|
||||
}{i}
|
||||
}
|
||||
return hj.Hijack()
|
||||
}
|
||||
|
||||
@@ -3,17 +3,18 @@ package api
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stefanprodan/k8s-podinfo/pkg/fscache"
|
||||
"go.uber.org/zap"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"os"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stefanprodan/k8s-podinfo/pkg/fscache"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -80,6 +81,8 @@ func (s *Server) registerHandlers() {
|
||||
s.router.HandleFunc("/api/info", s.infoHandler).Methods("GET")
|
||||
s.router.HandleFunc("/api/echo", s.echoHandler).Methods("POST")
|
||||
s.router.HandleFunc("/ws/echo", s.echoWsHandler)
|
||||
s.router.HandleFunc("/chunked", s.chunkedHandler)
|
||||
s.router.HandleFunc("/chunked/{wait:[0-9]+}", s.chunkedHandler)
|
||||
}
|
||||
|
||||
func (s *Server) registerMiddlewares() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package version
|
||||
|
||||
var VERSION = "1.6.0"
|
||||
var VERSION = "1.8.0"
|
||||
var REVISION = "unknown"
|
||||
|
||||
73
ui/vue.html
73
ui/vue.html
@@ -44,73 +44,6 @@
|
||||
</v-layout>
|
||||
</v-parallax>
|
||||
</section>
|
||||
<section>
|
||||
<v-layout
|
||||
column
|
||||
wrap
|
||||
class="my-5"
|
||||
align-center
|
||||
>
|
||||
<v-flex xs12 sm4 class="my-3">
|
||||
<div class="text-xs-center">
|
||||
<h2 class="headline">The best way to start developing</h2>
|
||||
<span class="subheading">
|
||||
stateless microservices with Go for Kubernetes
|
||||
</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-container grid-list-xl>
|
||||
<v-layout row wrap align-center>
|
||||
<v-flex xs12 md4>
|
||||
<v-card class="elevation-0 transparent">
|
||||
<v-card-text class="text-xs-center">
|
||||
<v-icon x-large class="blue--text text--lighten-2">cloud</v-icon>
|
||||
</v-card-text>
|
||||
<v-card-title primary-title class="layout justify-center">
|
||||
<div class="headline text-xs-center">Cloud Native</div>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
Distributed as a Helm chart. Builtin Kubernetes health checks (readiness and liveness).
|
||||
Graceful shutdown on interrupt signals.
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
<v-flex xs12 md4>
|
||||
<v-card class="elevation-0 transparent">
|
||||
<v-card-text class="text-xs-center">
|
||||
<v-icon x-large class="blue--text text--lighten-2">graphic_eq</v-icon>
|
||||
</v-card-text>
|
||||
<v-card-title primary-title class="layout justify-center">
|
||||
<div class="headline">Observability</div>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
Instrumentation with Prometheus (RED method).
|
||||
Structured logging with zap and Fluentd.
|
||||
Tracing with Jaeger and Istio.
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
<v-flex xs12 md4>
|
||||
<v-card class="elevation-0 transparent">
|
||||
<v-card-text class="text-xs-center">
|
||||
<v-icon x-large class="blue--text text--lighten-2">flash_on</v-icon>
|
||||
</v-card-text>
|
||||
<v-card-title primary-title class="layout justify-center">
|
||||
<div class="headline text-xs-center">Release automation</div>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
Multi-platform Docker image AMD64 and ARMv7.
|
||||
CI/CD powered by: TravisCI CircleCI Quay.io Google Cloud Container Builder Skaffold Weave Flux.
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-container>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</section>
|
||||
|
||||
<v-footer class="blue darken-2">
|
||||
<v-layout row wrap align-center>
|
||||
<v-flex xs12>
|
||||
@@ -125,12 +58,14 @@
|
||||
</v-content>
|
||||
</v-app>
|
||||
</div>
|
||||
<script src="https://unpkg.com/vue/dist/vue.min.js"></script>
|
||||
<script src="https://unpkg.com/vuetify/dist/vuetify.min.js"></script>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
|
||||
<script>
|
||||
new Vue({
|
||||
delimiters: ['${', '}'],
|
||||
el: '#app',
|
||||
vuetify: new Vuetify(),
|
||||
data: function() {
|
||||
return {
|
||||
info: {},
|
||||
|
||||
Reference in New Issue
Block a user