Merge pull request #3695 from mikedanese/ready

refactor pkg/health into more reusable pkg/probe
This commit is contained in:
Tim Hockin
2015-01-28 11:00:32 -08:00
28 changed files with 658 additions and 863 deletions

View File

@@ -22,8 +22,8 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/health"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/probe"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
@@ -115,7 +115,7 @@ func (r *HealthyRegistry) doCheck(key string) util.T {
case err != nil:
glog.V(2).Infof("HealthyRegistry: node %q health check error: %v", key, err)
nodeStatus = api.ConditionUnknown
case status == health.Unhealthy:
case status == probe.Failure:
nodeStatus = api.ConditionNone
default:
nodeStatus = api.ConditionFull

View File

@@ -22,15 +22,15 @@ import (
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/health"
"github.com/GoogleCloudPlatform/kubernetes/pkg/probe"
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/registrytest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
)
type alwaysYes struct{}
func (alwaysYes) HealthCheck(host string) (health.Status, error) {
return health.Healthy, nil
func (alwaysYes) HealthCheck(host string) (probe.Status, error) {
return probe.Success, nil
}
func TestBasicDelegation(t *testing.T) {
@@ -75,11 +75,11 @@ type notMinion struct {
minion string
}
func (n *notMinion) HealthCheck(host string) (health.Status, error) {
func (n *notMinion) HealthCheck(host string) (probe.Status, error) {
if host != n.minion {
return health.Healthy, nil
return probe.Success, nil
} else {
return health.Unhealthy, nil
return probe.Failure, nil
}
}