Sha256: 7161eeacb4dbb1aac2c606f4be09614b076b8ec132f59f10189a63f741425d35

Contents?: true

Size: 1.4 KB

Versions: 7

Compression:

Stored size: 1.4 KB

Contents

#!/usr/bin/env ruby

# Usage: kubernetes-deploy <app's namespace> <kube context>

# Prerequisites:
#  - kubectl 1.5.1+ binary must be available in the shipit machine's path
#  - ENV['KUBECONFIG'] must point to a valid kubeconfig file that includes all the contexts you want to deploy to
#  - ENV['GOOGLE_APPLICATION_CREDENTIALS'] must point to the credentials for an authenticated service account if your user's auth provider is gcp

# Optionally, the following variables can be used to override script defaults:
#  - ENV['K8S_TEMPLATE_FOLDER']: Location of Kubernetes files to deploy. Default is config/deploy/#{environment}.

require 'kubernetes-deploy'

require 'optparse'

skip_wait = false
template_dir = nil
ARGV.options do |opts|
  opts.on("--skip-wait") { skip_wait = true }
  opts.on("--template-dir=DIR") { |v| template_dir = v }
  opts.parse!
end

if !template_dir && ENV.key?("ENVIRONMENT")
  template_dir = "config/deploy/#{ENV["ENVIRONMENT"]}"
end

if !template_dir || template_dir.empty?
  puts "Template directory is unknown. Either specify --template-dir argument or set $ENVIRONMENT to use config/deploy/$ENVIRONMENT as a default path."
  exit 1
end

KubernetesDeploy::Runner.with_friendly_errors do
  runner = KubernetesDeploy::Runner.new(
    namespace: ARGV[0],
    context: ARGV[1],
    current_sha: ENV['REVISION'],
    template_dir: template_dir,
    wait_for_completion: !skip_wait,
  )
  runner.run
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kubernetes-deploy-0.3.0 exe/kubernetes-deploy
kubernetes-deploy-0.2.3 exe/kubernetes-deploy
kubernetes-deploy-0.2.2 exe/kubernetes-deploy
kubernetes-deploy-0.2.1 exe/kubernetes-deploy
kubernetes-deploy-0.2.0 exe/kubernetes-deploy
kubernetes-deploy-0.1.4 exe/kubernetes-deploy
kubernetes-deploy-0.1.3 exe/kubernetes-deploy