kontena-plugin-upcloud 0.1.0 → 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
- NTQzNDU0M2NmMjI0M2Q4M2FlYTExOTdmYTNhNTJkYjAxNjYxY2VmYg==
4
+ NmE3N2JkNzNjMWYwZDlhZjhjM2VmYmNiYjIzYjljNDUxMzY1Mjc0YQ==
5
5
  data.tar.gz: !binary |-
6
- MjNkZTNjY2FmNThmYWMyMTM0ZjgxZTA0MmMyNGM5MWYzNzk2ZDQzMA==
6
+ YmEwNTgzZjBiYzE0OTkxMWFjNjJjMzJhYWI5YzhlNjJmMTg3NjBkZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzZjY2U2OTFiM2I3MmFkZmM2MzI2MTI5N2QyOWNjNjE2ZDY4N2I0NjA0MTQ4
10
- YTE1MmY4ZjViYmQ1OTZiNjBkZjQ0ZjkxYzViNmYyMTJiNDNiZmRlYzc1MmE1
11
- ZGVmYzIwMTVhNThlOGI4NTU1ZjNjOGYwZTc5M2E2YTY3MGVkMzY=
9
+ MTQ4MjNlNjM2Nzc2MzM4N2U4NzgyNTg0ZDgyYjYyZWVlODEzZTlmZjk4ZGU3
10
+ ZWVjMmNjYjNjZjk0Y2ZjYzRkYmJjN2NjZDkzMzA0ODM1NzczMzEwZWI2MjY0
11
+ NjQ1OWY0MTZhMjRmZGViM2ZmMGUyZDFmYzdhODg4ZmY4NDIxZDI=
12
12
  data.tar.gz: !binary |-
13
- NzEyYzEyMjAyNzVmMzc4ZWY2YzdlNTM0YTc3YzgzM2MzNmI5M2RmMDVmNmY5
14
- M2FlNmRhMmVmMmQzOTZmYjdlN2U0NGYxMjk3NGNmMzI0MTBjMmQwNjQzOWQy
15
- ZWU3MWMxNTk3YzUwMDE3ZTIxN2U1MGRmNDcyYTVmYjk5M2UxZTk=
13
+ ZTk1YWQzNDc4YjIxNzEyNjY0MjZmN2Q3Y2YyMDBiY2IyZDE0OWYzYjNlNjBi
14
+ Y2ZjNTc5MWM3N2I3YmMzOGUwYzkzZjUzOGVhYTNhMjc2ZjhiNjIzNjM2ZmFl
15
+ OTUxODE0MWRiNGRmOTgwNDQ4OWRjMGI0ZDYzNTM5ODg3ZGVhZDA=
@@ -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_development_dependency "bundler", "~> 1.11"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
  end
@@ -89,8 +89,11 @@ coreos:
89
89
  --link kontena-server-mongo:mongodb \
90
90
  -e MONGODB_URI=mongodb://mongodb:27017/kontena_server \
91
91
  <% end -%>
92
- <% if auth_server %>
93
- -e AUTH_API_URL=<%= auth_server %> \
92
+ <% if server_name %>
93
+ -e KONTENA_SERVER_NAME=<%= server_name %> \
94
+ <% end -%>
95
+ <% if initial_admin_code %>
96
+ -e KONTENA_INITIAL_ADMIN_CODE=<%= initial_admin_code %> \
94
97
  <% end -%>
95
98
  -e VAULT_KEY=${KONTENA_VAULT_KEY} -e VAULT_IV=${KONTENA_VAULT_IV} \
96
99
  kontena/server:${KONTENA_VERSION}
@@ -10,6 +10,7 @@ module Kontena
10
10
  include RandomName
11
11
  include Machine::CertHelper
12
12
  include UpcloudCommon
13
+ include Kontena::Cli::ShellSpinner
13
14
 
14
15
  attr_reader :http_client, :username, :password
