kontena-plugin-cloud 1.2.0.pre6 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d34fa1f2bf0a29d7d5d9b689a7851414a90a0f4415471f7e574ad14e3fd3410c
|
4
|
+
data.tar.gz: 12490e5162d8903fe6d9379657bb72f8910cd77536489e5993d56ba48b3a8c88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 262c61777fcb3a7e67f6567d2ab404648824d8ce0c359af8715df709c1e3cadcb993c36c917e98e874784e4c9ddbc80b4979238236d966c2ddace65fae643771
|
7
|
+
data.tar.gz: 3ed89bfcdff0ed24fe5f68ca03f17f4dfc116a9b8690045ddf71ec77bd4dce7691ecb40e0fdd6b537808e9d7d62101c2cac335babd50b931bb4555a6b9bbaa40
|
data/lib/kontena/plugin/cloud.rb
CHANGED
@@ -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.
|
26
|
-
self.
|
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 =
|
29
|
-
|
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
|
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
|
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:
|
146
|
+
version: '0'
|
147
147
|
requirements: []
|
148
148
|
rubyforge_project:
|
149
149
|
rubygems_version: 2.7.2
|