Skip to content

Commit

Permalink
bug: get condition just get last, should get special type condition
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengjiajin committed Dec 11, 2018
1 parent 1abc120 commit 05af3fb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/controller.v2/tensorflow/status.go
Expand Up @@ -176,8 +176,10 @@ func newCondition(conditionType tfv1alpha2.TFJobConditionType, reason, message s

// getCondition returns the condition with the provided type.
func getCondition(status tfv1alpha2.TFJobStatus, condType tfv1alpha2.TFJobConditionType) *tfv1alpha2.TFJobCondition {
if len(status.Conditions) > 0 {
return &status.Conditions[len(status.Conditions)-1]
for _, condition := range status.Conditions {
if condition.Type == condType {
return &condition
}
}
return nil
}
Expand Down

0 comments on commit 05af3fb

Please sign in to comment.