Skip to content

Commit

Permalink
Merge pull request #340 from razee-io/liveness_db
Browse files Browse the repository at this point in the history
added a db call to the liveness probe
  • Loading branch information
rmgraham authored May 20, 2020
2 parents 99e8a77 + 953441f commit b69dc85
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/routes/kube/kube.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
*/

const express = require('express');
const asyncHandler = require('express-async-handler');
const router = express.Router();

// /kube/liveness
const kube = router.get('/liveness', (req, res) => {
const kube = router.get('/liveness', asyncHandler(async(req, res) => {
// does a db call to make sure we didnt disconnect
await require('../../apollo/models').models.Cluster.find({}, { _id:1 }, { limit:1 });

return res.sendStatus(200);
});
}));

module.exports = kube;
2 changes: 1 addition & 1 deletion kubernetes/razeedash-api/resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ items:
path: /api/kube/liveness
port: 3333
initialDelaySeconds: 5
periodSeconds: 10
periodSeconds: 20
timeoutSeconds: 2
resources:
requests:
Expand Down

0 comments on commit b69dc85

Please sign in to comment.