v0.0.9 release

- added echo headers handler
This commit is contained in:
Stefan Prodan
2018-02-25 11:05:12 +02:00
parent 89864c2bec
commit 61c7d36fb4
9 changed files with 22 additions and 6 deletions
+1
View File
@@ -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
+1 -1
View File
@@ -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:
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+14
View File
@@ -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":
+1
View File
@@ -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 -1
View File
@@ -1,4 +1,4 @@
package version
var VERSION = "0.0.8"
var VERSION = "0.0.9"
var GITCOMMIT = "unknown"