From 42405442e71fb602d174e484051203ad86d70660 Mon Sep 17 00:00:00 2001 From: Jiahui Feng Date: Mon, 30 Aug 2021 14:42:36 -0700 Subject: [PATCH] HealthCheckable interface. --- .../controller/interfaces.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/staging/src/k8s.io/controller-manager/controller/interfaces.go b/staging/src/k8s.io/controller-manager/controller/interfaces.go index 6c9c0b96b61..3a95af4297c 100644 --- a/staging/src/k8s.io/controller-manager/controller/interfaces.go +++ b/staging/src/k8s.io/controller-manager/controller/interfaces.go @@ -16,7 +16,11 @@ limitations under the License. package controller -import "net/http" +import ( + "net/http" + + "k8s.io/controller-manager/pkg/healthz" +) // Interface defines the base of a controller managed by a controller manager type Interface interface { @@ -36,3 +40,16 @@ type Debuggable interface { // The handler will be accessible at "/debug/controllers/{controllerName}/". DebuggingHandler() http.Handler } + +// HealthCheckable defines a controller that allows the controller manager +// to include it in the health checks. +// +// If a controller implements HealthCheckable, and the returned check +// is not nil, the controller manager can expose the check to the +// /healthz endpoint. +type HealthCheckable interface { + // HealthChecker returns a UnnamedHealthChecker that the controller manager + // can choose to mount on the /healthz endpoint, or nil if no custom + // health check is desired. + HealthChecker() healthz.UnnamedHealthChecker +}