aws_pocketknife 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws_pocketknife/cli/ecs.rb +19 -2
- data/lib/aws_pocketknife/ecs.rb +12 -0
- data/lib/aws_pocketknife/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b6fcd86a98741577382ead18ee88fdc41750cda
|
4
|
+
data.tar.gz: 5633a25a5cdeebc527d478542b714d7f61019e08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72105915d90b42ff5a6ed01cc2b3ac9980e7f1d2f4eeeb768f38c24b98024a8ce39c9c488a362dc8b0d05848b28c2f1d516f7564500692bea30431d6d3c31041
|
7
|
+
data.tar.gz: fee7bcbe4ce8d79bdce80ebf69570536ef320c308bd914eda96b98e9479839613196be0a5599d1335df7fea1dbefa349e054c481333af83fac9c48212a871030
|
@@ -29,19 +29,36 @@ module AwsPocketknife
|
|
29
29
|
def list_services(cluster)
|
30
30
|
services = AwsPocketknife::Ecs.list_services cluster: cluster
|
31
31
|
headers = ["name", "status", "desired_count","running_count",
|
32
|
-
"pending_count", "task_definition", "maximum_percent", "minimum_healthy_percent"]
|
32
|
+
"pending_count", "task_definition", "maximum_percent", "minimum_healthy_percent", "cpu (units)", "mem (MiB)", "mem_reservation (MiB)"]
|
33
33
|
data = []
|
34
34
|
if services.nil?
|
35
35
|
puts "No service found"
|
36
36
|
else
|
37
|
+
mem_total = 0
|
38
|
+
mem_res_total = 0
|
39
|
+
cpu_total = 0
|
37
40
|
services.each do |service|
|
38
41
|
info = service[:info]
|
42
|
+
task_def = service[:task_definition]
|
39
43
|
data << [service[:name], info.status, info.desired_count,
|
40
44
|
info.running_count, info.pending_count, info.task_definition.split('/')[1],
|
41
|
-
info.deployment_configuration.maximum_percent, info.deployment_configuration.minimum_healthy_percent
|
45
|
+
info.deployment_configuration.maximum_percent, info.deployment_configuration.minimum_healthy_percent,
|
46
|
+
task_def.cpu, task_def.memory, task_def.memory_reservation
|
42
47
|
]
|
48
|
+
cpu_total = cpu_total + task_def.cpu
|
49
|
+
mem_total = mem_total + task_def.memory
|
50
|
+
mem_res_total = (mem_res_total + task_def.memory_reservation) unless task_def.memory_reservation.nil?
|
43
51
|
end
|
52
|
+
puts ""
|
53
|
+
puts "Memory is the hard limit (in MiB) of memory to present to the container. If your container attempts to exceed the memory specified here, the container is killed."
|
54
|
+
puts "Memory reservation is the soft limit (in MiB) of memory to reserve for the container. When system memory is under contention, Docker attempts to keep the container memory to this soft limit"
|
55
|
+
puts ""
|
44
56
|
AwsPocketknife::Ecs.pretty_table(headers: headers, data: data)
|
57
|
+
puts ""
|
58
|
+
puts "CPU TOTAL: #{cpu_total} Units"
|
59
|
+
puts "MEM TOTAL: #{mem_total} MiB"
|
60
|
+
puts "MEM RES TOTAL: #{mem_res_total} MiB"
|
61
|
+
puts ""
|
45
62
|
end
|
46
63
|
end
|
47
64
|
|
data/lib/aws_pocketknife/ecs.rb
CHANGED
@@ -87,6 +87,8 @@ module AwsPocketknife
|
|
87
87
|
return clusters_list
|
88
88
|
end
|
89
89
|
|
90
|
+
# services
|
91
|
+
|
90
92
|
def describe_services(name: '', cluster: '')
|
91
93
|
ecs_client.describe_services({cluster: cluster, services: [name]}).services.first
|
92
94
|
end
|
@@ -113,11 +115,21 @@ module AwsPocketknife
|
|
113
115
|
service_map[:name] = service.split('/')[1]
|
114
116
|
info = describe_services name: service, cluster: cluster
|
115
117
|
service_map[:info] = info
|
118
|
+
service_map[:task_definition] = describe_task_definition task_definition: info.task_definition
|
116
119
|
services_list << service_map
|
117
120
|
end
|
118
121
|
return services_list
|
119
122
|
end
|
120
123
|
|
124
|
+
# tasks-definitions
|
125
|
+
|
126
|
+
def describe_task_definition(task_definition: '')
|
127
|
+
resp = ecs_client.describe_task_definition({task_definition: task_definition})
|
128
|
+
return resp.task_definition.container_definitions.first
|
129
|
+
end
|
130
|
+
|
131
|
+
# helpers
|
132
|
+
|
121
133
|
def get_services(next_token: "", max_results: 100, cluster: '')
|
122
134
|
ecs_client.list_services({
|
123
135
|
max_results: max_results,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_pocketknife
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gustavo Soares Souza
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|