Add healthz checker
This commit is contained in:
parent
d1fb96ac10
commit
478d51c827
5 changed files with 37 additions and 23 deletions
|
|
@ -18,7 +18,6 @@ package controller
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
|
@ -35,7 +34,6 @@ import (
|
|||
unversionedcore "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
|
||||
"k8s.io/kubernetes/pkg/client/record"
|
||||
"k8s.io/kubernetes/pkg/fields"
|
||||
"k8s.io/kubernetes/pkg/healthz"
|
||||
"k8s.io/kubernetes/pkg/util/flowcontrol"
|
||||
"k8s.io/kubernetes/pkg/util/intstr"
|
||||
|
||||
|
|
@ -78,8 +76,6 @@ var (
|
|||
|
||||
// GenericController holds the boilerplate code required to build an Ingress controlller.
|
||||
type GenericController struct {
|
||||
healthz.HealthzChecker
|
||||
|
||||
cfg *Configuration
|
||||
|
||||
ingController *cache.Controller
|
||||
|
|
@ -283,24 +279,6 @@ func (ic *GenericController) controllersInSync() bool {
|
|||
ic.mapController.HasSynced()
|
||||
}
|
||||
|
||||
// Name returns the healthcheck name
|
||||
func (ic GenericController) Name() string {
|
||||
return "Ingress Controller"
|
||||
}
|
||||
|
||||
// Check returns if the nginx healthz endpoint is returning ok (status code 200)
|
||||
func (ic GenericController) Check(_ *http.Request) error {
|
||||
res, err := http.Get("http://127.0.0.1:18080/healthz")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != 200 {
|
||||
return fmt.Errorf("Ingress controller is not healthy")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Info returns information about the backend
|
||||
func (ic GenericController) Info() *ingress.BackendInfo {
|
||||
return ic.cfg.Backend.Info()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue