kontena-plugin-azure 0.1.1 → 0.2.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTliNTI1YzY3OGRmM2E4NTA5YmI2ZjFjZGZkNjY5YmQ5MGY5ZDIwNA==
4
+ MWFjMDEyZmFhMzgzZGJhNDc0OWFlMjcyMzNlNGRmY2Q1ZmFhNGFlYw==
5
5
  data.tar.gz: !binary |-
6
- ZTI2Y2U1YTBmOWYyOGI5NGZkODQ4MWJiZGVlYTc2MzEwZWNjZGQ4Mg==
6
+ MDRkOTk0YzNmYzg0ZTRhNDVlMDQwNTkzYzlkZGVmMDBlZGUwNzM1NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDg0OTA3OGVlZTNlODE1YjczMmRhMDg4OTZjMTk5MjUxMGM4M2E2ODc5NTc4
10
- NDNiNTZlOWQyZDRmZWI3OTc1YzI2NmIyMGEwZTk0NTMwOWY2YTQ0ZjYxNWRi
11
- NGE4YmNkZGZiMTc4ODAyOGY1ZjU2YzMyMmM5YjA3M2RmMDRlZWU=
9
+ MjgwMTJlZjliMzkxZjVmODdhYmEwYTgzZjRiZDlmNGRlYzJlNWQ3OTlhODY3
10
+ OTc2ZjIyMWI0YTg1YTUzY2E3ZmQzM2Y0NDcyOWMyNDllMDhiMDQ3YTdjMDZh
11
+ NzgyNGRhZmYwYThhNmI1ZWM5YjgxN2ZjZDlmZDg1YWU1MGVlZmY=
12
12
  data.tar.gz: !binary |-
13
- OWQ4YmE5MTg2ZjNlYWZjNDg1NDA3NThiMDhhZjA1YTRmZjY5NWU2OGE5MGVk
14
- OTM2ZGNmMmUzYzZmNDE4OTBhNWIwNGZhZjcyMDI3N2FhYWFkMTA2OTliNDc2
15
- MGE3YWQ2YjAyMTUwNmZmNGJmODM1OTA5YTM4NDA2ZDE2OTFmZDk=
13
+ NjY0NTkyMGQwYTVkMWRlMjBlNDFhZjgzYjYyNzMxYzVlZTc5ZTRlZjkzMDEx
14
+ OTUwNDQ3MDJhYjU5NDY4N2U5NDhiMTE0NjM1ZGY5NmIzZjc0YmJlZDAwMWNl
15
+ ZTgzNDEzZTEzYjYyMGE5MzQ0YmFjMTE5NTI2ZGFkZmFjY2IwMGU=
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_runtime_dependency 'kontena-cli', '>= 0.15.0.rc1'
20
+ spec.add_runtime_dependency 'kontena-cli', '>= 0.16.0.pre2'
21
21
  spec.add_runtime_dependency 'azure', '0.7.0'
22
22
  spec.add_development_dependency "bundler", "~> 1.11"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
@@ -81,7 +81,8 @@ coreos:
81
81
  --link kontena-server-mongo:mongodb \
82
82
  -e MONGODB_URI=mongodb://mongodb:27017/kontena_server \
83
83
  -e VAULT_KEY=${KONTENA_VAULT_KEY} -e VAULT_IV=${KONTENA_VAULT_IV} \
84
- <% if auth_server %>-e AUTH_API_URL=<%= auth_server %><% end %> \
84
+ <% if server_name %>-e KONTENA_SERVER_NAME=<%= server_name %><% end %> \
85
+ <% if initial_admin_code %>-e KONTENA_INITIAL_ADMIN_CODE=<%= intial_admin_code %><% end %> \
85
86
  kontena/server:${KONTENA_VERSION}
86
87
 
87
88
  - name: kontena-server-haproxy.service
@@ -1,13 +1,13 @@
1
1
  require 'fileutils'
2
2
  require 'erb'
3
3
  require 'open3'
4
- require 'shell-spinner'
5
4
 
6
5
  module Kontena
7
6
  module Machine
8
7
  module Azure
9
8
  class MasterProvisioner
10
9
  include Kontena::Machine::RandomName
10
+ include Kontena::Cli::ShellSpinner
11
11
 
12
12
  attr_reader :client, :http_client
13
13
 
@@ -32,7 +32,7 @@ module Kontena
32
32
  cloud_service_name = generate_cloud_service_name
33
33
  vm_name = cloud_service_name
34
34
  master_url = ''
35
- ShellSpinner "Creating Azure Virtual Machine #{vm_name.colorize(:cyan)}" do
35
+ spinner "Creating Azure Virtual Machine #{vm_name.colorize(:cyan)}" do
36
36
  if opts[:virtual_network].nil?
37
37
  location = opts[:location].downcase.gsub(' ', '-')
38
38
  default_network_name = "kontena-#{location}"
