aboutsummaryrefslogtreecommitdiff
path: root/weed
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2021-08-10 04:00:15 -0700
committerGitHub <noreply@github.com>2021-08-10 04:00:15 -0700
commit1098ed0d78ce63d0e5435950e8495a339783376c (patch)
tree6e58fb3d01df5761656831020156541c86422cfa /weed
parentf9cf9b93d32a2b01bc4d95ce7d24d86ef60be668 (diff)
parent095f66cd64dee0c0a7972bd770a67ba426703bf9 (diff)
downloadseaweedfs-1098ed0d78ce63d0e5435950e8495a339783376c.tar.xz
seaweedfs-1098ed0d78ce63d0e5435950e8495a339783376c.zip
Merge pull request #2245 from Bl1tz23/master
Simple healthcheck for S3 API Server
Diffstat (limited to 'weed')
-rw-r--r--weed/s3api/s3api_server.go10
-rw-r--r--weed/s3api/s3api_status_handlers.go8
2 files changed, 15 insertions, 3 deletions
diff --git a/weed/s3api/s3api_server.go b/weed/s3api/s3api_server.go
index 57f4ba917..27259c4a7 100644
--- a/weed/s3api/s3api_server.go
+++ b/weed/s3api/s3api_server.go
@@ -2,13 +2,13 @@ package s3api
import (
"fmt"
- "github.com/chrislusf/seaweedfs/weed/filer"
- . "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants"
- "github.com/chrislusf/seaweedfs/weed/s3api/s3err"
"net/http"
"strings"
"time"
+ "github.com/chrislusf/seaweedfs/weed/filer"
+ . "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants"
+ "github.com/chrislusf/seaweedfs/weed/s3api/s3err"
"github.com/gorilla/mux"
"google.golang.org/grpc"
)
@@ -45,6 +45,10 @@ func NewS3ApiServer(router *mux.Router, option *S3ApiServerOption) (s3ApiServer
func (s3a *S3ApiServer) registerRouter(router *mux.Router) {
// API Router
apiRouter := router.PathPrefix("/").Subrouter()
+
+ // Readiness Probe
+ apiRouter.Methods("GET").Path("/status").HandlerFunc(s3a.StatusHandler)
+
var routers []*mux.Router
if s3a.option.DomainName != "" {
domainNames := strings.Split(s3a.option.DomainName, ",")
diff --git a/weed/s3api/s3api_status_handlers.go b/weed/s3api/s3api_status_handlers.go
new file mode 100644
index 000000000..914c27f40
--- /dev/null
+++ b/weed/s3api/s3api_status_handlers.go
@@ -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)
+}