[fix] cancel the depency between healthcheck and etcd (#319)

Co-authored-by: songshiyuan 00649746 <songshiyuan3@huawei.com>
diff --git a/pkg/common/common.go b/pkg/common/common.go
index 9e452f3..7eb1d3d 100644
--- a/pkg/common/common.go
+++ b/pkg/common/common.go
@@ -40,6 +40,7 @@
 	QueryParamURLPath      = "urlPath"
 	QueryParamUserAgent    = "userAgent"
 	QueryParamOverride     = "override"
+	QueryParamMode         = "mode"
 )
 
 // http headers
diff --git a/server/resource/v1/admin_resource.go b/server/resource/v1/admin_resource.go
index 4d79eb1..d63b0a4 100644
--- a/server/resource/v1/admin_resource.go
+++ b/server/resource/v1/admin_resource.go
@@ -22,13 +22,15 @@
 	"strconv"
 	"time"
 
-	"github.com/apache/servicecomb-kie/pkg/model"
-	"github.com/apache/servicecomb-kie/server/datasource"
 	goRestful "github.com/emicklei/go-restful"
 	"github.com/go-chassis/cari/config"
 	"github.com/go-chassis/go-chassis/v2/pkg/runtime"
 	"github.com/go-chassis/go-chassis/v2/server/restful"
 	"github.com/go-chassis/openlog"
+
+	"github.com/apache/servicecomb-kie/pkg/common"
+	"github.com/apache/servicecomb-kie/pkg/model"
+	"github.com/apache/servicecomb-kie/server/datasource"
 )
 
 type AdminResource struct {
@@ -57,6 +59,10 @@
 
 // HealthCheck provider version info and time info
 func (r *AdminResource) HealthCheck(context *restful.Context) {
+	healthCheckMode := context.ReadQueryParameter(common.QueryParamMode)
+	if healthCheckMode == "liveness" {
+		return
+	}
 	domain := ReadDomain(context.Ctx)
 	resp := &model.DocHealthCheck{}
 	latest, err := datasource.GetBroker().GetRevisionDao().GetRevision(context.Ctx, domain)
diff --git a/server/resource/v1/admin_resource_test.go b/server/resource/v1/admin_resource_test.go
index 2ed6c2f..d528030 100644
--- a/server/resource/v1/admin_resource_test.go
+++ b/server/resource/v1/admin_resource_test.go
@@ -27,10 +27,11 @@
 
 	_ "github.com/apache/servicecomb-kie/test"
 
-	"github.com/apache/servicecomb-kie/pkg/model"
-	v1 "github.com/apache/servicecomb-kie/server/resource/v1"
 	"github.com/go-chassis/go-chassis/v2/server/restful/restfultest"
 	"github.com/stretchr/testify/assert"
+
+	"github.com/apache/servicecomb-kie/pkg/model"
+	v1 "github.com/apache/servicecomb-kie/server/resource/v1"
 )
 
 func Test_HeathCheck(t *testing.T) {
@@ -48,3 +49,16 @@
 	assert.NoError(t, err)
 	assert.NotEmpty(t, data)
 }
+
+func Test_HeakthCheckLiveMode(t *testing.T) {
+	path := fmt.Sprintf("/v1/health?mode=liveness")
+	r, _ := http.NewRequest("GET", path, nil)
+
+	revision := &v1.AdminResource{}
+	c, err := restfultest.New(revision, nil)
+	assert.NoError(t, err)
+	resp := httptest.NewRecorder()
+	c.ServeHTTP(resp, r)
+	respcode := resp.Code
+	assert.NotEmpty(t, respcode)
+}