capistrano-gcp-autoscaling 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +0 -1
- data/lib/capistrano/gcp/autoscaling.rb +0 -1
- data/lib/capistrano/gcp/autoscaling/core/instance.rb +10 -1
- data/lib/capistrano/gcp/autoscaling/core/instance_group_manager.rb +2 -3
- data/lib/capistrano/gcp/autoscaling/version.rb +1 -1
- data/lib/capistrano/gcp/tasks/autoscaling.rake +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b5c4394b5eb9f38b2fd71ce873b7abb55c0710cf98ccfa23aba145230e22bfd
|
4
|
+
data.tar.gz: 5f320b6e0d46b9cf6aa8c4427140fea14e95885207471004120acb0e6466bf08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c44a4eadbc38484136344fe4dc43e010105ad4a217736669a964cac482364ebe98f18adbcc24a8622c07a61146eba49d5c446f143124ec5cb2a565d8c1cdef12
|
7
|
+
data.tar.gz: '048cdfcd4192037e755697c81e215134c9a7bb42c04df1a6251617d3ea8b2f931497258eea62c549b0425fec05accc8273b256c2db6f2bc1a6431413af262cab'
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -33,7 +33,6 @@ Read the documentation (https://cloud.google.com/iam/docs/creating-managing-serv
|
|
33
33
|
```ruby
|
34
34
|
set :gcp_project_id, nil
|
35
35
|
set :gcp_region, nil
|
36
|
-
set :gcp_filter, '(status eq "RUNNING")'
|
37
36
|
set :gcp_scope, 'https://www.googleapis.com/auth/compute'
|
38
37
|
set :gcp_private_key, ENV['GCP_PRIVATE_KEY']
|
39
38
|
set :gcp_client_email, ENV['GCP_CLIENT_EMAIL']
|
@@ -8,6 +8,7 @@ module Capistrano
|
|
8
8
|
INSTANCE_PATTERN = %r{/instances/[\w-]+}.freeze
|
9
9
|
ZONE_PATTERN = %r{/zones/[\w-]+}.freeze
|
10
10
|
SEPARATOR = '/'.freeze
|
11
|
+
RUNNING_STATUS = 'RUNNING'.freeze
|
11
12
|
|
12
13
|
def initialize(compute_service, managed_instance, options = {})
|
13
14
|
@compute_service = compute_service
|
@@ -19,12 +20,20 @@ module Capistrano
|
|
19
20
|
instance.network_interfaces.first.network_ip
|
20
21
|
end
|
21
22
|
|
23
|
+
def created_at
|
24
|
+
Time.parse(instance.creation_timestamp)
|
25
|
+
end
|
26
|
+
|
27
|
+
def running?
|
28
|
+
instance.status == RUNNING_STATUS
|
29
|
+
end
|
30
|
+
|
22
31
|
private
|
23
32
|
|
24
33
|
attr_reader :compute_service, :managed_instance, :options
|
25
34
|
|
26
35
|
def instance
|
27
|
-
compute_service.get_instance(options.fetch(:gcp_project_id), instance_zone, instance_name)
|
36
|
+
@instance ||= compute_service.get_instance(options.fetch(:gcp_project_id), instance_zone, instance_name)
|
28
37
|
end
|
29
38
|
|
30
39
|
def instance_zone
|
@@ -11,7 +11,7 @@ module Capistrano
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def instances
|
14
|
-
group_manager.managed_instances.map(&method(:instance_for))
|
14
|
+
group_manager.managed_instances.map(&method(:instance_for)).select(&:running?).sort_by(&:created_at)
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
@@ -30,8 +30,7 @@ module Capistrano
|
|
30
30
|
compute_service.list_region_instance_group_manager_managed_instances(
|
31
31
|
options.fetch(:gcp_project_id),
|
32
32
|
options.fetch(:gcp_region),
|
33
|
-
options.fetch(:group_manager_name)
|
34
|
-
filter: options.fetch(:gcp_filter)
|
33
|
+
options.fetch(:group_manager_name)
|
35
34
|
)
|
36
35
|
end
|
37
36
|
end
|
@@ -4,7 +4,6 @@ namespace :load do
|
|
4
4
|
task :defaults do
|
5
5
|
set :gcp_project_id, nil
|
6
6
|
set :gcp_region, nil
|
7
|
-
set :gcp_filter, '(status eq "RUNNING")'
|
8
7
|
set :gcp_scope, 'https://www.googleapis.com/auth/compute'
|
9
8
|
set :gcp_private_key, ENV['GCP_PRIVATE_KEY']
|
10
9
|
set :gcp_client_email, ENV['GCP_CLIENT_EMAIL']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-gcp-autoscaling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksei Vorobyov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|