mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-20 17:38:50 +00:00
Correct godoc messages according to review comments
This commit is contained in:
@@ -22,10 +22,9 @@ import (
|
|||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Status is a enum type which describes a health status of a container.
|
|
||||||
type Status int
|
type Status int
|
||||||
|
|
||||||
// These are the valid values of type Status.
|
// Status takes only one of values of these constants.
|
||||||
const (
|
const (
|
||||||
Healthy Status = iota
|
Healthy Status = iota
|
||||||
Unhealthy
|
Unhealthy
|
||||||
@@ -37,10 +36,10 @@ type HTTPGetInterface interface {
|
|||||||
Get(url string) (*http.Response, error)
|
Get(url string) (*http.Response, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check checks if GET request to the url succeeds.
|
// Check checks if a GET request to the url succeeds.
|
||||||
// If the HTTP response code is successful, it returns Healthy.
|
// 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.
|
// 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) {
|
func Check(url string, client HTTPGetInterface) (Status, error) {
|
||||||
res, err := client.Get(url)
|
res, err := client.Get(url)
|
||||||
if res.Body != nil {
|
if res.Body != nil {
|
||||||
|
@@ -25,7 +25,7 @@ import (
|
|||||||
"github.com/golang/glog"
|
"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 {
|
type HealthChecker interface {
|
||||||
HealthCheck(container api.Container) (Status, error)
|
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.
|
// HealthCheck delegates the health-checking of the container to one of the bundled implementations.
|
||||||
// It chooses an implementation according to container.LivenessProbe.Type.
|
// 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) {
|
func (m *MuxHealthChecker) HealthCheck(container api.Container) (Status, error) {
|
||||||
checker, ok := m.checkers[container.LivenessProbe.Type]
|
checker, ok := m.checkers[container.LivenessProbe.Type]
|
||||||
if !ok || checker == nil {
|
if !ok || checker == nil {
|
||||||
|
@@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fakeHTTPClient is a face implementation of HTTPGetInterface.
|
// fakeHTTPClient is a fake implementation of HTTPGetInterface.
|
||||||
type fakeHTTPClient struct {
|
type fakeHTTPClient struct {
|
||||||
req string
|
req string
|
||||||
res http.Response
|
res http.Response
|
||||||
|
Reference in New Issue
Block a user