Skip to content

Commit

Permalink
Fix non-rails worker startup on kubernetes
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Jul 29, 2024
1 parent 281736e commit bde5deb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/models/miq_server/worker_management/kubernetes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ def sync_starting_workers
worker_pod = current_pods[worker.system_uid]
next if worker_pod.nil?

container_status = worker_pod.status.containerStatuses.find { |container| container.name == worker.worker_deployment_name }
if worker_pod.status.phase == "Running" && container_status.ready && container_status.started
worker.update!(:status => "started")
end
worker.update!(:status => "started") if worker_pod[:running]
end
end

Expand Down Expand Up @@ -253,6 +250,7 @@ def save_pod(pod)
ch[:label_name] = pod.metadata.labels.name
ch[:last_state_terminated] = pod.status.containerStatuses.any? { |cs| cs.lastState.terminated }
ch[:container_restarts] = pod.status.containerStatuses.sum { |cs| cs.restartCount.to_i }
ch[:running] = pod.status.phase == "Running" && pod.status.containerStatuses.all? { |cs| cs.ready && cs.started }

name = pod.metadata.name
current_pods[name] ||= ch
Expand Down

0 comments on commit bde5deb

Please sign in to comment.