15
16
 
@@ -30,7 +31,7 @@ module Kontena
30
31
  abort('Invalid ssl cert') unless File.exists?(File.expand_path(opts[:ssl_cert]))
31
32
  ssl_cert = File.read(File.expand_path(opts[:ssl_cert]))
32
33
  else
33
- ShellSpinner "Generating self-signed SSL certificate" do
34
+ spinner "* Generating self-signed SSL certificate" do
34
35
  ssl_cert = generate_self_signed_cert
35
36
  end
36
37
  end
@@ -43,14 +44,10 @@ module Kontena
43
44
 
44
45
  hostname = generate_name
45
46
 
46
- userdata_vars = {
47
+ userdata_vars = opts.merge(
47
48
  ssl_cert: ssl_cert,
48
- auth_server: opts[:auth_server],
49
- version: opts[:version],
50
- vault_secret: opts[:vault_secret],
51
- vault_iv: opts[:vault_iv],
52
- mongodb_uri: opts[:mongodb_uri]
53
- }
49
+ server_name: hostname.sub('kontena-master-', '')
50
+ )
54
51
 
55
52
  device_data = {
56
53
  server: {
@@ -83,7 +80,7 @@ module Kontena
83
80
  }
84
81
  }.to_json
85
82
 
86
- ShellSpinner "Creating Upcloud master #{hostname.colorize(:cyan)} " do
83
+ spinner "* Creating Upcloud master #{hostname.colorize(:cyan)} " do
87
84
  response = post('server', body: device_data)
88
85
  if response.has_key?(:error)
89
86
  abort("\nUpcloud server creation failed (#{response[:error].fetch(:error_message, '')})")
@@ -106,12 +103,19 @@ module Kontena
106
103
  Excon.defaults[:ssl_verify_peer] = false
107
104
  @http_client = Excon.new("#{master_url}", :connect_timeout => 10)
108
105
 
109
- ShellSpinner "Waiting for #{hostname.colorize(:cyan)} to start" do
106
+ spinner "* Waiting for #{hostname.colorize(:cyan)} to start" do
110
107
  sleep 5 until master_running?
111
108
  end
112
109
 
113
- puts "Kontena Master is now running at #{master_url}"
114
- puts "Use #{"kontena login --name=#{hostname.sub('kontena-master-', '')} #{master_url}".colorize(:light_black)} to complete Kontena Master setup"
110
+ puts
111
+ puts "Kontena Master is now running at #{master_url}".colorize(:green)
112
+ puts
113
+
114
+ {
115
+ name: hostname.sub('kontena-master-', ''),
116
+ public_ip: device_public_ip[:address],
117
+ code: opts[:initial_admin_code]
118
+ }
115
119
  end
116
120
 
117
121
  def user_data(vars)
@@ -1,11 +1,10 @@
1
- require 'shell-spinner'
2
-
3
1
  module Kontena
4
2
  module Machine
5
3
  module Upcloud
6
4
  class NodeDestroyer
7
5
  include RandomName
8
6
  include UpcloudCommon
7
+ include Kontena::Cli::ShellSpinner
9
8
 
10
9
  attr_reader :api_client, :username, :password
11
10
 
@@ -39,7 +38,7 @@ module Kontena
39
38
 
40
39
  if server
41
40
  unless server[:state].eql?('stopped')
