Skip to content

Commit de9d3f3

Browse files
authored
Merge pull request #54 from csfloat/feature/health-check
Health Check
2 parents 6149a3c + e0210a9 commit de9d3f3

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

api/v1/health/router.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package health
2+
3+
import (
4+
"net/http"
5+
6+
"github.com/go-chi/chi/v5"
7+
)
8+
9+
func Router() chi.Router {
10+
r := chi.NewRouter()
11+
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
12+
w.WriteHeader(http.StatusOK)
13+
w.Write([]byte("OK"))
14+
})
15+
return r
16+
}

api/v1/v1.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package v1
22

33
import (
44
"reverse-watch/api/v1/admin"
5+
"reverse-watch/api/v1/health"
56
"reverse-watch/api/v1/marketplace"
67
"reverse-watch/api/v1/reversals"
78
"reverse-watch/api/v1/users"
@@ -11,6 +12,7 @@ import (
1112

1213
func Router() chi.Router {
1314
r := chi.NewRouter()
15+
r.Mount("/health", health.Router())
1416
r.Mount("/marketplace", marketplace.Router())
1517
r.Mount("/reversals", reversals.Router())
1618
r.Mount("/users", users.Router())

deploy/reverse-watch-service.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ spec:
7171
failureThreshold: 1
7272
tcpSocket:
7373
port: 80
74+
livenessProbe:
75+
initialDelaySeconds: 5
76+
timeoutSeconds: 1
77+
periodSeconds: 10
78+
failureThreshold: 3
79+
httpGet:
80+
path: /api/v1/health
81+
port: 80
7482
traffic:
7583
- percent: 100
7684
latestRevision: true

0 commit comments

Comments
 (0)