mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Correct godoc messages according to review comments
This commit is contained in:
parent
df9da65939
commit
5e31ca3b27
@ -22,10 +22,9 @@ import (
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
// Status is a enum type which describes a health status of a container.
|
||||
type Status int
|
||||
|
||||
// These are the valid values of type Status.
|
||||
// Status takes only one of values of these constants.
|
||||
const (
|
||||
Healthy Status = iota
|
||||
Unhealthy
|
||||
@ -37,10 +36,10 @@ type HTTPGetInterface interface {
|
||||
Get(url string) (*http.Response, error)
|
||||
}
|
||||
|
||||
// Check checks if GET request to the url succeeds.
|
||||
// If the HTTP response code is successful, it returns Healthy.
|
||||
// Check checks if a GET request to the url succeeds.
|
||||
// If the HTTP response code is successful (i.e. 400 > code >= 200), it returns Healthy.
|
||||
// If the HTTP response code is unsuccessful, it returns Unhealthy.
|
||||
// And it return Unknown and err if the HTTP communication itself fails.
|
||||
// It returns Unknown and err if the HTTP communication itself fails.
|
||||
func Check(url string, client HTTPGetInterface) (Status, error) {
|
||||
res, err := client.Get(url)
|
||||
if res.Body != nil {
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
// HealthChecker hides implementation details of how to check if the container is healthy.
|
||||
// HealthChecker defines an abstract interface for checking container health.
|
||||
type HealthChecker interface {
|
||||
HealthCheck(container api.Container) (Status, error)
|
||||
}
|
||||
@ -48,6 +48,7 @@ type MuxHealthChecker struct {
|
||||
|
||||
// HealthCheck delegates the health-checking of the container to one of the bundled implementations.
|
||||
// It chooses an implementation according to container.LivenessProbe.Type.
|
||||
// If there is no matching healthc checker it returns Unknown, nil.
|
||||
func (m *MuxHealthChecker) HealthCheck(container api.Container) (Status, error) {
|
||||
checker, ok := m.checkers[container.LivenessProbe.Type]
|
||||
if !ok || checker == nil {
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
)
|
||||
|
||||
// fakeHTTPClient is a face implementation of HTTPGetInterface.
|
||||
// fakeHTTPClient is a fake implementation of HTTPGetInterface.
|
||||
type fakeHTTPClient struct {
|
||||
req string
|
||||
res http.Response
|
||||
|
Loading…
Reference in New Issue
Block a user