222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
|
# File 'lib/krane/kubernetes_resource/pod.rb', line 222
def doom_reason
limbo_reason = @status.dig("state", "waiting", "reason")
limbo_message = @status.dig("state", "waiting", "message")
if limbo_reason == "CrashLoopBackOff"
exit_code = @status.dig('lastState', 'terminated', 'exitCode')
"Crashing repeatedly (exit #{exit_code}). See logs for more information."
elsif limbo_reason == "ErrImagePull" && limbo_message.match(/not found/i)
"Failed to pull image #{@image}. "\
"Did you wait for it to be built and pushed to the registry before deploying?"
elsif limbo_reason == "CreateContainerConfigError" && !limbo_message.match("failed to sync (.*?) cache")
"Failed to generate container configuration: #{limbo_message}"
elsif @status.dig("lastState", "terminated", "reason") == "ContainerCannotRun"
exit_code = @status.dig('lastState', 'terminated', 'exitCode')
return if exit_code == 128
"Failed to start (exit #{exit_code}): #{@status.dig('lastState', 'terminated', 'message')}"
elsif @status.dig("state", "terminated", "reason") == "ContainerCannotRun"
exit_code = @status.dig('state', 'terminated', 'exitCode')
return if exit_code == 128
"Failed to start (exit #{exit_code}): #{@status.dig('state', 'terminated', 'message')}"
end
end
|