mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Add liveness\readiness probe for s3 api handler on /status path
This commit is contained in:
parent
4d55132c7d
commit
e6e57db530
2
Makefile
2
Makefile
|
@ -33,7 +33,7 @@ deps:
|
||||||
rm -rf /home/travis/gopath/src/github.com/coreos/etcd/vendor/golang.org/x/net/trace
|
rm -rf /home/travis/gopath/src/github.com/coreos/etcd/vendor/golang.org/x/net/trace
|
||||||
rm -rf /home/travis/gopath/src/go.etcd.io/etcd/vendor/golang.org/x/net/trace
|
rm -rf /home/travis/gopath/src/go.etcd.io/etcd/vendor/golang.org/x/net/trace
|
||||||
|
|
||||||
build: deps
|
build:
|
||||||
go build $(GO_FLAGS) -ldflags "$(LDFLAGS)" -o $(BINARY) $(SOURCE_DIR)
|
go build $(GO_FLAGS) -ldflags "$(LDFLAGS)" -o $(BINARY) $(SOURCE_DIR)
|
||||||
|
|
||||||
install: deps
|
install: deps
|
||||||
|
|
|
@ -2,12 +2,12 @@ package s3api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/chrislusf/seaweedfs/weed/filer"
|
|
||||||
. "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/chrislusf/seaweedfs/weed/filer"
|
||||||
|
. "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
@ -44,6 +44,10 @@ func NewS3ApiServer(router *mux.Router, option *S3ApiServerOption) (s3ApiServer
|
||||||
func (s3a *S3ApiServer) registerRouter(router *mux.Router) {
|
func (s3a *S3ApiServer) registerRouter(router *mux.Router) {
|
||||||
// API Router
|
// API Router
|
||||||
apiRouter := router.PathPrefix("/").Subrouter()
|
apiRouter := router.PathPrefix("/").Subrouter()
|
||||||
|
|
||||||
|
// Readiness Probe
|
||||||
|
apiRouter.Methods("GET").Path("/status").HandlerFunc(s3a.StatusHandler)
|
||||||
|
|
||||||
var routers []*mux.Router
|
var routers []*mux.Router
|
||||||
if s3a.option.DomainName != "" {
|
if s3a.option.DomainName != "" {
|
||||||
domainNames := strings.Split(s3a.option.DomainName, ",")
|
domainNames := strings.Split(s3a.option.DomainName, ",")
|
||||||
|
|
8
weed/s3api/s3api_status_handlers.go
Normal file
8
weed/s3api/s3api_status_handlers.go
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
package s3api
|
||||||
|
|
||||||
|
import "net/http"
|
||||||
|
|
||||||
|
func (s3a *S3ApiServer) StatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// write out the response code and content type header
|
||||||
|
writeSuccessResponseEmpty(w)
|
||||||
|
}
|
Loading…
Reference in a new issue