kontena-mortar 0.2.0 → 0.3.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +26 -5
- data/README.md +42 -2
- data/build/drone/ubuntu_xenial.sh +4 -2
- data/examples/config/config.yaml +6 -0
- data/examples/config/pod.yml.erb +16 -0
- data/examples/config/shot.yaml +6 -0
- data/examples/templates/variables/pod-vars.yml.erb +2 -2
- data/kontena-mortar.gemspec +2 -1
- data/lib/mortar.rb +5 -0
- data/lib/mortar/config.rb +34 -0
- data/lib/mortar/describe_command.rb +62 -0
- data/lib/mortar/fire_command.rb +36 -27
- data/lib/mortar/list_command.rb +37 -0
- data/lib/mortar/mixins/resource_helper.rb +20 -0
- data/lib/mortar/root_command.rb +4 -0
- data/lib/mortar/version.rb +1 -1
- data/opt/bash-completion.sh +13 -1
- metadata +26 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 073cb204d5c9614080090eb6ff92b97e07cf21309723c0bd7481d3c2de0dc1d7
|
4
|
+
data.tar.gz: 1879712cf8b82c82122c7f2fbab874fdb98fd49b9d1826fe0ba607a72e45a950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69bb7ba01aeaa3f56920206c25625298a5f228b276f381296d5b726dd8c6d5cd5a3b9fa5953ad8779deb4e1005e49019931a4a6ab0c3890976ed0165317e7da2
|
7
|
+
data.tar.gz: 785f6e6a9cf9e1d308c0db96f27be7cf724e4e9e3156328680693f080787e34390064fbb929bf62e08fb02b8d4bf78978338c5a54234588eb58aea6262143a49
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kontena-mortar (0.
|
4
|
+
kontena-mortar (0.3.0.rc1)
|
5
5
|
clamp (~> 1.3)
|
6
6
|
deep_merge (~> 1.2)
|
7
|
-
k8s-client (~> 0.
|
7
|
+
k8s-client (~> 0.5.0)
|
8
8
|
pastel (~> 0.7.2)
|
9
9
|
rouge (~> 3.2)
|
10
|
+
tty-table (~> 0.10.0)
|
10
11
|
|
11
12
|
GEM
|
12
13
|
remote: https://rubygems.org/
|
@@ -46,12 +47,18 @@ GEM
|
|
46
47
|
hashdiff (0.3.7)
|
47
48
|
ice_nine (0.11.2)
|
48
49
|
jaro_winkler (1.5.1)
|
49
|
-
|
50
|
+
jsonpath (0.9.6)
|
51
|
+
multi_json
|
52
|
+
to_regexp (~> 0.2.1)
|
53
|
+
k8s-client (0.5.0)
|
50
54
|
deep_merge (~> 1.2.1)
|
51
55
|
dry-struct (~> 0.5.0)
|
52
56
|
excon (~> 0.62.0)
|
53
57
|
hashdiff (~> 0.3.7)
|
58
|
+
jsonpath (~> 0.9.5)
|
54
59
|
recursive-open-struct (~> 1.1.0)
|
60
|
+
multi_json (1.13.1)
|
61
|
+
necromancer (0.4.0)
|
55
62
|
parallel (1.12.1)
|
56
63
|
parser (2.5.1.2)
|
57
64
|
ast (~> 2.4.0)
|
@@ -62,7 +69,7 @@ GEM
|
|
62
69
|
rainbow (3.0.0)
|
63
70
|
rake (10.5.0)
|
64
71
|
recursive-open-struct (1.1.0)
|
65
|
-
rouge (3.
|
72
|
+
rouge (3.3.0)
|
66
73
|
rspec (3.8.0)
|
67
74
|
rspec-core (~> 3.8.0)
|
68
75
|
rspec-expectations (~> 3.8.0)
|
@@ -85,8 +92,22 @@ GEM
|
|
85
92
|
ruby-progressbar (~> 1.7)
|
86
93
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
87
94
|
ruby-progressbar (1.10.0)
|
95
|
+
strings (0.1.4)
|
96
|
+
strings-ansi (~> 0.1.0)
|
97
|
+
unicode-display_width (~> 1.4.0)
|
98
|
+
unicode_utils (~> 1.4.0)
|
99
|
+
strings-ansi (0.1.0)
|
100
|
+
to_regexp (0.2.1)
|
88
101
|
tty-color (0.4.3)
|
102
|
+
tty-screen (0.6.5)
|
103
|
+
tty-table (0.10.0)
|
104
|
+
equatable (~> 0.5.0)
|
105
|
+
necromancer (~> 0.4.0)
|
106
|
+
pastel (~> 0.7.2)
|
107
|
+
strings (~> 0.1.0)
|
108
|
+
tty-screen (~> 0.6.4)
|
89
109
|
unicode-display_width (1.4.0)
|
110
|
+
unicode_utils (1.4.0)
|
90
111
|
|
91
112
|
PLATFORMS
|
92
113
|
ruby
|
@@ -99,4 +120,4 @@ DEPENDENCIES
|
|
99
120
|
rubocop (~> 0.57)
|
100
121
|
|
101
122
|
BUNDLED WITH
|
102
|
-
1.16.
|
123
|
+
1.16.2
|
data/README.md
CHANGED
@@ -14,6 +14,14 @@ While we were developing [Kontena Pharos](https://kontena.io/pharos) Kubernetes
|
|
14
14
|
|
15
15
|
## Installation
|
16
16
|
|
17
|
+
### MacOS Homebrew
|
18
|
+
|
19
|
+
`$ brew install kontena/mortar/mortar`
|
20
|
+
|
21
|
+
Or to install the latest development version:
|
22
|
+
|
23
|
+
`$ brew install --HEAD kontena/mortar/mortar`
|
24
|
+
|
17
25
|
### Rubygems:
|
18
26
|
|
19
27
|
`$ gem install kontena-mortar`
|
@@ -41,13 +49,25 @@ For CI/CD use mortar also understands following environment variables:
|
|
41
49
|
### Deploying k8s yaml manifests
|
42
50
|
|
43
51
|
```
|
44
|
-
$ mortar fire [options] <src-folder> <
|
52
|
+
$ mortar fire [options] <src-folder> <shot-name>
|
45
53
|
```
|
46
54
|
|
47
55
|
### Removing a deployment
|
48
56
|
|
49
57
|
```
|
50
|
-
$ mortar yank [options] <
|
58
|
+
$ mortar yank [options] <shot-name>
|
59
|
+
```
|
60
|
+
|
61
|
+
### Listing all shots
|
62
|
+
|
63
|
+
```
|
64
|
+
$ mortar list [options]
|
65
|
+
```
|
66
|
+
|
67
|
+
### Describing a shot
|
68
|
+
|
69
|
+
```
|
70
|
+
$ mortar describe [options] <shot-name>
|
51
71
|
```
|
52
72
|
|
53
73
|
### Docker image
|
@@ -164,6 +184,26 @@ spec:
|
|
164
184
|
|
165
185
|
You could shoot this resource with `mortar --var port.name=some-port --var port.number=80 my-app resources/pod.yml.erb`
|
166
186
|
|
187
|
+
### Shot configuration file
|
188
|
+
|
189
|
+
It is also possible to pass both [variables](#variables) and [overlays](#overlays) through a configuration file. As your templates complexity and the amount of variables used grows, it might be easier to manage the variables with an yaml configuration file. The config file has the following syntax:
|
190
|
+
```
|
191
|
+
variables:
|
192
|
+
ports:
|
193
|
+
- name: http
|
194
|
+
number: 80
|
195
|
+
- name: https
|
196
|
+
number: 443
|
197
|
+
overlays:
|
198
|
+
- foo
|
199
|
+
- bar
|
200
|
+
```
|
201
|
+
|
202
|
+
Both `variables` and `overlays` are optional.
|
203
|
+
|
204
|
+
For variables the hash is translated into a `RecursiveOpenStruct` object. What that means is that you can access each element with dotted path notation, just like the vars given through `--var` option. And of course arrays can be looped etc.. Check examples folder how to use variables effectively.
|
205
|
+
|
206
|
+
The configuration file can be given using `-c` option to `mortar fire` command. By default Mortar will look for `shot.yml` or `shot.yaml` files present in current working directory.
|
167
207
|
|
168
208
|
## Contributing
|
169
209
|
|
@@ -10,7 +10,9 @@ chmod +x /usr/local/bin/rubyc
|
|
10
10
|
gem install bundler
|
11
11
|
version=${DRONE_TAG#"v"}
|
12
12
|
package="mortar-linux-amd64-${version}"
|
13
|
-
|
13
|
+
mkdir -p /root/mortar-build.tmp
|
14
|
+
rubyc -o $package -d /root/mortar-build.tmp mortar
|
15
|
+
rm -rf /root/mortar-build.tmp
|
14
16
|
./$package --version
|
15
17
|
|
16
18
|
# ship to github
|
@@ -21,4 +23,4 @@ chmod +x /usr/local/bin/github-release
|
|
21
23
|
--repo mortar \
|
22
24
|
--tag $DRONE_TAG \
|
23
25
|
--name $package \
|
24
|
-
--file ./$package
|
26
|
+
--file ./$package
|
@@ -0,0 +1,16 @@
|
|
1
|
+
kind: Pod
|
2
|
+
apiVersion: v1
|
3
|
+
metadata:
|
4
|
+
name: nginx
|
5
|
+
labels:
|
6
|
+
name: nginx
|
7
|
+
namespace: default
|
8
|
+
spec:
|
9
|
+
containers:
|
10
|
+
- name: nginx
|
11
|
+
image: nginx:latest
|
12
|
+
ports:
|
13
|
+
<% var.ports.each { |port| %>
|
14
|
+
- containerPort: <%= port.number %>
|
15
|
+
name: <%= port.name %>
|
16
|
+
<% } %>
|
data/kontena-mortar.gemspec
CHANGED
@@ -26,10 +26,11 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.post_install_message = "To install shell auto-completions, use:\n mortar install-completions"
|
27
27
|
|
28
28
|
spec.add_runtime_dependency "clamp", "~> 1.3"
|
29
|
-
spec.add_runtime_dependency "k8s-client", "~> 0.
|
29
|
+
spec.add_runtime_dependency "k8s-client", "~> 0.5.0"
|
30
30
|
spec.add_runtime_dependency "rouge", "~> 3.2"
|
31
31
|
spec.add_runtime_dependency "deep_merge", "~> 1.2"
|
32
32
|
spec.add_runtime_dependency "pastel", "~> 0.7.2"
|
33
|
+
spec.add_runtime_dependency "tty-table", "~> 0.10.0"
|
33
34
|
spec.add_development_dependency "bundler", "~> 1.16"
|
34
35
|
spec.add_development_dependency "rake", "~> 10.0"
|
35
36
|
spec.add_development_dependency "rspec", "~> 3.0"
|
data/lib/mortar.rb
CHANGED
@@ -4,6 +4,7 @@ require "clamp"
|
|
4
4
|
require "deep_merge"
|
5
5
|
require "mortar/version"
|
6
6
|
require "mortar/root_command"
|
7
|
+
require "mortar/config"
|
7
8
|
|
8
9
|
autoload :K8s, "k8s-client"
|
9
10
|
autoload :YAML, "yaml"
|
@@ -14,6 +15,10 @@ autoload :Pastel, "pastel"
|
|
14
15
|
autoload :Pathname, "pathname"
|
15
16
|
autoload :FileUtils, "fileutils"
|
16
17
|
|
18
|
+
module TTY
|
19
|
+
autoload :Table, 'tty-table'
|
20
|
+
end
|
21
|
+
|
17
22
|
require "extensions/recursive_open_struct/each"
|
18
23
|
|
19
24
|
module Mortar
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mortar
|
4
|
+
class Config
|
5
|
+
class ConfigError < StandardError; end
|
6
|
+
|
7
|
+
def self.load(path)
|
8
|
+
cfg = YAML.safe_load(File.read(path))
|
9
|
+
|
10
|
+
raise ConfigError, "Failed to load config, check config file syntax" unless cfg.is_a? Hash
|
11
|
+
raise ConfigError, "Failed to load config, overlays needs to be an array" if cfg.key?('overlays') && !cfg['overlays'].is_a?(Array)
|
12
|
+
|
13
|
+
new(variables: cfg['variables'] || {}, overlays: cfg['overlays'] || [])
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(variables: {}, overlays: [])
|
17
|
+
@variables = variables
|
18
|
+
@overlays = overlays
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [RecursiveOpenStruct]
|
22
|
+
def variables(other = {})
|
23
|
+
hash = @variables.dup
|
24
|
+
hash.deep_merge!(other)
|
25
|
+
RecursiveOpenStruct.new(hash, recurse_over_arrays: true)
|
26
|
+
end
|
27
|
+
|
28
|
+
def overlays(other = [])
|
29
|
+
return @overlays unless other
|
30
|
+
|
31
|
+
(@overlays + other).uniq.compact
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "command"
|
4
|
+
require_relative "mixins/client_helper"
|
5
|
+
require_relative "mixins/tty_helper"
|
6
|
+
|
7
|
+
module Mortar
|
8
|
+
class DescribeCommand < Mortar::Command
|
9
|
+
include Mortar::ClientHelper
|
10
|
+
include Mortar::TTYHelper
|
11
|
+
include Mortar::ResourceHelper
|
12
|
+
|
13
|
+
parameter "NAME", "deployment name"
|
14
|
+
|
15
|
+
option ["-o", "--output"], "OUTPUT", "Output format", default: 'table'
|
16
|
+
|
17
|
+
def execute
|
18
|
+
resources = client.list_resources(labelSelector: { LABEL => name }).select{ |r|
|
19
|
+
r.metadata.labels&.dig(LABEL) == name
|
20
|
+
}.uniq{ |r|
|
21
|
+
# Kube api returns same object from many api versions...
|
22
|
+
"#{r.kind}/#{r.metadata.name}/#{r.metadata.namespace}"
|
23
|
+
}.sort{ |a, b| # Sort resources so that non namespaced objects are outputted firts
|
24
|
+
if a.metadata.namespace == b.metadata.namespace
|
25
|
+
1
|
26
|
+
elsif a.metadata.namespace.nil? && !b.metadata.namespace.nil?
|
27
|
+
-1
|
28
|
+
else
|
29
|
+
0
|
30
|
+
end
|
31
|
+
}
|
32
|
+
|
33
|
+
case output
|
34
|
+
when 'table'
|
35
|
+
table(resources)
|
36
|
+
when 'yaml'
|
37
|
+
puts resources_output(resources)
|
38
|
+
when 'json'
|
39
|
+
puts json_output(resources)
|
40
|
+
else
|
41
|
+
signal_usage_error "Unknown output format: #{output}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def table(resources)
|
46
|
+
table = TTY::Table.new %w(NAMESPACE KIND NAME), []
|
47
|
+
resources.each do |r|
|
48
|
+
table << [r.metadata.namespace || '', r.kind, r.metadata.name]
|
49
|
+
end
|
50
|
+
puts table.render(:basic)
|
51
|
+
end
|
52
|
+
|
53
|
+
def json_output(resources)
|
54
|
+
json = JSON.pretty_generate(resources.map(&:to_hash))
|
55
|
+
return json unless $stdout.tty?
|
56
|
+
|
57
|
+
lexer = Rouge::Lexers::JSON.new
|
58
|
+
rouge = Rouge::Formatters::Terminal256.new(Rouge::Themes::Github.new)
|
59
|
+
rouge.format(lexer.lex(json))
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/lib/mortar/fire_command.rb
CHANGED
@@ -18,11 +18,32 @@ module Mortar
|
|
18
18
|
|
19
19
|
option ["--var"], "VAR", "set template variables", multivalued: true
|
20
20
|
option ["--output"], :flag, "only output generated yaml"
|
21
|
-
option ["--prune"], :flag, "automatically delete removed resources"
|
21
|
+
option ["--[no-]prune"], :flag, "automatically delete removed resources", default: true
|
22
22
|
option ["--overlay"], "OVERLAY", "overlay dirs", multivalued: true
|
23
|
+
option ["-c", "--config"], "CONFIG", "variable and overlay configuration file"
|
24
|
+
|
25
|
+
def default_config
|
26
|
+
%w{shot.yml shot.yaml}.find { |path|
|
27
|
+
File.readable?(path)
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def load_config
|
32
|
+
if config
|
33
|
+
signal_usage_error("Cannot read config file from #{path}") unless File.readable?(config)
|
34
|
+
|
35
|
+
@configuration = Config.load(config)
|
36
|
+
else
|
37
|
+
# No config provided nor the default config file present
|
38
|
+
@configuration = Config.new(variables: {}, overlays: [])
|
39
|
+
end
|
40
|
+
end
|
23
41
|
|
24
42
|
def execute
|
25
43
|
signal_usage_error("#{src} does not exist") unless File.exist?(src)
|
44
|
+
|
45
|
+
load_config
|
46
|
+
|
26
47
|
resources = process_overlays
|
27
48
|
|
28
49
|
if output?
|
@@ -46,9 +67,10 @@ module Mortar
|
|
46
67
|
end
|
47
68
|
|
48
69
|
def process_overlays
|
49
|
-
|
50
|
-
|
51
|
-
|
70
|
+
# Reject any resource that do not have kind set
|
71
|
+
# Basically means the config or other random yml files found
|
72
|
+
resources = load_resources(src).reject { |r| r.kind.nil? }
|
73
|
+
@configuration.overlays(overlay_list).each do |overlay|
|
52
74
|
overlay_resources = from_files(overlay)
|
53
75
|
overlay_resources.each do |overlay_resource|
|
54
76
|
match = false
|
@@ -67,44 +89,31 @@ module Mortar
|
|
67
89
|
resources
|
68
90
|
end
|
69
91
|
|
70
|
-
# @param resources [Array<K8s::Resource>]
|
71
|
-
# @return [String]
|
72
|
-
def resources_output(resources)
|
73
|
-
yaml = +''
|
74
|
-
resources.each do |resource|
|
75
|
-
yaml << ::YAML.dump(stringify_hash(resource.to_hash))
|
76
|
-
end
|
77
|
-
return yaml unless $stdout.tty?
|
78
|
-
|
79
|
-
lexer = Rouge::Lexers::YAML.new
|
80
|
-
rouge = Rouge::Formatters::Terminal256.new(Rouge::Themes::Github.new)
|
81
|
-
rouge.format(lexer.lex(yaml))
|
82
|
-
end
|
83
|
-
|
84
92
|
# @return [RecursiveOpenStruct]
|
85
93
|
def variables_struct
|
86
|
-
|
94
|
+
@variables_struct ||= @configuration.variables(variables_hash)
|
95
|
+
end
|
87
96
|
|
97
|
+
def variables_hash
|
88
98
|
set_hash = {}
|
89
99
|
var_list.each do |var|
|
90
100
|
k, v = var.split("=", 2)
|
91
101
|
set_hash[k] = v
|
92
102
|
end
|
93
|
-
|
103
|
+
|
104
|
+
dotted_path_to_hash(set_hash)
|
94
105
|
end
|
95
106
|
|
96
107
|
def dotted_path_to_hash(hash)
|
97
|
-
hash.map do |pkey, pvalue|
|
108
|
+
h = hash.map do |pkey, pvalue|
|
98
109
|
pkey.to_s.split(".").reverse.inject(pvalue) do |value, key|
|
99
110
|
{ key.to_sym => value }
|
100
111
|
end
|
101
|
-
end
|
102
|
-
|
112
|
+
end
|
113
|
+
# Safer to return just empty hash instead of nil
|
114
|
+
return {} if h.empty?
|
103
115
|
|
104
|
-
|
105
|
-
# @return [Hash]
|
106
|
-
def stringify_hash(hash)
|
107
|
-
JSON.parse(JSON.dump(hash))
|
116
|
+
h.inject(&:deep_merge)
|
108
117
|
end
|
109
118
|
end
|
110
119
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "command"
|
4
|
+
require_relative "mixins/client_helper"
|
5
|
+
require_relative "mixins/tty_helper"
|
6
|
+
|
7
|
+
module Mortar
|
8
|
+
class ListCommand < Mortar::Command
|
9
|
+
include Mortar::ClientHelper
|
10
|
+
include Mortar::TTYHelper
|
11
|
+
|
12
|
+
option ['-q', '--quiet'], :flag, "only output shot names"
|
13
|
+
|
14
|
+
def execute
|
15
|
+
shots = Hash.new(0)
|
16
|
+
|
17
|
+
client.list_resources(labelSelector: LABEL).select{ |r|
|
18
|
+
r.metadata.labels&.dig(LABEL)
|
19
|
+
}.uniq{ |r|
|
20
|
+
# Kube api returns same object from many api versions...
|
21
|
+
"#{r.kind}/#{r.metadata.name}/#{r.metadata.namespace}"
|
22
|
+
}.each do |resource|
|
23
|
+
shot_name = resource.metadata.labels&.dig(LABEL)
|
24
|
+
shots[shot_name] += 1
|
25
|
+
end
|
26
|
+
|
27
|
+
if quiet?
|
28
|
+
shots.each_key do |k|
|
29
|
+
puts k
|
30
|
+
end
|
31
|
+
else
|
32
|
+
table = TTY::Table.new %w(NAME RESOURCES), shots.to_a
|
33
|
+
puts table.render(:basic)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -38,5 +38,25 @@ module Mortar
|
|
38
38
|
resource_a.kind == resource_b.kind &&
|
39
39
|
resource_a.metadata[:name] == resource_b.metadata[:name]
|
40
40
|
end
|
41
|
+
|
42
|
+
# @param resources [Array<K8s::Resource>]
|
43
|
+
# @return [String]
|
44
|
+
def resources_output(resources)
|
45
|
+
yaml = +''
|
46
|
+
resources.each do |resource|
|
47
|
+
yaml << ::YAML.dump(stringify_hash(resource.to_hash))
|
48
|
+
end
|
49
|
+
return yaml unless $stdout.tty?
|
50
|
+
|
51
|
+
lexer = Rouge::Lexers::YAML.new
|
52
|
+
rouge = Rouge::Formatters::Terminal256.new(Rouge::Themes::Github.new)
|
53
|
+
rouge.format(lexer.lex(yaml))
|
54
|
+
end
|
55
|
+
|
56
|
+
# Stringifies all hash keys
|
57
|
+
# @return [Hash]
|
58
|
+
def stringify_hash(hash)
|
59
|
+
JSON.parse(JSON.dump(hash))
|
60
|
+
end
|
41
61
|
end
|
42
62
|
end
|
data/lib/mortar/root_command.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require "clamp"
|
4
4
|
require_relative "fire_command"
|
5
5
|
require_relative "yank_command"
|
6
|
+
require_relative "describe_command"
|
7
|
+
require_relative "list_command"
|
6
8
|
require_relative "install_completions_command"
|
7
9
|
|
8
10
|
Clamp.allow_options_after_parameters = true
|
@@ -18,6 +20,8 @@ module Mortar
|
|
18
20
|
|
19
21
|
subcommand "fire", "Fire a shot (of k8s manifests)", FireCommand
|
20
22
|
subcommand "yank", "Yank a shot (of k8s manifests)", YankCommand
|
23
|
+
subcommand "describe", "Describe a shot (of k8s manifests)", DescribeCommand
|
24
|
+
subcommand "list", "List shots (of k8s manifests)", ListCommand
|
21
25
|
|
22
26
|
subcommand "install-completions", "Install shell autocompletions", InstallCompletionsCommand
|
23
27
|
end
|
data/lib/mortar/version.rb
CHANGED
data/opt/bash-completion.sh
CHANGED
@@ -14,7 +14,7 @@ _mortar () {
|
|
14
14
|
return
|
15
15
|
fi
|
16
16
|
|
17
|
-
COMPREPLY=( $(compgen -W "fire yank" -- ${cur}) )
|
17
|
+
COMPREPLY=( $(compgen -W "fire yank describe list" -- ${cur}) )
|
18
18
|
return
|
19
19
|
else
|
20
20
|
case "${COMP_WORDS[1]}" in
|
@@ -33,6 +33,18 @@ _mortar () {
|
|
33
33
|
COMPREPLY=( $(compgen -W "--force --debug --help" -- ${cur}) )
|
34
34
|
fi
|
35
35
|
;;
|
36
|
+
describe)
|
37
|
+
if [[ ${cur} == -* ]] ; then
|
38
|
+
COMPREPLY=( $(compgen -W "--output --debug --help" -- ${cur}) )
|
39
|
+
elif [ "$prev" = "--output" ]; then
|
40
|
+
COMPREPLY=( $(compgen -W "table yaml json" -- ${cur}) )
|
41
|
+
fi
|
42
|
+
;;
|
43
|
+
list)
|
44
|
+
if [[ ${cur} == -* ]] ; then
|
45
|
+
COMPREPLY=( $(compgen -W "--quiet --debug --help" -- ${cur}) )
|
46
|
+
fi
|
47
|
+
;;
|
36
48
|
esac
|
37
49
|
fi
|
38
50
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kontena-mortar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kontena, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.5.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.5.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rouge
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.7.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: tty-table
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.10.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.10.0
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: bundler
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,6 +176,9 @@ files:
|
|
162
176
|
- build/travis/macos.sh
|
163
177
|
- examples/basic/deployment.yml
|
164
178
|
- examples/basic/service.yml
|
179
|
+
- examples/config/config.yaml
|
180
|
+
- examples/config/pod.yml.erb
|
181
|
+
- examples/config/shot.yaml
|
165
182
|
- examples/force-deployment/deployment.yml.erb
|
166
183
|
- examples/overlays/echo-metal.yml
|
167
184
|
- examples/overlays/foo/pod.yml.erb
|
@@ -176,8 +193,11 @@ files:
|
|
176
193
|
- lib/extensions/recursive_open_struct/each.rb
|
177
194
|
- lib/mortar.rb
|
178
195
|
- lib/mortar/command.rb
|
196
|
+
- lib/mortar/config.rb
|
197
|
+
- lib/mortar/describe_command.rb
|
179
198
|
- lib/mortar/fire_command.rb
|
180
199
|
- lib/mortar/install_completions_command.rb
|
200
|
+
- lib/mortar/list_command.rb
|
181
201
|
- lib/mortar/mixins/client_helper.rb
|
182
202
|
- lib/mortar/mixins/resource_helper.rb
|
183
203
|
- lib/mortar/mixins/tty_helper.rb
|
@@ -203,9 +223,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
203
223
|
version: '0'
|
204
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
225
|
requirements:
|
206
|
-
- - "
|
226
|
+
- - ">"
|
207
227
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
228
|
+
version: 1.3.1
|
209
229
|
requirements: []
|
210
230
|
rubyforge_project:
|
211
231
|
rubygems_version: 2.7.6
|