api: rename conditionkind -> conditiontype

This commit is contained in:
Mike Danese
2015-02-23 21:21:14 -08:00
parent 754a2a8305
commit 5267127af1
17 changed files with 324 additions and 72 deletions

View File

@@ -304,21 +304,21 @@ func (s *NodeController) checkNodeReady(node *api.Node) *api.NodeCondition {
case err != nil:
glog.V(2).Infof("NodeController: node %s health check error: %v", node.Name, err)
return &api.NodeCondition{
Kind: api.NodeReady,
Type: api.NodeReady,
Status: api.ConditionUnknown,
Reason: fmt.Sprintf("Node health check error: %v", err),
LastProbeTime: util.Now(),
}
case status == probe.Failure:
return &api.NodeCondition{
Kind: api.NodeReady,
Type: api.NodeReady,
Status: api.ConditionNone,
Reason: fmt.Sprintf("Node health check failed: kubelet /healthz endpoint returns not ok"),
LastProbeTime: util.Now(),
}
default:
return &api.NodeCondition{
Kind: api.NodeReady,
Type: api.NodeReady,
Status: api.ConditionFull,
Reason: fmt.Sprintf("Node health check succeeded: kubelet /healthz endpoint returns ok"),
LastProbeTime: util.Now(),
@@ -405,10 +405,10 @@ func (s *NodeController) canonicalizeName(nodes *api.NodeList) *api.NodeList {
}
// getCondition returns a condition object for the specific condition
// kind, nil if the condition is not set.
func (s *NodeController) getCondition(node *api.Node, kind api.NodeConditionKind) *api.NodeCondition {
// type, nil if the condition is not set.
func (s *NodeController) getCondition(node *api.Node, conditionType api.NodeConditionType) *api.NodeCondition {
for i := range node.Status.Conditions {
if node.Status.Conditions[i].Kind == kind {
if node.Status.Conditions[i].Type == conditionType {
return &node.Status.Conditions[i]
}
}

View File

@@ -533,7 +533,7 @@ func TestHealthCheckNode(t *testing.T) {
},
expectedConditions: []api.NodeCondition{
{
Kind: api.NodeReady,
Type: api.NodeReady,
Status: api.ConditionFull,
Reason: "Node health check succeeded: kubelet /healthz endpoint returns ok",
},
@@ -547,7 +547,7 @@ func TestHealthCheckNode(t *testing.T) {
},
expectedConditions: []api.NodeCondition{
{
Kind: api.NodeReady,
Type: api.NodeReady,
Status: api.ConditionNone,
Reason: "Node health check failed: kubelet /healthz endpoint returns not ok",
},
@@ -561,7 +561,7 @@ func TestHealthCheckNode(t *testing.T) {
},
expectedConditions: []api.NodeCondition{
{
Kind: api.NodeReady,
Type: api.NodeReady,
Status: api.ConditionUnknown,
Reason: "Node health check error: Error",
},
@@ -638,7 +638,7 @@ func TestSyncNodeStatusTransitionTime(t *testing.T) {
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
{
Kind: api.NodeReady,
Type: api.NodeReady,
Status: api.ConditionFull,
Reason: "Node health check succeeded: kubelet /healthz endpoint returns ok",
LastTransitionTime: util.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
@@ -664,7 +664,7 @@ func TestSyncNodeStatusTransitionTime(t *testing.T) {
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
{
Kind: api.NodeReady,
Type: api.NodeReady,
Status: api.ConditionFull,
Reason: "Node health check succeeded: kubelet /healthz endpoint returns ok",
LastTransitionTime: util.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
@@ -725,7 +725,7 @@ func TestSyncNodeStatusDeletePods(t *testing.T) {
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
{
Kind: api.NodeReady,
Type: api.NodeReady,
Status: api.ConditionFull,
Reason: "Node health check succeeded: kubelet /healthz endpoint returns ok",
LastTransitionTime: util.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
@@ -755,7 +755,7 @@ func TestSyncNodeStatusDeletePods(t *testing.T) {
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
{
Kind: api.NodeReady,
Type: api.NodeReady,
Status: api.ConditionFull,
Reason: "Node health check succeeded: kubelet /healthz endpoint returns ok",
LastTransitionTime: util.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
@@ -784,7 +784,7 @@ func TestSyncNodeStatusDeletePods(t *testing.T) {
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
{
Kind: api.NodeReady,
Type: api.NodeReady,
Status: api.ConditionNone,
Reason: "Node health check failed: kubelet /healthz endpoint returns not ok",
// Here, last transition time is Now(). In node controller, the new condition's probe time is
@@ -816,7 +816,7 @@ func TestSyncNodeStatusDeletePods(t *testing.T) {
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
{
Kind: api.NodeReady,
Type: api.NodeReady,
Status: api.ConditionNone,
Reason: "Node health check failed: kubelet /healthz endpoint returns not ok",
// Here, last transition time is in the past, and in node controller, the
@@ -881,7 +881,7 @@ func TestSyncNodeStatus(t *testing.T) {
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
{
Kind: api.NodeReady,
Type: api.NodeReady,
Status: api.ConditionFull,
Reason: "Node health check succeeded: kubelet /healthz endpoint returns ok",
},
@@ -894,7 +894,7 @@ func TestSyncNodeStatus(t *testing.T) {
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
{
Kind: api.NodeReady,
Type: api.NodeReady,
Status: api.ConditionFull,
Reason: "Node health check succeeded: kubelet /healthz endpoint returns ok",
},