Skip to content

Commit

Permalink
Merge pull request #2998 from zendesk/grosser/logic
Browse files Browse the repository at this point in the history
reuse KUBE_WAIT_FOR_LIVE in KUBE_WAIT_FOR_PREREQ
  • Loading branch information
grosser authored Oct 12, 2018
2 parents 1d1b62d + 612974c commit 6ee893d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions plugins/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ Add a role with only a `Pod`, `metadata.annotations.samson/prerequisite: true`,
It will be executed before the rest is deployed.

For default it waits for 10 minutes before timeout, you can change the timeout
using KUBE_WAIT_FOR_PREREQ env variable (specified in seconds).
using KUBERNETES_WAIT_FOR_PREREQUISITES env variable (specified in seconds).

### Deployment timeouts

A deploy will wait for 10 minutes for pods to come alive. You can adjust this
timeout using KUBE_WAIT_FOR_LIVE.
timeout using KUBERNETES_WAIT_FOR_LIVE (specified in seconds).

### StatefulSet

Expand Down
9 changes: 6 additions & 3 deletions plugins/kubernetes/app/models/kubernetes/deploy_executor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@

module Kubernetes
class DeployExecutor
WAIT_FOR_LIVE = ENV.fetch('KUBE_WAIT_FOR_LIVE', 10).to_i.minutes
WAIT_FOR_PREREQ = ENV.fetch('KUBE_WAIT_FOR_PREREQ', 10).to_i.minutes
if ENV['KUBE_WAIT_FOR_LIVE'] && !ENV["KUBERNETES_WAIT_FOR_LIVE"]
raise "Use KUBERNETES_WAIT_FOR_LIVE with seconds instead of KUBE_WAIT_FOR_LIVE"
end
WAIT_FOR_LIVE = Integer(ENV.fetch('KUBERNETES_WAIT_FOR_LIVE', '600'))
WAIT_FOR_PREREQUISITES = Integer(ENV.fetch('KUBERNETES_WAIT_FOR_PREREQUISITES', WAIT_FOR_LIVE))
STABILITY_CHECK_DURATION = 1.minute
TICK = 2.seconds
RESTARTED = "Restarted"
Expand Down Expand Up @@ -60,7 +63,7 @@ def execute(*)
prerequisites, deploys = @release.release_docs.partition(&:prerequisite?)
if prerequisites.any?
@output.puts "First deploying prerequisite ..." if deploys.any?
return false unless deploy_and_watch(prerequisites, WAIT_FOR_PREREQ)
return false unless deploy_and_watch(prerequisites, WAIT_FOR_PREREQUISITES)
@output.puts "Now deploying other roles ..." if deploys.any?
end
if deploys.any?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require_relative "../../test_helper"

SingleCov.covered! uncovered: 8
SingleCov.covered! uncovered: 9

describe Kubernetes::DeployExecutor do
assert_requests
Expand Down

0 comments on commit 6ee893d

Please sign in to comment.