Skip to content

Commit

Permalink
pod: Fix eventf (#819)
Browse files Browse the repository at this point in the history
Signed-off-by: Ce Gao <[email protected]>
  • Loading branch information
gaocegege authored and k8s-ci-robot committed Sep 3, 2018
1 parent 454c5c1 commit ed91105
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/controller.v2/tensorflow/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const (
// podTemplateRestartPolicyReason is the warning reason when the restart
// policy is setted in pod template.
podTemplateRestartPolicyReason = "SettedPodTemplateRestartPolicy"
// exitedWithCodeReason is the normal reason when the pod is exited because of the exit code.
exitedWithCodeReason = "ExitedWithCode"
)

// reconcilePods checks and updates pods for each given TFReplicaSpec.
Expand Down Expand Up @@ -82,7 +84,7 @@ func (tc *TFController) reconcilePods(
if status.Name == tfv1alpha2.DefaultContainerName && state.Terminated != nil {
exitCode = state.Terminated.ExitCode
logger.Infof("Pod: %v.%v exited with code %v", pod.Namespace, pod.Name, exitCode)
tc.Recorder.Eventf(tfjob, v1.EventTypeNormal, "Pod: %v.%v exited with code %v", pod.Namespace, pod.Name, exitCode)
tc.Recorder.Eventf(tfjob, v1.EventTypeNormal, exitedWithCodeReason, "Pod: %v.%v exited with code %v", pod.Namespace, pod.Name, exitCode)
}
}
// Check if the pod is retryable.
Expand Down

0 comments on commit ed91105

Please sign in to comment.