kontena-plugin-cloud 1.2.0.pre6 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89e97e4f6267b0eaeae57d961bfac69f61729967cd24ffd5d939ff7bffd73c3d
4
- data.tar.gz: bfea6af70350f035a0d5c431356e3a191b2a403d2631f28f267a3317dfcec323
3
+ metadata.gz: d34fa1f2bf0a29d7d5d9b689a7851414a90a0f4415471f7e574ad14e3fd3410c
4
+ data.tar.gz: 12490e5162d8903fe6d9379657bb72f8910cd77536489e5993d56ba48b3a8c88
5
5
  SHA512:
6
- metadata.gz: 489dd9e5825b970c34a36f8811dd210b8543e398957e97d75294ad7c814bec0bcd94dd8548756b720b7032eaa2515b08cd2fdbd53ea938d6db27d01765874fb4
7
- data.tar.gz: 7ba8360392b6c6266a5f16ff71834cc064a7dec941add3b6d4f1c4af55dcb66102241afe9845e0ee948b86a985cf6971e4aaf7a8aee7fe358244f4a452fa6051
6
+ metadata.gz: 262c61777fcb3a7e67f6567d2ab404648824d8ce0c359af8715df709c1e3cadcb993c36c917e98e874784e4c9ddbc80b4979238236d966c2ddace65fae643771
7
+ data.tar.gz: 3ed89bfcdff0ed24fe5f68ca03f17f4dfc116a9b8690045ddf71ec77bd4dce7691ecb40e0fdd6b537808e9d7d62101c2cac335babd50b931bb4555a6b9bbaa40
@@ -1,7 +1,7 @@
1
1
  module Kontena
2
2
  module Plugin
3
3
  module Cloud
4
- VERSION = "1.2.0.pre6"
4
+ VERSION = "1.2.0"
5
5
 
6
6
  module Organization
7
7
  module User; end
@@ -59,7 +59,7 @@ class Kontena::Plugin::Cloud::Node::CreateCommand < Kontena::Command
59
59
  grid: token,
60
60
  node: node_token
61
61
  },
62
- 'ssh-keys': ssh_keys
62
+ 'ssh-keys' => ssh_keys
63
63
  },
64
64
  relationships: {
65
65
  platform: {
@@ -6,6 +6,7 @@ class Kontena::Plugin::Cloud::Platform::WizardCommand < Kontena::Command
6
6
  requires_current_account_token
7
7
 
8
8
  INFRASTRUCTURE = {
9
+ 'cloud' => 'Kontena Cloud',
9
10
  'aws' => 'Amazon Web Services (EC2)',
10
11
  'digitalocean' => 'DigitalOcean',
11
12
  'vagrant' => 'Vagrant (with VirtualBox)'
@@ -13,6 +14,7 @@ class Kontena::Plugin::Cloud::Platform::WizardCommand < Kontena::Command
13
14
 
14
15
  parameter "[NAME]", "Platform name"
15
16
  option ['--organization', '--org'], 'ORG', 'Organization name', environment_variable: 'KONTENA_ORGANIZATION'
17
+ option '--type', 'TYPE', 'Platform type (mini, standard)'
16
18
  option ['--region'], 'region', 'Region (us-east-1, eu-west-1)'
17
19
  option ['--initial-size', '-i'], 'SIZE', 'Initial size (number of nodes) for platform'
18
20
  option '--version', 'VERSION', 'Platform version', visible: false
@@ -22,12 +24,18 @@ class Kontena::Plugin::Cloud::Platform::WizardCommand < Kontena::Command
22
24
 
23
25
  self.name = prompt.ask("Name:") unless self.name
24
26
  self.organization = prompt_organization unless self.organization
25
- self.region = prompt_region unless self.region
26
- self.initial_size = prompt_initial_size unless self.initial_size
27
+ self.type = prompt_type unless self.type
28
+ self.region = prompt_region if self.region.nil? && self.type != 'mini'
29
+ unless self.initial_size
30
+ if self.type == 'mini'
31
+ self.initial_size = 1
32
+ else
33
+ self.initial_size = 3
34
+ end
35
+ end
27
36
 
28
- platform = nil
29
- spinner "Creating platform master #{pastel.cyan(name)} to region #{pastel.cyan(region)}" do
30
- platform = create_platform(name, organization, initial_size, region)
37
+ platform = spinner "Creating platform master #{pastel.cyan(self.name)} to region #{pastel.cyan(self.region)}" do
38
+ create_platform(self.name, self.organization, self.initial_size, self.region, self.type)
31
39
  end
32
40
  spinner "Waiting for platform master #{pastel.cyan(name)} to come online" do
33
41
  while !platform.online? do
@@ -44,6 +52,8 @@ class Kontena::Plugin::Cloud::Platform::WizardCommand < Kontena::Command
44
52
  end
45
53
 
46
54
  case infra
55
+ when 'cloud'
56
+ create_cloud
47
57
  when 'aws'
48
58
  create_aws
49
59
  when 'digitalocean'
@@ -67,6 +77,13 @@ class Kontena::Plugin::Cloud::Platform::WizardCommand < Kontena::Command
67
77
  end
68
78
  end
69
79
 
80
+ def prompt_type
81
+ prompt.select("Platform type:") do |menu|
82
+ menu.choice "standard (high-availability, business critical services)", "standard"
83
+ menu.choice "mini (non-business critical services)", "mini"
84
+ end
85
+ end
86
+
70
87
  def prompt_organization
71
88
  organizations = cloud_client.get('/organizations')['data']
72
89
  prompt.select("Choose organization:") do |menu|
@@ -85,17 +102,9 @@ class Kontena::Plugin::Cloud::Platform::WizardCommand < Kontena::Command
85
102
  end
86
103
  end
87
104
 
88
- def prompt_initial_size
89
- prompt.select("Initial platform size (number of nodes):") do |menu|
90
- menu.choice "1 (dev/test)", 1
91
- menu.choice "3 (tolerates 1 initial node failure)", 3
92
- menu.choice "5 (tolerates 2 initial node failures)", 5
93
- end
94
- end
95
-
96
- def create_platform(name, organization, initial_size, region)
105
+ def create_platform(name, organization, initial_size, region, type)
97
106
  data = {
98
- attributes: { "name" => name, "initial-size" => initial_size },
107
+ attributes: { "name" => name, "initial-size" => initial_size, "hosted-type" => type },
99
108
  relationships: {
100
109
  region: {
101
110
  "data" => { "type" => "region", "id" => region }
@@ -107,6 +116,12 @@ class Kontena::Plugin::Cloud::Platform::WizardCommand < Kontena::Command
107
116
  Kontena::Cli::Models::Platform.new(data)
108
117
  end
109
118
 
119
+ def create_cloud
120
+ Kontena.run!([
121
+ 'cloud', 'node', 'create', '--count', self.initial_size
122
+ ])
123
+ end
124
+
110
125
  def create_vagrant
111
126
  Kontena.run!([
112
127
  'vagrant', 'node', 'create', '--version', self.version, '--instances', self.initial_size
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kontena-plugin-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.pre6
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kontena, Inc.
@@ -141,9 +141,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
141
  version: '0'
142
142
  required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - ">"
144
+ - - ">="
145
145
  - !ruby/object:Gem::Version
146
- version: 1.3.1
146
+ version: '0'
147
147
  requirements: []
148
148
  rubyforge_project:
149
149
  rubygems_version: 2.7.2