Method: Krane::RestartTask#run!
- Defined in:
- lib/krane/restart_task.rb
#run!(deployments: [], statefulsets: [], daemonsets: [], selector: nil, verify_result: true) ⇒ nil Also known as: perform!
Runs the task, raising exceptions in case of issues
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/krane/restart_task.rb', line 63 def run!(deployments: [], statefulsets: [], daemonsets: [], selector: nil, verify_result: true) start = Time.now.utc @logger.reset @logger.phase_heading("Initializing restart") verify_config! deployments, statefulsets, daemonsets = identify_target_workloads(deployments, statefulsets, daemonsets, selector: selector) @logger.phase_heading("Triggering restart") restart_deployments!(deployments) restart_statefulsets!(statefulsets) restart_daemonsets!(daemonsets) if verify_result @logger.phase_heading("Waiting for rollout") resources = build_watchables(deployments, start, Deployment) resources += build_watchables(statefulsets, start, StatefulSet) resources += build_watchables(daemonsets, start, DaemonSet) verify_restart(resources) else warning = "Result verification is disabled for this task" @logger.summary.add_paragraph(ColorizedString.new(warning).yellow) end StatsD.client.distribution('restart.duration', StatsD.duration(start), tags: ('success', deployments, statefulsets, daemonsets)) @logger.print_summary(:success) rescue DeploymentTimeoutError StatsD.client.distribution('restart.duration', StatsD.duration(start), tags: ('timeout', deployments, statefulsets, daemonsets)) @logger.print_summary(:timed_out) raise rescue FatalDeploymentError => error StatsD.client.distribution('restart.duration', StatsD.duration(start), tags: ('failure', deployments, statefulsets, daemonsets)) @logger.summary.add_action(error.) if error. != error.class.to_s @logger.print_summary(:failure) raise end |