diff --git a/VERSION b/VERSION index 79127d8..18fa8e7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v1.2.0 +v1.3.0 diff --git a/src/http/handler.go b/src/http/handler.go index 7db52ba..cefe602 100644 --- a/src/http/handler.go +++ b/src/http/handler.go @@ -18,6 +18,8 @@ const ( credentialType = "AWS-HMAC" credentialCode = "Success" iamPath = "/meta-data/iam/security-credentials/" + healthMethod = "GET" + healthPath = "/healthcheck" ) var ( @@ -50,7 +52,11 @@ func (handler *httpHandler) serveFastHTTP(ctx *fasthttp.RequestCtx) { "remoteAddr": addr, }) - if method == iamMethod { + if method == healthMethod && path == healthPath { + logger.Debug("Serving health check request") + handler.serveHealthRequest(ctx, logger) + return + } else if method == iamMethod { idx := strings.LastIndex(path, iamPath) if idx == (len(path) - len(iamPath)) { logger.Debug("Serving list IAM credentials request") @@ -127,6 +133,11 @@ func (handler *httpHandler) serveDeniedRequest(ctx *fasthttp.RequestCtx, addr st logger.Debug("Successfully responded") } +func (handler *httpHandler) serveHealthRequest(ctx *fasthttp.RequestCtx, logger *logrus.Entry) { + ctx.SetStatusCode(200) + logger.Debug("Successfully responded") +} + func (handler *httpHandler) credentialsForAddress(address string) (*string, *sts.Credentials, error) { ip := strings.Split(address, ":")[0] role, err := handler.containerStore.IAMRoleForIP(ip)