新增监控接口

This commit is contained in:
沈健
2021-06-07 13:43:20 +08:00
parent 560bde3f78
commit ab4bbbffcd
3 changed files with 36 additions and 5 deletions
+6 -4
View File
@@ -39,13 +39,15 @@ spec:
name: web
protocol: TCP
readinessProbe:
tcpSocket:
port: 8080
httpGet:
path: /k8s/readiness
port: web
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
httpGet:
path: /k8s/liveness
port: web
initialDelaySeconds: 10
periodSeconds: 5
volumeMounts:
@@ -0,0 +1,28 @@
package com.fangjia.bkoff.controllers;
/**
* 房价网后台存活监控
*
* @author shenjian
* @since 2021/6/7
*/
public class K8sController {
/**
* 存活检查
*
* @return
*/
public Object livenessAction() {
return "liveness";
}
/**
* 就绪检查
*
* @return
*/
public Object readinessAction() {
return "readiness";
}
}
@@ -40,7 +40,8 @@ public class AuthInterceptor implements Interceptor {
request.setAttribute("__resources", request.getSession().getAttribute(userId + "_resources"));
if (invocation.getAction().getController().getName().equals("login")
|| invocation.getAction().getController().getName().equals("")) {
|| invocation.getAction().getController().getName().equals("")
|| invocation.getAction().getController().getName().equals("k8s")) {
return invocation.invoke();
}