From ed91105e7aa2e6f00c10c70ec99d369cc0254076 Mon Sep 17 00:00:00 2001 From: Ce Gao Date: Mon, 3 Sep 2018 10:58:35 +0800 Subject: [PATCH] pod: Fix eventf (#819) Signed-off-by: Ce Gao --- pkg/controller.v2/tensorflow/pod.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/controller.v2/tensorflow/pod.go b/pkg/controller.v2/tensorflow/pod.go index 4f422a9930..a7191872ad 100644 --- a/pkg/controller.v2/tensorflow/pod.go +++ b/pkg/controller.v2/tensorflow/pod.go @@ -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. @@ -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.