mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Fixed "componentstatuses" API object JSON descriptions.
This commit is contained in:
parent
78356bf7f9
commit
81ef0198f4
@ -49,9 +49,9 @@ cat -n "${MINIONS_FILE}"
|
|||||||
|
|
||||||
attempt=0
|
attempt=0
|
||||||
while true; do
|
while true; do
|
||||||
kubectl_output=$("${KUBE_ROOT}/cluster/kubectl.sh" get componentstatus)
|
kubectl_output=$("${KUBE_ROOT}/cluster/kubectl.sh" get cs)
|
||||||
|
|
||||||
# The "kubectl validate" output is four columns like this:
|
# The "kubectl componentstatuses" output is four columns like this:
|
||||||
#
|
#
|
||||||
# COMPONENT HEALTH MSG ERR
|
# COMPONENT HEALTH MSG ERR
|
||||||
# controller-manager Healthy ok nil
|
# controller-manager Healthy ok nil
|
||||||
|
@ -1837,10 +1837,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ComponentCondition struct {
|
type ComponentCondition struct {
|
||||||
Type ComponentConditionType `json:"type" description:"the type of condition"`
|
Type ComponentConditionType `json:"type"`
|
||||||
Status ConditionStatus `json:"status" description:"the status of this condition"`
|
Status ConditionStatus `json:"status"`
|
||||||
Message string `json:"message,omitempty" description:"health check message received from the component"`
|
Message string `json:"message,omitempty"`
|
||||||
Error string `json:"error,omitempty" description:"error code from health check attempt (if any)"`
|
Error string `json:"error,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
|
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
|
||||||
@ -1848,13 +1848,12 @@ type ComponentStatus struct {
|
|||||||
TypeMeta `json:",inline"`
|
TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Name string `json:"name,omitempty" description:"name of the component"`
|
Conditions []ComponentCondition `json:"conditions,omitempty"`
|
||||||
Conditions []ComponentCondition `json:"conditions,omitempty" description:"list of component condition objects"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ComponentStatusList struct {
|
type ComponentStatusList struct {
|
||||||
TypeMeta `json:",inline"`
|
TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Items []ComponentStatus `json:"items" description:"items is a list of component status objects"`
|
Items []ComponentStatus `json:"items"`
|
||||||
}
|
}
|
||||||
|
@ -1602,8 +1602,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ComponentCondition struct {
|
type ComponentCondition struct {
|
||||||
Type ComponentConditionType `json:"type"`
|
Type ComponentConditionType `json:"type" description:"type of component condition, currently only Healthy"`
|
||||||
Status ConditionStatus `json:"status"`
|
Status ConditionStatus `json:"status" description:"current status of this component condition, one of True, False, Unknown"`
|
||||||
Message string `json:"message,omitempty" description:"health check message received from the component"`
|
Message string `json:"message,omitempty" description:"health check message received from the component"`
|
||||||
Error string `json:"error,omitempty" description:"error code from health check attempt (if any)"`
|
Error string `json:"error,omitempty" description:"error code from health check attempt (if any)"`
|
||||||
}
|
}
|
||||||
@ -1613,11 +1613,11 @@ type ComponentStatus struct {
|
|||||||
TypeMeta `json:",inline"`
|
TypeMeta `json:",inline"`
|
||||||
|
|
||||||
Name string `json:"name,omitempty" description:"name of the component"`
|
Name string `json:"name,omitempty" description:"name of the component"`
|
||||||
Conditions []ComponentCondition `json:"conditions,omitempty"`
|
Conditions []ComponentCondition `json:"conditions,omitempty" description:"list of component conditions observed"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ComponentStatusList struct {
|
type ComponentStatusList struct {
|
||||||
TypeMeta `json:",inline"`
|
TypeMeta `json:",inline"`
|
||||||
|
|
||||||
Items []ComponentStatus `json:"items" description:"items is a list of component status objects"`
|
Items []ComponentStatus `json:"items" description:"list of component status objects"`
|
||||||
}
|
}
|
||||||
|
@ -1665,8 +1665,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ComponentCondition struct {
|
type ComponentCondition struct {
|
||||||
Type ComponentConditionType `json:"type"`
|
Type ComponentConditionType `json:"type" description:"type of component condition, currently only Healthy"`
|
||||||
Status ConditionStatus `json:"status"`
|
Status ConditionStatus `json:"status" description:"current status of this component condition, one of True, False, Unknown"`
|
||||||
Message string `json:"message,omitempty" description:"health check message received from the component"`
|
Message string `json:"message,omitempty" description:"health check message received from the component"`
|
||||||
Error string `json:"error,omitempty" description:"error code from health check attempt (if any)"`
|
Error string `json:"error,omitempty" description:"error code from health check attempt (if any)"`
|
||||||
}
|
}
|
||||||
@ -1676,11 +1676,11 @@ type ComponentStatus struct {
|
|||||||
TypeMeta `json:",inline"`
|
TypeMeta `json:",inline"`
|
||||||
|
|
||||||
Name string `json:"name,omitempty" description:"name of the component"`
|
Name string `json:"name,omitempty" description:"name of the component"`
|
||||||
Conditions []ComponentCondition `json:"conditions,omitempty"`
|
Conditions []ComponentCondition `json:"conditions,omitempty" description:"list of component conditions observed"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ComponentStatusList struct {
|
type ComponentStatusList struct {
|
||||||
TypeMeta `json:",inline"`
|
TypeMeta `json:",inline"`
|
||||||
|
|
||||||
Items []ComponentStatus `json:"items" description:"items is a list of component status objects"`
|
Items []ComponentStatus `json:"items" description:"list of component status objects"`
|
||||||
}
|
}
|
||||||
|
@ -1683,7 +1683,7 @@ const (
|
|||||||
|
|
||||||
type ComponentCondition struct {
|
type ComponentCondition struct {
|
||||||
Type ComponentConditionType `json:"type" description:"type of component condition, currently only Healthy"`
|
Type ComponentConditionType `json:"type" description:"type of component condition, currently only Healthy"`
|
||||||
Status ConditionStatus `json:"status" description:"current status of this component condition"`
|
Status ConditionStatus `json:"status" description:"current status of this component condition, one of True, False, Unknown"`
|
||||||
Message string `json:"message,omitempty" description:"health check message received from the component"`
|
Message string `json:"message,omitempty" description:"health check message received from the component"`
|
||||||
Error string `json:"error,omitempty" description:"error code from health check attempt (if any)"`
|
Error string `json:"error,omitempty" description:"error code from health check attempt (if any)"`
|
||||||
}
|
}
|
||||||
@ -1691,15 +1691,14 @@ type ComponentCondition struct {
|
|||||||
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
|
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
|
||||||
type ComponentStatus struct {
|
type ComponentStatus struct {
|
||||||
TypeMeta `json:",inline"`
|
TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty" description:"standard object metadata; see https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/api-conventions.md#metadata"`
|
||||||
|
|
||||||
Name string `json:"name,omitempty" description:"name of the component"`
|
Conditions []ComponentCondition `json:"conditions,omitempty" description:"list of component conditions observed" patchStrategy:"merge" patchMergeKey:"type"`
|
||||||
Conditions []ComponentCondition `json:"conditions,omitempty" description:"Conditions is a list of ComponentCondition objects"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ComponentStatusList struct {
|
type ComponentStatusList struct {
|
||||||
TypeMeta `json:",inline"`
|
TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
ListMeta `json:"metadata,omitempty" description:"standard list metadata; see https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/api-conventions.md#metadata"`
|
||||||
|
|
||||||
Items []ComponentStatus `json:"items" description:"items is a list of ComponentStatus objects"`
|
Items []ComponentStatus `json:"items" description:"list of component status objects"`
|
||||||
}
|
}
|
||||||
|
@ -90,23 +90,25 @@ func testData() (*api.PodList, *api.ServiceList, *api.ReplicationControllerList)
|
|||||||
|
|
||||||
func testComponentStatusData() *api.ComponentStatusList {
|
func testComponentStatusData() *api.ComponentStatusList {
|
||||||
good := &api.ComponentStatus{
|
good := &api.ComponentStatus{
|
||||||
Name: "servergood",
|
|
||||||
Conditions: []api.ComponentCondition{
|
Conditions: []api.ComponentCondition{
|
||||||
{Type: api.ComponentHealthy, Status: api.ConditionTrue, Message: "ok", Error: "nil"},
|
{Type: api.ComponentHealthy, Status: api.ConditionTrue, Message: "ok", Error: "nil"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
good.Name = "servergood"
|
||||||
|
|
||||||
bad := &api.ComponentStatus{
|
bad := &api.ComponentStatus{
|
||||||
Name: "serverbad",
|
|
||||||
Conditions: []api.ComponentCondition{
|
Conditions: []api.ComponentCondition{
|
||||||
{Type: api.ComponentHealthy, Status: api.ConditionFalse, Message: "", Error: "bad status: 500"},
|
{Type: api.ComponentHealthy, Status: api.ConditionFalse, Message: "", Error: "bad status: 500"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
bad.Name = "serverbad"
|
||||||
|
|
||||||
unknown := &api.ComponentStatus{
|
unknown := &api.ComponentStatus{
|
||||||
Name: "serverunknown",
|
|
||||||
Conditions: []api.ComponentCondition{
|
Conditions: []api.ComponentCondition{
|
||||||
{Type: api.ComponentHealthy, Status: api.ConditionUnknown, Message: "", Error: "fizzbuzz error"},
|
{Type: api.ComponentHealthy, Status: api.ConditionUnknown, Message: "", Error: "fizzbuzz error"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
unknown.Name = "serverunknown"
|
||||||
|
|
||||||
return &api.ComponentStatusList{
|
return &api.ComponentStatusList{
|
||||||
Items: []api.ComponentStatus{*good, *bad, *unknown},
|
Items: []api.ComponentStatus{*good, *bad, *unknown},
|
||||||
|
@ -97,7 +97,7 @@ func (e ShortcutExpander) VersionAndKindForResource(resource string) (defaultVer
|
|||||||
func expandResourceShortcut(resource string) string {
|
func expandResourceShortcut(resource string) string {
|
||||||
shortForms := map[string]string{
|
shortForms := map[string]string{
|
||||||
// Please keep this alphabetized
|
// Please keep this alphabetized
|
||||||
"cs": "componentstatus",
|
"cs": "componentstatuses",
|
||||||
"ev": "events",
|
"ev": "events",
|
||||||
"limits": "limitRanges",
|
"limits": "limitRanges",
|
||||||
"mi": "minions",
|
"mi": "minions",
|
||||||
|
@ -102,9 +102,9 @@ func (rs *REST) getComponentStatus(name string, server apiserver.Server) *api.Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
retVal := &api.ComponentStatus{
|
retVal := &api.ComponentStatus{
|
||||||
Name: name,
|
|
||||||
Conditions: []api.ComponentCondition{*c},
|
Conditions: []api.ComponentCondition{*c},
|
||||||
}
|
}
|
||||||
|
retVal.Name = name
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
}
|
}
|
||||||
|
@ -67,12 +67,13 @@ func NewTestREST(resp testResponse) *REST {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createTestStatus(name string, status api.ConditionStatus, msg string, err string) *api.ComponentStatus {
|
func createTestStatus(name string, status api.ConditionStatus, msg string, err string) *api.ComponentStatus {
|
||||||
return &api.ComponentStatus{
|
retVal := &api.ComponentStatus{
|
||||||
Name: name,
|
|
||||||
Conditions: []api.ComponentCondition{
|
Conditions: []api.ComponentCondition{
|
||||||
{Type: api.ComponentHealthy, Status: status, Message: msg, Error: err},
|
{Type: api.ComponentHealthy, Status: status, Message: msg, Error: err},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
retVal.Name = name
|
||||||
|
return retVal
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestList_NoError(t *testing.T) {
|
func TestList_NoError(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user