kubes 0.6.8 → 0.7.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 +4 -4
- data/CHANGELOG.md +3 -0
- data/docs/_docs/dsl/multiple-resources.md +7 -6
- data/docs/_docs/yaml/multiple-files.md +23 -0
- data/docs/_docs/yaml/multiple-resources.md +90 -0
- data/docs/_includes/layering/layers.md +7 -4
- data/docs/_includes/sidebar.html +6 -1
- data/lib/kubes/compiler/dsl/core/base.rb +1 -1
- data/lib/kubes/compiler/dsl/core/blocks.rb +5 -1
- data/lib/kubes/compiler/dsl/syntax/endpoint.rb +34 -0
- data/lib/kubes/compiler/layering.rb +3 -7
- data/lib/kubes/compiler/strategy.rb +1 -15
- data/lib/kubes/compiler/strategy/base.rb +0 -56
- data/lib/kubes/compiler/strategy/dispatcher.rb +59 -0
- data/lib/kubes/compiler/strategy/erb.rb +6 -7
- data/lib/kubes/compiler/strategy/result.rb +6 -2
- data/lib/kubes/compiler/util/normalize.rb +2 -2
- data/lib/kubes/compiler/util/yaml_dump.rb +7 -4
- data/lib/kubes/version.rb +1 -1
- data/lib/templates/new/resource/dsl/endpoint.rb +3 -0
- data/lib/templates/new/resource/yaml/endpoint.yaml +9 -0
- data/spec/kubes/compiler/strategy/{dsl_spec.rb → dispatcher_spec.rb} +10 -9
- metadata +10 -5
- data/lib/kubes/compiler/strategy/dsl.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c708370f432e482b105a766bd174dd52f89c790256ea91063a8045af1d970f39
|
4
|
+
data.tar.gz: 3b4aef7f7450776cf35b9db54ff7d326a6444e948ab7cf81fac1a7659fca9649
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f157bfaa51b24e2f23327ab02075abdeb331564c28cdcbe0710eeefb8ba2cd7910ea2719e28e1cdedb3b5b2873be902734c27254089ba5e1bc4083e13d33a10f
|
7
|
+
data.tar.gz: 48594a55badaba62e2ef7cfe436bc32640a5723221278f7d42c307144a00c300ca9a9c07d1501bc9a10204ff629929272171d8a4fc1cfe878b91bc951f46ba96
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [0.7.0] - 2020-11-16
|
7
|
+
- [#41](https://github.com/boltops-tools/kubes/pull/41) multiple resources yaml support
|
8
|
+
|
6
9
|
## [0.6.8] - 2020-11-14
|
7
10
|
- [#40](https://github.com/boltops-tools/kubes/pull/40) fix version check
|
8
11
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
---
|
2
|
-
title: Multiple Resources
|
2
|
+
title: DSL Multiple Resources
|
3
3
|
---
|
4
4
|
|
5
5
|
Kubes encourages a structure with files that matches the resource kind. Example:
|
@@ -35,7 +35,7 @@ deployment-2.rb | Deployment
|
|
35
35
|
service-1.rb | Service
|
36
36
|
service-2.rb | Service
|
37
37
|
|
38
|
-
Using multiple files is the general recommended approach.
|
38
|
+
Using multiple files is the general recommended approach when using the DSL.
|
39
39
|
|
40
40
|
## Multiple Resources: Block Form
|
41
41
|
|
@@ -86,8 +86,9 @@ You can declare deployment, service, and other resource kinds multiple times.
|
|
86
86
|
|
87
87
|
Layering works for both simple and block form. Just create a folder with the corresponding name.
|
88
88
|
|
89
|
-
* The layering definitions
|
90
|
-
* The layering definitions for
|
89
|
+
* The layering definitions for the prelayers are in singular form.
|
90
|
+
* The layering definitions for the post layers are in a folder with plural form.
|
91
|
+
* Resources in the main "middle" layer are the only ones that are allowed multiple resource definitions.
|
91
92
|
|
92
93
|
Simple form layering:
|
93
94
|
|
@@ -105,8 +106,8 @@ Block form layering:
|
|
105
106
|
|
106
107
|
.kubes/resources/
|
107
108
|
├── base
|
108
|
-
│ ├──
|
109
|
-
│ └──
|
109
|
+
│ ├── all.rb
|
110
|
+
│ └── deployment.rb
|
110
111
|
└── web
|
111
112
|
├── deployments
|
112
113
|
│ ├── dev.rb
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
title: YAML Multiple Resources with Multiple Files
|
3
|
+
---
|
4
|
+
|
5
|
+
You can also create multiple resources of same kind by appending a dash followed by anything. Example:
|
6
|
+
|
7
|
+
.kubes
|
8
|
+
└── resources
|
9
|
+
└── web
|
10
|
+
├── deployment-1.yaml
|
11
|
+
├── deployment-2.yaml
|
12
|
+
├── service-1.yaml
|
13
|
+
└── service-2.yaml
|
14
|
+
|
15
|
+
Only words before the dash are used to infer the resource kind.
|
16
|
+
|
17
|
+
Filename | Resource Kind
|
18
|
+
--- | ---
|
19
|
+
deployment-1.yaml | Deployment
|
20
|
+
deployment-2.yaml | Deployment
|
21
|
+
service-1.yaml | Service
|
22
|
+
service-2.yaml | Service
|
23
|
+
|
@@ -0,0 +1,90 @@
|
|
1
|
+
---
|
2
|
+
title: YAML Multiple Resources
|
3
|
+
---
|
4
|
+
|
5
|
+
Kubes encourages a structure with files that matches the resource kind. Example:
|
6
|
+
|
7
|
+
.kubes
|
8
|
+
└── resources
|
9
|
+
└── web
|
10
|
+
├── deployment.yaml
|
11
|
+
└── service.yaml
|
12
|
+
|
13
|
+
This structure is nicely organized and covers 80% of use cases. An astute user may point out that this struture assumes one resource of each kind.
|
14
|
+
|
15
|
+
Next, we'll cover how to create multiple resource of the same kinds.
|
16
|
+
|
17
|
+
## Multiple Resources in Same YAML
|
18
|
+
|
19
|
+
You can simply define multiple resources in th same YAML file. Conventionally, you should name the resource files with plural names. An example helps explain:
|
20
|
+
|
21
|
+
.kubes
|
22
|
+
└── resources
|
23
|
+
└── deployments.yaml
|
24
|
+
|
25
|
+
.kubes/resources/web/deployments.yaml
|
26
|
+
|
27
|
+
```yaml
|
28
|
+
- apiVersion: apps/v1
|
29
|
+
kind: Deployment
|
30
|
+
metadata:
|
31
|
+
name: web-1
|
32
|
+
labels:
|
33
|
+
role: web
|
34
|
+
spec:
|
35
|
+
selector:
|
36
|
+
matchLabels:
|
37
|
+
role: web
|
38
|
+
template:
|
39
|
+
metadata:
|
40
|
+
labels:
|
41
|
+
role: web
|
42
|
+
spec:
|
43
|
+
containers:
|
44
|
+
- name: web
|
45
|
+
image: <%= docker_image %>
|
46
|
+
- apiVersion: apps/v1
|
47
|
+
kind: Deployment
|
48
|
+
metadata:
|
49
|
+
name: web-2
|
50
|
+
labels:
|
51
|
+
role: web
|
52
|
+
spec:
|
53
|
+
selector:
|
54
|
+
matchLabels:
|
55
|
+
role: web
|
56
|
+
template:
|
57
|
+
metadata:
|
58
|
+
labels:
|
59
|
+
role: web
|
60
|
+
spec:
|
61
|
+
containers:
|
62
|
+
- name: web
|
63
|
+
image: <%= docker_image %>
|
64
|
+
```
|
65
|
+
|
66
|
+
Notice that the YAML contains an Array of definitions now.
|
67
|
+
|
68
|
+
## Layering
|
69
|
+
|
70
|
+
Layering works just fine with multiple resource definitions. The layering is processed on each item of the Array.
|
71
|
+
|
72
|
+
Notes:
|
73
|
+
|
74
|
+
* The layering definitions for the pre layers must be in singular form.
|
75
|
+
* The layering definitions for the post layers must be in a folder with plural form, but define a singlar resource override.
|
76
|
+
* Resources in the main "middle" layer is the only one that allows for multiple resource definitions.
|
77
|
+
|
78
|
+
Multiple resources layering structure.
|
79
|
+
|
80
|
+
.kubes/resources/
|
81
|
+
├── base
|
82
|
+
│ ├── all.rb
|
83
|
+
│ └── deployment.rb # SINGULAR
|
84
|
+
└── web
|
85
|
+
├── deployments # PLURAL
|
86
|
+
│ ├── dev.rb
|
87
|
+
│ └── prod.rb
|
88
|
+
└── deployments.rb # PLURAL
|
89
|
+
|
90
|
+
The main difference is the pluralized filenames.
|
@@ -21,11 +21,14 @@ Here's an example structure, so we can understand how layering works.
|
|
21
21
|
|
22
22
|
To explain the layering, here's the general processing order that Kubes takes.
|
23
23
|
|
24
|
-
1. The `.kubes/resources/base` folder is treated as a base layer. It gets processed as pre-layers by Kubes.
|
25
|
-
2. Then Kubes will process your `.kubes/resources/ROLE` definitions.
|
26
|
-
3. Lastly, Kubes processes any post-layers in the `.kubes/resources/ROLE/KIND` folders.
|
24
|
+
1. **Pre Layers**: The `.kubes/resources/base` folder is treated as a base layer. It gets processed as pre-layers by Kubes.
|
25
|
+
2. **Main Layer**: Then Kubes will process your `.kubes/resources/ROLE` definitions.
|
26
|
+
3. **Post Layers**: Lastly, Kubes processes any post-layers in the `.kubes/resources/ROLE/KIND` folders.
|
27
27
|
|
28
|
-
|
28
|
+
Notes
|
29
|
+
|
30
|
+
* Both YAML and DSL forms support layering. They can be mixed together.
|
31
|
+
* In the Main Layer you can define single or multiple resource definitions.
|
29
32
|
|
30
33
|
## Full Layering
|
31
34
|
|
data/docs/_includes/sidebar.html
CHANGED
@@ -86,7 +86,12 @@
|
|
86
86
|
</ul>
|
87
87
|
</li>
|
88
88
|
<li><a href="{% link _docs/generators.md %}">Generators</a></li>
|
89
|
-
<li><a href="{% link _docs/yaml.md %}">YAML</a
|
89
|
+
<li><a href="{% link _docs/yaml.md %}">YAML</a>
|
90
|
+
<ul>
|
91
|
+
<li><a href="{% link _docs/yaml/multiple-resources.md %}">Multiple Resources</a></li>
|
92
|
+
<li><a href="{% link _docs/yaml/multiple-files.md %}">Multiple Files</a></li>
|
93
|
+
</ul>
|
94
|
+
</li>
|
90
95
|
<li><a href="{% link _docs/layering.md %}">Layering</a>
|
91
96
|
<ul>
|
92
97
|
<li><a href="{% link _docs/layering/yaml.md %}">YAML</a></li>
|
@@ -5,7 +5,11 @@ module Kubes::Compiler::Dsl::Core
|
|
5
5
|
@results = {} # Hash key is the name of resource, using it so we can keep a map to handle layering
|
6
6
|
@block_form = true # pluralizes the layer names
|
7
7
|
super # handles layering and evaluating the main DSL file
|
8
|
-
|
8
|
+
result # Array
|
9
|
+
end
|
10
|
+
|
11
|
+
def result
|
12
|
+
@results.values # Array
|
9
13
|
end
|
10
14
|
|
11
15
|
def syntax_instance(meth, name)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Kubes::Compiler::Dsl::Syntax
|
2
|
+
class Endpoint < Resource
|
3
|
+
fields :subsets
|
4
|
+
|
5
|
+
# kubectl explain endpoints.subsets
|
6
|
+
fields :addresses, # <[]Object>
|
7
|
+
:notReadyAddresses, # <[]Object>
|
8
|
+
:ports # <[]Object>
|
9
|
+
|
10
|
+
def default_kind
|
11
|
+
return @kind_from_block if @kind_from_block
|
12
|
+
"Endpoints" # always plural
|
13
|
+
end
|
14
|
+
|
15
|
+
def default_apiVersion
|
16
|
+
"v1"
|
17
|
+
end
|
18
|
+
|
19
|
+
def default_top
|
20
|
+
top = super
|
21
|
+
top.merge(
|
22
|
+
subsets: subsets
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
def default_subsets
|
27
|
+
[{
|
28
|
+
addresses: addresses,
|
29
|
+
notReadyAddresses: notReadyAddresses,
|
30
|
+
ports: ports,
|
31
|
+
}]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -5,14 +5,10 @@ class Kubes::Compiler
|
|
5
5
|
|
6
6
|
ext = File.extname(@path)
|
7
7
|
kind = File.basename(@path).sub(ext,'') # IE: deployment
|
8
|
-
|
9
|
-
if @block_form
|
10
|
-
kind = kind.pluralize
|
11
|
-
all = all.pluralize
|
12
|
-
end
|
8
|
+
kind = kind.pluralize if @block_form
|
13
9
|
layers = [
|
14
|
-
"
|
15
|
-
"
|
10
|
+
"all",
|
11
|
+
"all/#{Kubes.env}",
|
16
12
|
"#{kind}",
|
17
13
|
"#{kind}/#{Kubes.env}",
|
18
14
|
]
|
@@ -6,23 +6,9 @@ class Kubes::Compiler
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def compile
|
9
|
-
|
10
|
-
return false unless klass
|
11
|
-
|
12
|
-
strategy = klass.new(@options.merge(path: @path)) # Dsl or Erb
|
13
|
-
result = strategy.run
|
9
|
+
result = Dispatcher.new(@options.merge(path: @path)).dispatch
|
14
10
|
result.decorate!(:pre) # compile pre phase decoration
|
15
11
|
result
|
16
12
|
end
|
17
|
-
|
18
|
-
def strategy_class
|
19
|
-
ext = File.extname(@path).sub('.','').to_sym
|
20
|
-
map = {
|
21
|
-
rb: Dsl,
|
22
|
-
yaml: Erb,
|
23
|
-
yml: Erb,
|
24
|
-
}
|
25
|
-
map[ext]
|
26
|
-
end
|
27
13
|
end
|
28
14
|
end
|
@@ -9,62 +9,6 @@ class Kubes::Compiler::Strategy
|
|
9
9
|
@options = options
|
10
10
|
@path = options[:path]
|
11
11
|
@save_file = save_file(@path)
|
12
|
-
@data = @options[:data] || {}
|
13
|
-
end
|
14
|
-
|
15
|
-
def run
|
16
|
-
render_files(pre_layers)
|
17
|
-
render(@path) # main resource definition
|
18
|
-
render_files(post_layers)
|
19
|
-
|
20
|
-
Result.new(@save_file, @data)
|
21
|
-
end
|
22
|
-
|
23
|
-
def render_files(paths)
|
24
|
-
paths.each do |path|
|
25
|
-
next unless File.exist?(path) # layers may not exist
|
26
|
-
render(path)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# render and merge
|
31
|
-
def render(path)
|
32
|
-
result = render_strategy(path)
|
33
|
-
if result.is_a?(Kubes::Compiler::Dsl::Core::Blocks)
|
34
|
-
result = result.results
|
35
|
-
end
|
36
|
-
@data.deeper_merge!(result)
|
37
|
-
end
|
38
|
-
|
39
|
-
# Delegate to Dsl or Erb strategy again and pass @data down to allow rendering of a mix of yaml and rb files.
|
40
|
-
def render_strategy(path)
|
41
|
-
if path.include?('.rb')
|
42
|
-
dsl_class.new(@options.merge(path: path, data: @data)).run
|
43
|
-
else
|
44
|
-
Erb.new(@options.merge(data: @data)).render_result(path)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# Must be defined here in case coming from Kubes::Compiler::Strategy::Erb#render_strategy
|
49
|
-
def dsl_class
|
50
|
-
if block_form?
|
51
|
-
Kubes::Compiler::Dsl::Core::Blocks
|
52
|
-
else
|
53
|
-
syntax_class
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def syntax_class
|
58
|
-
klass_name = normalize_kind(@save_file) # IE: @save_file: web/service.yaml
|
59
|
-
"Kubes::Compiler::Dsl::Syntax::#{klass_name}".constantize
|
60
|
-
rescue NameError
|
61
|
-
logger.debug "Using default resource for: #{klass_name}"
|
62
|
-
Kubes::Compiler::Dsl::Syntax::Resource # default
|
63
|
-
end
|
64
|
-
|
65
|
-
def block_form?
|
66
|
-
type = extract_type(@save_file)
|
67
|
-
type.pluralize == type
|
68
12
|
end
|
69
13
|
end
|
70
14
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class Kubes::Compiler::Strategy
|
2
|
+
class Dispatcher < Base
|
3
|
+
def dispatch
|
4
|
+
result = render(@path) # main
|
5
|
+
results = [result].flatten # ensure array
|
6
|
+
data = results.map! do |main|
|
7
|
+
hash = pre_layer.deeper_merge!(main) # need the ! or deep_merge returns original hash
|
8
|
+
hash.deeper_merge!(post_layer)
|
9
|
+
end
|
10
|
+
Result.new(@save_file, data)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Render via to Erb or one of the DSL syntax classes or Core/Blocks class
|
14
|
+
def render(path)
|
15
|
+
if path.include?('.rb')
|
16
|
+
klass = dsl_class(path) # IE: Kubes::Compiler::Dsl::Syntax::Deployment or Kubes::Compiler::Dsl::Core::Blocks
|
17
|
+
klass.new(@options.merge(path: path, data: @data)).run
|
18
|
+
else
|
19
|
+
Erb.new(@options.merge(data: @data)).render_result(path)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Must be defined here in case coming from Kubes::Compiler::Strategy::Erb#render
|
24
|
+
def dsl_class(path)
|
25
|
+
if block_form?(path)
|
26
|
+
Kubes::Compiler::Dsl::Core::Blocks
|
27
|
+
else
|
28
|
+
syntax_class
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def syntax_class
|
33
|
+
klass_name = normalize_kind(@save_file) # IE: @save_file: web/service.yaml
|
34
|
+
"Kubes::Compiler::Dsl::Syntax::#{klass_name}".constantize
|
35
|
+
rescue NameError
|
36
|
+
logger.debug "Using default resource for: #{klass_name}"
|
37
|
+
Kubes::Compiler::Dsl::Syntax::Resource # default
|
38
|
+
end
|
39
|
+
|
40
|
+
def block_form?(path)
|
41
|
+
type = extract_type(path)
|
42
|
+
type.pluralize == type
|
43
|
+
end
|
44
|
+
|
45
|
+
def pre_layer
|
46
|
+
merge_layers(pre_layers)
|
47
|
+
end
|
48
|
+
|
49
|
+
def post_layer
|
50
|
+
merge_layers(post_layers)
|
51
|
+
end
|
52
|
+
|
53
|
+
def merge_layers(layers)
|
54
|
+
layers.inject({}) do |hash, layer|
|
55
|
+
render(layer)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -20,13 +20,12 @@ class Kubes::Compiler::Strategy
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def render_result(path)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
else
|
28
|
-
|
29
|
-
end
|
23
|
+
return unless File.exist?(path)
|
24
|
+
|
25
|
+
yaml = RenderMePretty.result(path, context: self)
|
26
|
+
result = yaml_load(path, yaml)
|
27
|
+
# in case of blank yaml doc a Boolean false is returned. else Hash or Array is returned
|
28
|
+
%w[Array Hash].include?(result.class.to_s) ? result : {}
|
30
29
|
end
|
31
30
|
|
32
31
|
def yaml_load(path, yaml)
|
@@ -14,11 +14,15 @@ class Kubes::Compiler::Strategy
|
|
14
14
|
# decorate(:pre) or decorate(:post)
|
15
15
|
def decorate!(phase)
|
16
16
|
klass = "Kubes::Compiler::Decorator::#{phase.to_s.camelize}".constantize
|
17
|
-
|
17
|
+
results = [@data].flatten
|
18
|
+
results.map! do |r|
|
19
|
+
klass.new(r).result
|
20
|
+
end
|
18
21
|
end
|
19
22
|
|
20
23
|
def content
|
21
|
-
|
24
|
+
result = @data.size == 1 ? @data.first : @data
|
25
|
+
yaml_dump(result)
|
22
26
|
end
|
23
27
|
end
|
24
28
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module Kubes::Compiler::Util
|
2
2
|
module Normalize
|
3
3
|
def normalize_kind(path)
|
4
|
-
|
5
|
-
extract_type(info).underscore.camelize # Deployment, Service, Ingress, ManagedCertificate, etc
|
4
|
+
extract_type(path).underscore.camelize # Deployment, Service, Ingress, ManagedCertificate, etc
|
6
5
|
end
|
7
6
|
|
8
7
|
# info: web/service.yaml
|
9
8
|
def extract_type(info)
|
9
|
+
info = info.sub(%r{.*/.kubes/resources/}, '')
|
10
10
|
_, kind = info.split('/')
|
11
11
|
kind.sub('.yaml','').sub('.yml','').sub('.rb','').sub(/-.*/,'')
|
12
12
|
end
|
@@ -4,12 +4,15 @@ require "yaml"
|
|
4
4
|
module Kubes::Compiler::Util
|
5
5
|
module YamlDump
|
6
6
|
def yaml_dump(data)
|
7
|
-
|
7
|
+
case data
|
8
|
+
when Array
|
9
|
+
items = data.map do |i|
|
10
|
+
standardize_yaml(i)
|
11
|
+
end
|
12
|
+
items.map(&:to_yaml).join("")
|
13
|
+
else # single resource in YAML
|
8
14
|
data = standardize_yaml(data)
|
9
15
|
data.to_yaml
|
10
|
-
else
|
11
|
-
items = data.map { |k,v| standardize_yaml(v) }
|
12
|
-
items.map(&:to_yaml).join("")
|
13
16
|
end
|
14
17
|
end
|
15
18
|
|
data/lib/kubes/version.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
-
describe Kubes::Compiler::Strategy::
|
2
|
-
let(:
|
3
|
-
let(:options) { {path:
|
1
|
+
describe Kubes::Compiler::Strategy::Dispatcher do
|
2
|
+
let(:dispatcher) { described_class.new(options) }
|
3
|
+
let(:options) { {path: path } }
|
4
|
+
let(:path) { fixture(resource) }
|
4
5
|
|
5
6
|
context "standard" do
|
6
7
|
let(:resource) { "project/.kubes/resources/web/deployment" }
|
7
8
|
it "run" do
|
8
|
-
result =
|
9
|
-
expect(
|
9
|
+
result = dispatcher.dispatch
|
10
|
+
expect(dispatcher.dsl_class(path)).to eq(Kubes::Compiler::Dsl::Syntax::Deployment)
|
10
11
|
data = YAML.load(result.content)
|
11
12
|
expect(data['kind']).to eq "Deployment"
|
12
13
|
end
|
@@ -15,8 +16,8 @@ describe Kubes::Compiler::Strategy::Dsl do
|
|
15
16
|
context "blocks" do
|
16
17
|
let(:resource) { "blocks/deployments" }
|
17
18
|
it "run" do
|
18
|
-
result =
|
19
|
-
expect(
|
19
|
+
result = dispatcher.dispatch
|
20
|
+
expect(dispatcher.dsl_class(path)).to eq(Kubes::Compiler::Dsl::Core::Blocks)
|
20
21
|
resource = result.content.split('---').last
|
21
22
|
data = YAML.load(resource)
|
22
23
|
expect(data['kind']).to eq "Deployment"
|
@@ -27,8 +28,8 @@ describe Kubes::Compiler::Strategy::Dsl do
|
|
27
28
|
context "multiple files" do
|
28
29
|
let(:resource) { "multiple-files/.kubes/resources/web/deployment-1" }
|
29
30
|
it "run" do
|
30
|
-
result =
|
31
|
-
expect(
|
31
|
+
result = dispatcher.dispatch
|
32
|
+
expect(dispatcher.dsl_class(path)).to eq(Kubes::Compiler::Dsl::Syntax::Deployment)
|
32
33
|
data = YAML.load(result.content)
|
33
34
|
expect(data['kind']).to eq "Deployment"
|
34
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kubes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -377,6 +377,8 @@ files:
|
|
377
377
|
- docs/_docs/vs/helm.md
|
378
378
|
- docs/_docs/vs/kustomize.md
|
379
379
|
- docs/_docs/yaml.md
|
380
|
+
- docs/_docs/yaml/multiple-files.md
|
381
|
+
- docs/_docs/yaml/multiple-resources.md
|
380
382
|
- docs/_includes/commands.html
|
381
383
|
- docs/_includes/config/hooks/options.md
|
382
384
|
- docs/_includes/content.html
|
@@ -593,6 +595,7 @@ files:
|
|
593
595
|
- lib/kubes/compiler/dsl/syntax/config_map.rb
|
594
596
|
- lib/kubes/compiler/dsl/syntax/daemon_set.rb
|
595
597
|
- lib/kubes/compiler/dsl/syntax/deployment.rb
|
598
|
+
- lib/kubes/compiler/dsl/syntax/endpoint.rb
|
596
599
|
- lib/kubes/compiler/dsl/syntax/ingress.rb
|
597
600
|
- lib/kubes/compiler/dsl/syntax/job.rb
|
598
601
|
- lib/kubes/compiler/dsl/syntax/managed_certificate.rb
|
@@ -613,7 +616,7 @@ files:
|
|
613
616
|
- lib/kubes/compiler/shared/plugin_helpers.rb
|
614
617
|
- lib/kubes/compiler/strategy.rb
|
615
618
|
- lib/kubes/compiler/strategy/base.rb
|
616
|
-
- lib/kubes/compiler/strategy/
|
619
|
+
- lib/kubes/compiler/strategy/dispatcher.rb
|
617
620
|
- lib/kubes/compiler/strategy/erb.rb
|
618
621
|
- lib/kubes/compiler/strategy/erb/yaml_error.rb
|
619
622
|
- lib/kubes/compiler/strategy/pass.rb
|
@@ -674,6 +677,7 @@ files:
|
|
674
677
|
- lib/templates/new/resource/dsl/config_map.rb
|
675
678
|
- lib/templates/new/resource/dsl/daemon_set.rb
|
676
679
|
- lib/templates/new/resource/dsl/deployment.rb
|
680
|
+
- lib/templates/new/resource/dsl/endpoint.rb
|
677
681
|
- lib/templates/new/resource/dsl/ingress.rb
|
678
682
|
- lib/templates/new/resource/dsl/job.rb
|
679
683
|
- lib/templates/new/resource/dsl/managed_certificate.rb
|
@@ -689,6 +693,7 @@ files:
|
|
689
693
|
- lib/templates/new/resource/yaml/config_map.yaml
|
690
694
|
- lib/templates/new/resource/yaml/daemon_set.yaml
|
691
695
|
- lib/templates/new/resource/yaml/deployment.yaml
|
696
|
+
- lib/templates/new/resource/yaml/endpoint.yaml
|
692
697
|
- lib/templates/new/resource/yaml/ingress.yaml
|
693
698
|
- lib/templates/new/resource/yaml/job.yaml
|
694
699
|
- lib/templates/new/resource/yaml/managed_certificate.yaml
|
@@ -748,7 +753,7 @@ files:
|
|
748
753
|
- spec/kubes/cli/prune_spec.rb
|
749
754
|
- spec/kubes/compiler/decorator/post/deployment_spec.rb
|
750
755
|
- spec/kubes/compiler/decorator/post/pod_spec.rb
|
751
|
-
- spec/kubes/compiler/strategy/
|
756
|
+
- spec/kubes/compiler/strategy/dispatcher_spec.rb
|
752
757
|
- spec/kubes/compiler_spec.rb
|
753
758
|
- spec/kubes/dsl/daemon_set.rb
|
754
759
|
- spec/kubes/dsl/deployment_spec.rb
|
@@ -823,7 +828,7 @@ test_files:
|
|
823
828
|
- spec/kubes/cli/prune_spec.rb
|
824
829
|
- spec/kubes/compiler/decorator/post/deployment_spec.rb
|
825
830
|
- spec/kubes/compiler/decorator/post/pod_spec.rb
|
826
|
-
- spec/kubes/compiler/strategy/
|
831
|
+
- spec/kubes/compiler/strategy/dispatcher_spec.rb
|
827
832
|
- spec/kubes/compiler_spec.rb
|
828
833
|
- spec/kubes/dsl/daemon_set.rb
|
829
834
|
- spec/kubes/dsl/deployment_spec.rb
|