lib/kubernetes-deploy/kubernetes_resource/pod.rb in kubernetes-deploy-0.26.4 vs lib/kubernetes-deploy/kubernetes_resource/pod.rb in kubernetes-deploy-0.26.5
- old
+ new
@@ -63,14 +63,19 @@
def deploy_failed?
failure_message.present?
end
def timeout_message
- return STANDARD_TIMEOUT_MESSAGE unless readiness_probe_failure?
- probe_failure_msgs = @containers.map(&:readiness_fail_reason).compact
- header = "The following containers have not passed their readiness probes on at least one pod:\n"
- header + probe_failure_msgs.join("\n")
+ if readiness_probe_failure?
+ probe_failure_msgs = @containers.map(&:readiness_fail_reason).compact
+ header = "The following containers have not passed their readiness probes on at least one pod:\n"
+ header + probe_failure_msgs.join("\n")
+ elsif failed_schedule_reason.present?
+ "Pod could not be scheduled because #{failed_schedule_reason}"
+ else
+ STANDARD_TIMEOUT_MESSAGE
+ end
end
def failure_message
doomed_containers = @containers.select(&:doomed?)
if doomed_containers.present?
@@ -95,9 +100,19 @@
def print_debug_logs?
exists? && !@stream_logs # don't print them a second time
end
private
+
+ def failed_schedule_reason
+ if phase == "Pending"
+ conditions = @instance_data.dig('status', 'conditions') || []
+ unschedulable = conditions.find do |condition|
+ condition["type"] == "PodScheduled" && condition["status"] == "False"
+ end
+ unschedulable&.dig('message')
+ end
+ end
def failed_phase?
phase == FAILED_PHASE_NAME
end