summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorWindrow <565101079@qq.com>2023-11-06 17:28:59 +0800
committerWindrow <565101079@qq.com>2023-11-06 17:28:59 +0800
commit565e2570b14453cc6a37361f6067d9cdea8f1705 (patch)
tree0a0ac2d07dc6ae655527a3357ad31384cbd76e99 /pkg
parentMerge pull request #5128 from testwill/typo (diff)
downloadkubeedge-565e2570b14453cc6a37361f6067d9cdea8f1705.tar.gz
Add support of getting healthz, livez, readyz for metaserver.
Signed-off-by: Windrow <565101079@qq.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/util/pass-through/pass_through.go8
-rw-r--r--pkg/util/pass-through/pass_through_test.go35
2 files changed, 37 insertions, 6 deletions
diff --git a/pkg/util/pass-through/pass_through.go b/pkg/util/pass-through/pass_through.go
index 225512546..3aac50bb3 100644
--- a/pkg/util/pass-through/pass_through.go
+++ b/pkg/util/pass-through/pass_through.go
@@ -3,11 +3,17 @@ package passthrough
type passRequest string
const (
- versionRequest passRequest = "/version::get"
+ versionRequest passRequest = "/version::get"
+ healthRequest passRequest = "/healthz::get"
+ liveRequest passRequest = "/livez::get"
+ readyRequest passRequest = "/readyz::get"
)
var passThroughMap = map[passRequest]bool{
versionRequest: true,
+ healthRequest: true,
+ liveRequest: true,
+ readyRequest: true,
}
// IsPassThroughPath determining whether the uri can be passed through
diff --git a/pkg/util/pass-through/pass_through_test.go b/pkg/util/pass-through/pass_through_test.go
index ddbd21b02..287e61e9a 100644
--- a/pkg/util/pass-through/pass_through_test.go
+++ b/pkg/util/pass-through/pass_through_test.go
@@ -10,11 +10,6 @@ func TestIsPassThroughPath(t *testing.T) {
want bool
}{
{
- name: "/healthz::get is not pass through path",
- path: "/healthz",
- verb: "get",
- want: false,
- }, {
name: "/version::post is not pass through path",
path: "/version",
verb: "post",
@@ -24,6 +19,36 @@ func TestIsPassThroughPath(t *testing.T) {
path: "/version",
verb: "get",
want: true,
+ }, {
+ name: "/healthz::update is not pass through path",
+ path: "/healthz",
+ verb: "update",
+ want: false,
+ }, {
+ name: "/healthz::get is pass through path",
+ path: "/healthz",
+ verb: "get",
+ want: true,
+ }, {
+ name: "/livez::create is not pass through path",
+ path: "/livez",
+ verb: "create",
+ want: false,
+ }, {
+ name: "/livez::get is pass through path",
+ path: "/livez",
+ verb: "get",
+ want: true,
+ }, {
+ name: "/readyz::delete is not pass through path",
+ path: "/readyz",
+ verb: "delete",
+ want: false,
+ }, {
+ name: "/readyz::get is pass through path",
+ path: "/readyz",
+ verb: "get",
+ want: true,
},
}
for _, tt := range tests {