func (r *HealthyRegistry) Contains(minion string) (bool, error) {
	contains, err := r.delegate.Contains(minion)
	if err != nil {
		return false, err
	}
	if !contains {
		return false, nil
	}
	status, err := health.DoHTTPCheck(r.makeMinionURL(minion), r.client)
	if err != nil {
		return false, err
	}
	if status == health.Unhealthy {
		return false, nil
	}
	return true, nil
}
func (r *HealthyRegistry) List() (currentMinions []string, err error) {
	var result []string
	list, err := r.delegate.List()
	if err != nil {
		return result, err
	}
	for _, minion := range list {
		status, err := health.DoHTTPCheck(r.makeMinionURL(minion), r.client)
		if err != nil {
			glog.Errorf("%s failed health check with error: %s", minion, err)
			continue
		}
		if status == health.Healthy {
			result = append(result, minion)
		}
	}
	return result, nil
}
示例#3
0
func (c *HTTPKubeletClient) HealthCheck(host string) (health.Status, error) {
	return health.DoHTTPCheck(fmt.Sprintf("%s/healthz", c.url(host)), c.Client)
}