mirror of
https://github.com/stefanprodan/podinfo.git
synced 2026-08-23 22:26:29 +00:00
v0.0.9 release
- added echo headers handler
This commit is contained in:
@@ -26,6 +26,7 @@ Web API:
|
||||
* `POST /readyz/disable` signals the Kubernetes LB to stop sending requests to this instance
|
||||
* `GET /panic` crashes the process with exit code 255
|
||||
* `POST /echo` echos the posted content, logs the SHA1 hash of the content
|
||||
* `GET /echoheaders` prints the request HTTP headers
|
||||
* `POST /job` long running job, json body: `{"wait":2}`
|
||||
* `POST /write` writes the posted content to disk at /data/hash and returns the SHA1 hash of the content
|
||||
* `POST /read` receives a SHA1 hash and returns the content of the file /data/hash if exists
|
||||
|
||||
@@ -5,7 +5,7 @@ backend: http://backend-podinfo:9898/echo
|
||||
|
||||
image:
|
||||
repository: stefanprodan/podinfo
|
||||
tag: 0.0.8
|
||||
tag: 0.0.9
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
|
||||
@@ -19,7 +19,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: podinfod
|
||||
image: stefanprodan/podinfo:0.0.8
|
||||
image: stefanprodan/podinfo:0.0.9
|
||||
imagePullPolicy: Always
|
||||
command:
|
||||
- ./podinfo
|
||||
|
||||
@@ -19,7 +19,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: podinfod
|
||||
image: stefanprodan/podinfo:0.0.8
|
||||
image: stefanprodan/podinfo:0.0.9
|
||||
imagePullPolicy: Always
|
||||
command:
|
||||
- ./podinfo
|
||||
|
||||
@@ -14,7 +14,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: podinfod
|
||||
image: stefanprodan/podinfo:0.0.8
|
||||
image: stefanprodan/podinfo:0.0.9
|
||||
imagePullPolicy: Always
|
||||
command:
|
||||
- ./podinfo
|
||||
|
||||
@@ -37,7 +37,7 @@ spec:
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
containers:
|
||||
- name: probe
|
||||
image: stefanprodan/podinfo:0.0.8
|
||||
image: stefanprodan/podinfo:0.0.9
|
||||
command:
|
||||
- ./podinfo
|
||||
- -port=9898
|
||||
|
||||
@@ -61,6 +61,20 @@ func (s *Server) echo(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) echoHeaders(w http.ResponseWriter, r *http.Request) {
|
||||
d, err := yaml.Marshal(r.Header)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
w.Write([]byte(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write(d)
|
||||
}
|
||||
|
||||
func (s *Server) backend(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.Method {
|
||||
case "POST":
|
||||
|
||||
@@ -36,6 +36,7 @@ func NewServer(options ...func(*Server)) *Server {
|
||||
s.mux.HandleFunc("/readyz/enable", s.enable)
|
||||
s.mux.HandleFunc("/readyz/disable", s.disable)
|
||||
s.mux.HandleFunc("/echo", s.echo)
|
||||
s.mux.HandleFunc("/echoheaders", s.echoHeaders)
|
||||
s.mux.HandleFunc("/backend", s.backend)
|
||||
s.mux.HandleFunc("/job", s.job)
|
||||
s.mux.HandleFunc("/read", s.read)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package version
|
||||
|
||||
var VERSION = "0.0.8"
|
||||
var VERSION = "0.0.9"
|
||||
var GITCOMMIT = "unknown"
|
||||
|
||||
Reference in New Issue
Block a user