示例#1
0
文件: rest.go 项目: 40a/bootkube
func (rs *REST) getComponentStatus(name string, server apiserver.Server) *api.ComponentStatus {
	status, msg, err := server.DoServerCheck(rs.prober)
	errorMsg := ""
	if err != nil {
		errorMsg = err.Error()
	}

	c := &api.ComponentCondition{
		Type:    api.ComponentHealthy,
		Status:  ToConditionStatus(status),
		Message: msg,
		Error:   errorMsg,
	}

	retVal := &api.ComponentStatus{
		Conditions: []api.ComponentCondition{*c},
	}
	retVal.Name = name

	return retVal
}
示例#2
0
func (rs *REST) getComponentStatus(name string, server apiserver.Server) *api.ComponentStatus {
	transport := rs.rt
	status, msg, err := server.DoServerCheck(transport)
	var errorMsg string
	if err != nil {
		errorMsg = err.Error()
	} else {
		errorMsg = "nil"
	}

	c := &api.ComponentCondition{
		Type:    api.ComponentHealthy,
		Status:  ToConditionStatus(status),
		Message: msg,
		Error:   errorMsg,
	}

	retVal := &api.ComponentStatus{
		Conditions: []api.ComponentCondition{*c},
	}
	retVal.Name = name

	return retVal
}