コード例 #1
0
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
}
コード例 #2
0
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)
}