diff --git a/manifests/upn-qr.yaml b/manifests/upn-qr.yaml index 6d81ea9..35f63eb 100644 --- a/manifests/upn-qr.yaml +++ b/manifests/upn-qr.yaml @@ -21,6 +21,23 @@ spec: - name: upn-qr-ct image: registry.gitplac.si/aljaxus/upn-qr imagePullPolicy: Always + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + readinessProbe: + httpGet: + path: "/healthcheck" + port: 80 + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: + httpGet: + path: "/healthcheck" + port: 80 + initialDelaySeconds: 10 + periodSeconds: 20 ports: - containerPort: 80 diff --git a/src/index.js b/src/index.js index 3bfa230..0569062 100644 --- a/src/index.js +++ b/src/index.js @@ -15,6 +15,7 @@ app.set('views', path.join(__dirname, 'views')) app.set('view engine', 'ejs') app.get('/', (req, res) => res.render('index')) +app.get('/healthcheck', (req, res) => res.send({ ok: true, pod: process.env.POD_NAME })) app.get('/form', (req, res) => res.render('form', { q: req.query })) app.get('/api/qrcode', async (req, res) => { @@ -88,4 +89,4 @@ ${String(req.query.issuer_city).toUpperCase()}` }) -app.listen(process.env.PORT || 80, () => console.log(`UPN-QR started on port ${process.env.PORT || 80}`)) \ No newline at end of file +app.listen(process.env.PORT || 80, () => console.log(`UPN-QR started on port ${process.env.PORT || 80}`))