42
- ShellSpinner "Shutting down Upcloud node #{name.colorize(:cyan)} " do
41
+ spinner "Shutting down Upcloud node #{name.colorize(:cyan)} " do
43
42
  device_data = post(
44
43
  "server/#{server[:uuid]}/stop", body: {
45
44
  stop_server: {
@@ -1,7 +1,6 @@
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
@@ -9,6 +8,7 @@ module Kontena
9
8
  class NodeProvisioner
10
9
  include RandomName
11
10
  include UpcloudCommon
11
+ include Kontena::Cli::ShellSpinner
12
12
 
13
13
  attr_reader :api_client, :username, :password
14
14
 
@@ -73,7 +73,7 @@ module Kontena
73
73
  }
74
74
  }.to_json
75
75
 
76
- ShellSpinner "Creating Upcloud node #{hostname.colorize(:cyan)} " do
76
+ spinner "Creating Upcloud node #{hostname.colorize(:cyan)} " do
77
77
  response = post('server', body: device_data)
78
78
 
79
79
  if response.has_key?(:error)
@@ -88,7 +88,7 @@ module Kontena
88
88
  end
89
89
 
90
90
  node = nil
91
- ShellSpinner "Waiting for node #{hostname.colorize(:cyan)} join to grid #{opts[:grid].colorize(:cyan)} " do
91
+ spinner "Waiting for node #{hostname.colorize(:cyan)} join to grid #{opts[:grid].colorize(:cyan)} " do
92
92
  sleep 2 until node = node_exists_in_grid?(opts[:grid], hostname)
93
93
  end
94
94
  set_labels(node, ["region=#{opts[:zone]}", "provider=upcloud"])
@@ -1,11 +1,10 @@
1
- require 'shell-spinner'
2
-
3
1
  module Kontena
4
2
  module Machine
5
3
  module Upcloud
6
4
  class NodeRestarter
7
5
  include RandomName
8
6
  include UpcloudCommon
7
+ include Kontena::Cli::ShellSpinner
9
8
 
10
9
  attr_reader :username, :password
11
10
 
@@ -27,7 +26,7 @@ module Kontena
27
26
  server = servers[:servers][:server].find{|s| s[:hostname] == name}
28
27
 
29
28
  if server
30
- ShellSpinner "Restarting Upcloud node #{name.colorize(:cyan)} " do
29
+ spinner "Restarting Upcloud node #{name.colorize(:cyan)} " do
31
30
  result = post(
32
31
  "server/#{server[:uuid]}/restart", body: {
33
32
  restart_server: {
@@ -3,7 +3,7 @@ require 'securerandom'
3
3
  module Kontena::Plugin::Upcloud::Master
4
4
  class CreateCommand < Clamp::Command
5
5
  include Kontena::Cli::Common
6
-
6
+
7
7
  option "--username", "USER", "Upcloud username", required: true
8
8
  option "--password", "PASS", "Upcloud password", required: true
9
9
  option "--ssh-key", "SSH_KEY", "Path to ssh public key", required: true
@@ -14,8 +14,6 @@ module Kontena::Plugin::Upcloud::Master
14
14
  option "--vault-iv", "VAULT_IV", "Initialization vector for Vault (optional)"
15
15
  option "--mongodb-uri", "URI", "External MongoDB uri (optional)"
16
16
  option "--version", "VERSION", "Define installed Kontena version", default: 'latest'
17
- option "--auth-provider-url", "AUTH_PROVIDER_URL", "Define authentication provider url"
18
-
19
17
 
20
18
  def execute
21
19
 
@@ -28,9 +26,9 @@ module Kontena::Plugin::Upcloud::Master
28
26
  plan: plan,
29
27
  zone: zone,
30
28
  version: version,
31
- auth_server: auth_provider_url,
32
29
  vault_secret: vault_secret || SecureRandom.hex(24),
33
30
  vault_iv: vault_iv || SecureRandom.hex(24),
31
+ initial_admin_code: SecureRandom.hex(16),
34
32
  mongodb_uri: mongodb_uri
35
33
  )
36
34
  end
@@ -1,7 +1,7 @@
1
1
  module Kontena
2
2
  module Plugin
3
3
  module Upcloud
4
- VERSION = "0.1.0"
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-upcloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
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-08-10 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: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -98,9 +98,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - ! '>'
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 1.3.1
104
104
  requirements: []
105
105
  rubyforge_project:
106
106
  rubygems_version: 2.4.5