File tree Expand file tree Collapse file tree 3 files changed +24
-4
lines changed
backend/src/routes/api/health Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change
1
+ import { KubeFastifyInstance } from '../../../types' ;
2
+ import { createCustomError } from '../../../utils/requestUtils' ;
3
+
4
+ export const health = async ( fastify : KubeFastifyInstance ) : Promise < { health : string } > => {
5
+ const kubeContext = fastify . kube ?. currentContext || '' ;
6
+ if ( ! kubeContext && ! kubeContext . trim ( ) ) {
7
+ const error = createCustomError ( 'failed to get kube status' , 'Failed to get Kube context' , 503 ) ;
8
+ fastify . log . error ( error , 'failed to get status' ) ;
9
+ throw error ;
10
+ } else {
11
+ return { health : 'ok' } ;
12
+ }
13
+ } ;
Original file line number Diff line number Diff line change
1
+ import { FastifyInstance , FastifyReply , FastifyRequest } from 'fastify' ;
2
+ import { health } from './healthUtils' ;
3
+
4
+ export default async ( fastify : FastifyInstance ) : Promise < void > => {
5
+ // Unsecured route for health check
6
+ fastify . get ( '/' , async ( request : FastifyRequest , reply : FastifyReply ) => {
7
+ return health ( fastify ) ;
8
+ } ) ;
9
+ } ;
Original file line number Diff line number Diff line change @@ -39,18 +39,16 @@ spec:
39
39
cpu : 1000m
40
40
memory : 2Gi
41
41
livenessProbe :
42
- httpGet :
43
- path : /api/config
42
+ tcpSocket :
44
43
port : 8080
45
- scheme : HTTP
46
44
initialDelaySeconds : 30
47
45
timeoutSeconds : 15
48
46
periodSeconds : 30
49
47
successThreshold : 1
50
48
failureThreshold : 3
51
49
readinessProbe :
52
50
httpGet :
53
- path : /api/config
51
+ path : /api/health
54
52
port : 8080
55
53
scheme : HTTP
56
54
initialDelaySeconds : 30
You can’t perform that action at this time.
0 commit comments