remove detailed proxy status
There are two problems with obtaining the proxy status via the normal proxy endpoint... 1. when TLS is enabled, this requires using TLS at the client end 2. the status URL is mixed in with the docker remote API, which is rather unclean There is limited value to having some status output from the proxy, since all the output is constant. So instead we log the version and command line args, and in `weave status` only report whether the proxy is running. We still want a way to wait for the proxy to start up, and log a nice error if it dies. We do this by polling the docker logs for a startup message. Fixes #877. Fixes #876. Undoes most of #756, #800, #854.
This commit is contained in:
1 parent
2d70197221
commit
fee2898c05
4 files changed
+38
-52
No files matched your search
+1
-27
@@ -1,14 +1,11 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/fsouza/go-dockerclient"
|
||||
. "github.com/weaveworks/weave/common"
|
||||
@@ -94,9 +91,6 @@ func (proxy *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
proxy.serveWithInterceptor(&startContainerInterceptor{proxy.client, proxy.WithDNS, proxy.WithIPAM}, w, r)
|
||||
case execCreateRegexp.MatchString(path):
|
||||
proxy.serveWithInterceptor(&createExecInterceptor{proxy.client, proxy.WithIPAM}, w, r)
|
||||
case strings.HasPrefix(path, "/status"):
|
||||
fmt.Fprintln(w, "weave proxy", proxy.Version)
|
||||
fmt.Fprintln(w, proxy.Status())
|
||||
default:
|
||||
proxy.serveWithInterceptor(&nullInterceptor{}, w, r)
|
||||
}
|
||||
@@ -106,24 +100,6 @@ func (proxy *Proxy) serveWithInterceptor(i interceptor, w http.ResponseWriter, r
|
||||
newClient(proxy.dial, i).ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
// Return status string
|
||||
func (proxy *Proxy) Status() string {
|
||||
var buf bytes.Buffer
|
||||
fmt.Fprintln(&buf, "Listen address is", proxy.ListenAddr)
|
||||
fmt.Fprintln(&buf, "Docker address is", proxy.DockerAddr)
|
||||
switch {
|
||||
case proxy.TLSConfig.Verify:
|
||||
fmt.Fprintln(&buf, "TLS verify")
|
||||
case proxy.TLSConfig.Enabled:
|
||||
fmt.Fprintln(&buf, "TLS on")
|
||||
default:
|
||||
fmt.Fprintln(&buf, "TLS off")
|
||||
}
|
||||
fmt.Fprintln(&buf, "DNS", OnOff(proxy.WithDNS))
|
||||
fmt.Fprintln(&buf, "IPAM", OnOff(proxy.WithIPAM))
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func (proxy *Proxy) ListenAndServe() error {
|
||||
listener, err := net.Listen("tcp", proxy.ListenAddr)
|
||||
if err != nil {
|
||||
@@ -132,11 +108,9 @@ func (proxy *Proxy) ListenAndServe() error {
|
||||
|
||||
if proxy.TLSConfig.enabled() {
|
||||
listener = tls.NewListener(listener, proxy.TLSConfig.Config)
|
||||
Info.Println("TLS Enabled")
|
||||
}
|
||||
|
||||
Info.Printf("Listening on %s", proxy.ListenAddr)
|
||||
Info.Printf("Proxying %s", proxy.DockerAddr)
|
||||
Info.Println("proxy listening")
|
||||
|
||||
return (&http.Server{Handler: proxy}).Serve(listener)
|
||||
}
|
||||
Reference in new issue
Block a user