@@ -41,13 +41,10 @@ module Kontena
41
41
  opts[:subnet] = 'subnet-1'
42
42
  end
43
43
 
44
- userdata_vars = {
44
+ userdata_vars = opts.merge(
45
45
  ssl_cert: ssl_cert,
46
- auth_server: opts[:auth_server],
47
- version: opts[:version],
48
- vault_secret: opts[:vault_secret],
49
- vault_iv: opts[:vault_iv]
50
- }
46
+ server_name: opts[:name] || cloud_service_name.sub('kontena-master-', '')
47
+ )
51
48
 
52
49
  params = {
53
50
  vm_name: vm_name,
@@ -82,12 +79,19 @@ module Kontena
82
79
  Excon.defaults[:ssl_verify_peer] = false
83
80
  @http_client = Excon.new("#{master_url}", :connect_timeout => 10)
84
81
 
85
- ShellSpinner "Waiting for #{vm_name.colorize(:cyan)} to start" do
86
- sleep 5 until master_running?
82
+ spinner "Waiting for #{vm_name.colorize(:cyan)} to start" do
83
+ sleep 0.5 until master_running?
87
84
  end
88
85
 
89
- puts "Kontena Master is now running at #{master_url}"
90
- puts "Use #{"kontena login #{master_url}".colorize(:light_black)} to complete Kontena Master setup"
86
+ puts
87
+ puts "Kontena Master is now running at #{master_url}".colorize(:green)
88
+ puts
89
+
90
+ {
91
+ name: opts[:name] || cloud_service_name.sub('kontena-master-', ''),
92
+ public_ip: virtual_machine.ipaddress,
93
+ code: opts[:initial_admin_code]
94
+ }
91
95
  end
92
96
 
93
97
  def erb(template, vars)
@@ -1,4 +1,3 @@
1
- require 'shell-spinner'
2
1
  require 'azure/virtual_machine_image_management/virtual_machine_image_management_service'
3
2
 
4
3
  module Kontena
@@ -6,6 +5,8 @@ module Kontena
6
5
  module Azure
7
6
  class NodeDestroyer
8
7
 
8
+ include Kontena::Cli::ShellSpinner
9
+
9
10
  attr_reader :client, :api_client
10
11
 
11
12
  # @param [Kontena::Client] api_client Kontena api client
@@ -22,7 +23,7 @@ module Kontena
22
23
  end
23
24
 
24
25
  def run!(grid, name)
25
- ShellSpinner "Terminating Azure Virtual Machine #{name.colorize(:cyan)} " do
26
+ spinner "Terminating Azure Virtual Machine #{name.colorize(:cyan)} " do
26
27
  vm = client.vm_management.get_virtual_machine(name, cloud_service_name(name, grid['name']))
27
28
  if vm
28
29
  out = StringIO.new
@@ -38,7 +39,7 @@ module Kontena
38
39
 
39
40
  node = api_client.get("grids/#{grid['id']}/nodes")['nodes'].find{|n| n['name'] == name}
40
41
  if node
41
- ShellSpinner "Removing node #{name.colorize(:cyan)} from grid #{grid['name'].colorize(:cyan)} " do
42
+ spinner "Removing node #{name.colorize(:cyan)} from grid #{grid['name'].colorize(:cyan)} " do
42
43
  api_client.delete("grids/#{grid['id']}/nodes/#{name}")
43
44
  end
44
45
  end
@@ -2,13 +2,13 @@ require 'fileutils'
2
2
  require 'erb'
3
3
  require 'open3'
4
4
  require 'base64'
5
- require 'shell-spinner'
6
5
 
7
6
  module Kontena
8
7
  module Machine
9
8
  module Azure
10
9
  class NodeProvisioner
11
10
  include Kontena::Machine::RandomName
11
+ include Kontena::Cli::ShellSpinner
12
12
 
13
13
  attr_reader :client, :api_client
14
14
 
@@ -31,7 +31,7 @@ module Kontena
31
31
  vm_name = opts[:name] || generate_name
32
32
  cloud_service_name = generate_cloud_service_name(vm_name, opts[:grid])
33
33
 
34
- ShellSpinner "Creating Azure Virtual Machine #{vm_name.colorize(:cyan)}" do
34
+ spinner "Creating Azure Virtual Machine #{vm_name.colorize(:cyan)}" do
35
35
  if opts[:virtual_network].nil?
36
36
  location = opts[:location].downcase.gsub(' ', '-')
37
37
  default_network_name = "kontena-#{location}"
@@ -68,8 +68,8 @@ module Kontena
68
68
 
69
69
  client.vm_management.create_virtual_machine(params,options)
70
70
  end
71
- ShellSpinner "Waiting for node #{vm_name.colorize(:cyan)} join to grid #{opts[:grid].colorize(:cyan)} " do
72
- sleep 2 until node = vm_exists_in_grid?(opts[:grid], vm_name)
71
+ spinner "Waiting for node #{vm_name.colorize(:cyan)} join to grid #{opts[:grid].colorize(:cyan)} " do
72
+ sleep 0.5 until node = vm_exists_in_grid?(opts[:grid], vm_name)
73
73
  end
74
74
  if node
75
75
  labels = [
@@ -4,6 +4,7 @@ module Kontena::Plugin::Azure::Master
4
4
  class CreateCommand < Kontena::Command
5
5
  include Kontena::Cli::Common
6
6
 
7
+ option "--name", "[NAME]", "Set Master name"
7
8
  option "--subscription-id", "SUBSCRIPTION ID", "Azure subscription id", required: true
8
9
  option "--subscription-cert", "CERTIFICATE", "Path to Azure management certificate", attribute_name: :certificate, required: true
9
10
  option "--size", "SIZE", "SIZE", default: 'Small'
@@ -14,23 +15,23 @@ module Kontena::Plugin::Azure::Master
14
15
  option "--ssl-cert", "SSL CERT", "SSL certificate file"
15
16
  option "--vault-secret", "VAULT_SECRET", "Secret key for Vault"
16
17
  option "--vault-iv", "VAULT_IV", "Initialization vector for Vault"
17
- option "--auth-provider-url", "AUTH_PROVIDER_URL", "Define authentication provider url"
18
18
  option "--version", "VERSION", "Define installed Kontena version", default: 'latest'
19
19
 
20
20
  def execute
21
21
  require 'kontena/machine/azure'
22
22
  provisioner = provisioner(subscription_id, certificate)
23
23
  provisioner.run!(
24
+ name: name,
24
25
  ssh_key: ssh_key,
25
26
  ssl_cert: ssl_cert,
26
27
  size: size,
27
28
  virtual_network: network,
28
29
  subnet: subnet,
29
30
  location: location,
30
- auth_server: auth_provider_url,
31
31
  version: version,
32
32
  vault_secret: vault_secret || SecureRandom.hex(24),
33
- vault_iv: vault_iv || SecureRandom.hex(24)
33
+ vault_iv: vault_iv || SecureRandom.hex(24),
34
+ initial_admin_code: SecureRandom.hex(16)
34
35
  )
35
36
  end
36
37
 
@@ -38,7 +39,7 @@ module Kontena::Plugin::Azure::Master
38
39
  # @param [String] certificate
39
40
  # @return [Kontena::Machine::Azure::MasterProvisioner]
40
41
  def provisioner(subscription_id, certificate)
41
- Kontena::Machine::Azure::MasterProvisioner.new subscription_id, certificate
42
+ Kontena::Machine::Azure::MasterProvisioner.new
42
43
  end
43
44
  end
44
45
  end
@@ -40,7 +40,7 @@ module Kontena::Plugin::Azure::Nodes
40
40
  # @param [String] certificate
41
41
  # @return [Kontena::Machine::Azure::NodeProvisioner]
42
42
  def provisioner(client, subscription_id, certificate)
43
- Kontena::Machine::Azure::NodeProvisioner.new client, subscription_id, certificate
43
+ Kontena::Machine::Azure::NodeProvisioner.new
44
44
  end
45
45
 
46
46
  # @return [Hash]
@@ -2,6 +2,7 @@ module Kontena::Plugin::Azure::Nodes
2
2
  class RestartCommand < Kontena::Command
3
3
  include Kontena::Cli::Common
4
4
  include Kontena::Cli::GridOptions
5
+ include Kontena::Cli::ShellSpinner
5
6
 
6
7
  parameter "NAME", "Node name"
7
8
  option "--subscription-id", "SUBSCRIPTION ID", "Azure subscription id", required: true
@@ -18,7 +19,7 @@ module Kontena::Plugin::Azure::Nodes
18
19
  client.subscription_id = subscription_id
19
20
 
20
21
  client.vm_management.initialize_external_logger(Kontena::Machine::Azure::Logger.new) # We don't want all the output
21
- ShellSpinner "Restarting Azure VM #{name.colorize(:cyan)} " do
22
+ spinner "Restarting Azure VM #{name.colorize(:cyan)} " do
22
23
  vm = client.vm_management.get_virtual_machine(name, "kontena-#{current_grid}-#{name}")
23
24
  if vm
24
25
  client.vm_management.restart_virtual_machine(name, "kontena-#{current_grid}-#{name}")
@@ -1,7 +1,7 @@
1
1
  module Kontena
2
2
  module Plugin
3
3
  module Azure
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.0.pre1"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kontena-plugin-azure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kontena, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-07 00:00:00.000000000 Z
11
+ date: 2016-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kontena-cli
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.15.0.rc1
19
+ version: 0.16.0.pre2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.15.0.rc1
26
+ version: 0.16.0.pre2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: azure
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -112,9 +112,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ! '>='
115
+ - - ! '>'
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 1.3.1
118
118
  requirements: []
119
119
  rubyforge_project:
120
120
  rubygems_version: 2.4.5