kubes 0.7.0 → 0.7.1

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: c708370f432e482b105a766bd174dd52f89c790256ea91063a8045af1d970f39
4
- data.tar.gz: 3b4aef7f7450776cf35b9db54ff7d326a6444e948ab7cf81fac1a7659fca9649
3
+ metadata.gz: f5e5ce606ff32f7d8083b1c8d6bdff1745700ec971ce7bc0a13a72b5ab370e2a
4
+ data.tar.gz: 2ff9e9cee9c77e227157ffd701504baf4831b2ed66678db7a7b5248303bc02cb
5
5
  SHA512:
6
- metadata.gz: f157bfaa51b24e2f23327ab02075abdeb331564c28cdcbe0710eeefb8ba2cd7910ea2719e28e1cdedb3b5b2873be902734c27254089ba5e1bc4083e13d33a10f
7
- data.tar.gz: 48594a55badaba62e2ef7cfe436bc32640a5723221278f7d42c307144a00c300ca9a9c07d1501bc9a10204ff629929272171d8a4fc1cfe878b91bc951f46ba96
6
+ metadata.gz: 5af79490b1ce56d61a08fcbd2d4c05d442d0b965a030c9ef3a95b74b8276a368065b9d3d340344920e2b5a38e77161be904b11755c55a17e351ce04b891f7725
7
+ data.tar.gz: cd83c382860483bbbb9c3a4d462def4e8551dc80a8453d171918190bcd82f9cdd4bef351cbaa1a8222cd1dd3ad6e53d128d279a23cee03636142104b6b923192
@@ -0,0 +1,7 @@
1
+ Please fill out one of the templates on https://github.com/boltops-tools/kubes/issues/new/choose
2
+
3
+ If you want to ask a question please do so on sites like StackOverflow.
4
+
5
+ To be sensitive to everyone's time, we may close issues asking questions without comment. Here are some additional options also https://kubes.guru/support/ 👌
6
+
7
+ Thank you!
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: Reproducible Bug Report
3
+ about: Is something not working as expected?
4
+ title: ''
5
+ labels: 'bug'
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ <!--
11
+ Hi! Thanks for considering to file a bug with Kubes. Please take the time to
12
+ answer the basic questions. Please try to be as detailed as possible.
13
+ To be sensitive to everyone's time, if not enough details are provided, the
14
+ issue may be closed without comment. If you repeatedly fail to provide enough
15
+ details, you may be blocked from ever submitting issues to Kubes again.
16
+ Please use your best judgment. 👍
17
+
18
+ If you are unsure this is a bug in Kubes, please consider asking your question at sites like StackOverflow.
19
+
20
+ Thanks!
21
+ -->
22
+
23
+ ## Checklist
24
+
25
+ <!--
26
+ Make sure that you've done all of these. To mark a checkbox done, replace [ ] with [x]. Or after you create the issue you can click the checkbox.
27
+ -->
28
+
29
+ - [ ] Upgrade Kubes: Are you using the latest version of Kubes? This allows Kubes to fix issues fast.
30
+ - [ ] Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on StackOverflow.
31
+ - [ ] Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.
32
+
33
+ ## My Environment
34
+
35
+ <!-- Please fill out the table below with debugging info to help: -->
36
+
37
+ | Software | Version |
38
+ | ---------------- | ------- |
39
+ | Operating System | |
40
+ | Kubes | |
41
+ | kubectl | |
42
+ | Ruby | |
43
+
44
+ ---
45
+
46
+ ## Expected Behaviour
47
+
48
+ <!--
49
+ What is it you expected to happen? This should be a description of how the functionality you tried to use is supposed to work. Try to keep this to one-paragraph.
50
+ -->
51
+
52
+ ## Current Behavior
53
+
54
+ <!--
55
+ Describe the details of the bug. Try to keep this to one-paragraph.
56
+ -->
57
+
58
+ ## Step-by-step reproduction instructions
59
+
60
+ <!--
61
+ Be sure to include any steps you took for the problem to exist. This is likely the longest part of the report.
62
+
63
+ Please include any logs you think relevant here. If the logs are long (more than 50 lines) please make a gist of the logs and link to it. https://gist.github.com
64
+
65
+ With long logs, you can also use the <details> tag to keep the report readable. Example:
66
+
67
+ <details>
68
+ <summary>Summary Goes Here</summary>
69
+
70
+ ...this is hidden, collapsable content. start with a blank line to get terminal output to format right...
71
+ </details>
72
+ -->
73
+
74
+ ## Code Sample
75
+
76
+ <!--
77
+ Please provide a code repository, gist, code snippet or sample files to reproduce the issue.
78
+ -->
79
+
80
+ ## Solution Suggestion
81
+
82
+ <!--
83
+ Please provide possible solutions. If you can't think of anything, feel free to omit. Please be kind and add helpful possible solutions. For example, "Fix it!" is not a helpful solution suggestion. We are mere mortals. Please be constructive.
84
+ -->
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: Documentation
3
+ about: Found a typo or something that isn't crystal clear in the docs?
4
+ title: ''
5
+ labels: docs
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ The Kubes Docs are in the [kubes repo](https://github.com/boltops-tools/kubes/tree/master/docs). Please submit a PR there. Thanks!
11
+
12
+ For documentation changes to the kubes code base itself, like code comments. Please submit a PR here. Thanks!
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: New Feature Suggestion
3
+ about: Want to add a feature to Kubes?
4
+ title: ''
5
+ labels: feature
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ <!--
11
+ Hi! Thanks for considering to file a feature request with Kubes. Please take the time to answer the basic questions. Please try to be as detailed as possible.
12
+
13
+ Thanks!
14
+ -->
15
+
16
+ ## Summary
17
+
18
+ <!--
19
+ A one-paragraph explanation of the feature.
20
+ -->
21
+
22
+ ## Motivation
23
+
24
+ <!--
25
+ Why do you want to see this feature in Kubes? What use cases does it support?
26
+
27
+ How the feature would be relevant to 80% or more of Kubes users.
28
+ -->
29
+
30
+ ## Guide-level explanation
31
+
32
+ <!--
33
+ Explain the proposal as if it was already included in the project and you were teaching it to another programmer. That generally means:
34
+
35
+ - Introducing new named concepts.
36
+ - Explaining the feature largely in terms of examples.
37
+ - If applicable, provide sample error messages, deprecation warnings, or upgrade guidance.
38
+
39
+ If this is a small feature, you may omit this section.
40
+ -->
41
+
42
+ ## Reference-level explanation
43
+
44
+ <!--
45
+ This is the technical portion of the feature request. Explain the design in sufficient detail that:
46
+
47
+ - Its interaction with other features is clear.
48
+ - It is reasonably clear how the feature would be implemented.
49
+ - Corner cases are dissected by example.
50
+
51
+ If you do not know how to answer this, you can omit it. No worries!
52
+ -->
53
+
54
+ ## Drawbacks
55
+
56
+ <!--
57
+ Why should we *not* do this?
58
+ -->
59
+
60
+ ## Unresolved Questions
61
+
62
+ <!--
63
+ What related issues do you consider out of scope for this feature that could be addressed in the future independently of the solution that comes out of this feature?
64
+ -->
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: Question
3
+ about: Have any questions about how Kubes works?
4
+ title: ''
5
+ labels: 'question'
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ The Kubes issue tracker IS NOT for usage questions! Please post your question at sites like StackOverflow.
11
+
12
+ To be sensitive to everyone's time, we may close issues asking questions without comment. If you repeatedly post questions in the issues tracker, you may be blocked from ever submitting issues to Kubes again. Please use your best judgment. 👍
13
+
14
+ Here are some additional options also https://kubes.guru/support/ 😁
@@ -0,0 +1,50 @@
1
+ <!--
2
+ Thanks for creating a Pull Request! Before you submit, please make sure you've done the following:
3
+
4
+ - I read the contributing document at https://kubes.guru/docs/contributing/
5
+ -->
6
+
7
+ <!--
8
+ Make our lives easier! Choose one of the following by uncommenting it:
9
+ -->
10
+
11
+ <!-- This is a 🐞 bug fix. -->
12
+ <!-- This is a 🙋‍♂️ feature or enhancement. -->
13
+ <!-- This is a 🧐 documentation change. -->
14
+
15
+ <!--
16
+ Before you submit this pull request, make sure to have a look at the following checklist. To mark a checkbox done, replace [ ] with [x]. Or after you create the issue you can click the checkbox.
17
+
18
+ If you don't know how to do some of these, that's fine! Submit your pull request and we will help you out on the way.
19
+ -->
20
+
21
+ - [ ] I've added tests (if it's a bug, feature or enhancement)
22
+ - [ ] I've adjusted the documentation (if it's a feature or enhancement)
23
+ - [ ] The test suite passes (run `bundle exec rspec` to verify this)
24
+
25
+ ## Summary
26
+
27
+ <!--
28
+ Provide a description of what your pull request changes.
29
+ -->
30
+
31
+ ## Context
32
+
33
+ <!--
34
+ Is this related to any GitHub issue(s) or another relevant link?
35
+ -->
36
+
37
+ ## How to Test
38
+
39
+ <!--
40
+ Please provide instructions on how to test the fix. This speeds up reviewing the PR. If testing requires a demo Kubes project, please provide an example repo.
41
+ -->
42
+
43
+
44
+ ## Version Changes
45
+
46
+ <!--
47
+ Which semantic version change would you recommend?
48
+ If you don't know, feel free to omit it.
49
+ -->
50
+
@@ -3,6 +3,10 @@
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.1] - 2020-11-16
7
+ - [#42](https://github.com/boltops-tools/kubes/pull/42) load helpers for dsl properly
8
+ - fix merge layer
9
+
6
10
  ## [0.7.0] - 2020-11-16
7
11
  - [#41](https://github.com/boltops-tools/kubes/pull/41) multiple resources yaml support
8
12
 
@@ -4,11 +4,10 @@ title: DSL Multiple Resources
4
4
 
5
5
  Kubes encourages a structure with files that matches the resource kind. Example:
6
6
 
7
- .kubes
8
- └── resources
9
- └── web
10
- ├── deployment.rb
11
- └── service.rb
7
+ .kubes/resources
8
+ └── web
9
+ ├── deployment.rb
10
+ └── service.rb
12
11
 
13
12
  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
13
 
@@ -18,13 +17,12 @@ Next, we'll cover different ways to create multiple resource of the same kinds.
18
17
 
19
18
  You can create multiple resources of same kind by appending a dash followed by anything. Example:
20
19
 
21
- .kubes
22
- └── resources
23
- └── web
24
- ├── deployment-1.rb
25
- ├── deployment-2.rb
26
- ├── service-1.rb
27
- └── service-2.rb
20
+ .kubes/resources
21
+ └── web
22
+ ├── deployment-1.rb
23
+ ├── deployment-2.rb
24
+ ├── service-1.rb
25
+ └── service-2.rb
28
26
 
29
27
  Only words before the dash are used to infer the resource kind.
30
28
 
@@ -43,9 +41,8 @@ You can also use a block form to create multiple resources. The multiple resour
43
41
 
44
42
  You name the resource files with plural names. An example helps explain:
45
43
 
46
- .kubes
47
- └── resources
48
- └── deployments.rb
44
+ .kubes/resources
45
+ └── deployments.rb
49
46
 
50
47
  .kubes/resources/web/deployments.rb
51
48
 
@@ -86,8 +83,8 @@ You can declare deployment, service, and other resource kinds multiple times.
86
83
 
87
84
  Layering works for both simple and block form. Just create a folder with the corresponding name.
88
85
 
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.
86
+ * The layering definitions for the pre layers are in singular form.
87
+ * The layering definitions for the post layers are in a folder with plural form, but the overrides are defined in singular form still.
91
88
  * Resources in the main "middle" layer are the only ones that are allowed multiple resource definitions.
92
89
 
93
90
  Simple form layering:
@@ -6,15 +6,14 @@ title: Kubes Concepts
6
6
 
7
7
  The `.kubes/resources` where you organized Kubernetes resources. Different subfolders within the resources folder represent your app. Example:
8
8
 
9
- .kubes
10
- └── resources
11
- ├── clock
12
- │ └── deployment.yaml
13
- ├── worker
14
- └── deployment.yaml
15
- └── web
16
- ├── deployment.yaml
17
- └── service.yaml
9
+ .kubes/resources
10
+ ├── clock
11
+ │ └── deployment.yaml
12
+ ├── worker
13
+ │ └── deployment.yaml
14
+ └── web
15
+ ├── deployment.yaml
16
+ └── service.yaml
18
17
 
19
18
  Each folder contains your Kubernetes deployment definition, either in [YAML]({% link _docs/yaml.md %}) or [DSL]({% link _docs/dsl.md %}) form. Both can be used together.
20
19
 
@@ -37,16 +37,15 @@ Kubes will delete in the reverse order.
37
37
 
38
38
  Resources in the `shared` folder will be applied first. Example:
39
39
 
40
- .kubes
41
- └── resources
42
- ├── clock
43
- │ └── deployment.yaml
44
- ├── web
45
- ├── deployment.yaml
46
- └── service.yaml
47
- └── shared
48
- ├── config_map.yaml
49
- └── secret.yaml
40
+ .kubes/resources
41
+ ├── clock
42
+ │ └── deployment.yaml
43
+ ├── web
44
+ ├── deployment.yaml
45
+ └── service.yaml
46
+ └── shared
47
+ ├── config_map.yaml
48
+ └── secret.yaml
50
49
 
51
50
  Results in:
52
51
 
@@ -8,15 +8,14 @@ Role-based resources are your main project's resources. Kubes groups resources
8
8
 
9
9
  Here's an example structure to help explain how role-based resources work.
10
10
 
11
- .kubes
12
- └── resources
13
- ├── clock
14
- │ └── deployment.yaml
15
- ├── web
16
- ├── deployment.yaml
17
- └── service.yaml
18
- └── worker
19
- └── deployment.yaml
11
+ .kubes/resources
12
+ ├── clock
13
+ │ └── deployment.yaml
14
+ ├── web
15
+ ├── deployment.yaml
16
+ └── service.yaml
17
+ └── worker
18
+ └── deployment.yaml
20
19
 
21
20
  ## Resource Roles
22
21
 
@@ -4,11 +4,10 @@ title: Kubes YAML
4
4
 
5
5
  You can write your Kubernetes resources in YAML format.
6
6
 
7
- .kubes
8
- └── resources
9
- └── web
10
- ├── deployment.yaml
11
- └── service.yaml
7
+ .kubes/resources
8
+ └── web
9
+ ├── deployment.yaml
10
+ └── service.yaml
12
11
 
13
12
  ## YAML and Templating
14
13
 
@@ -4,13 +4,12 @@ title: YAML Multiple Resources with Multiple Files
4
4
 
5
5
  You can also create multiple resources of same kind by appending a dash followed by anything. Example:
6
6
 
7
- .kubes
8
- └── resources
9
- └── web
10
- ├── deployment-1.yaml
11
- ├── deployment-2.yaml
12
- ├── service-1.yaml
13
- └── service-2.yaml
7
+ .kubes/resources
8
+ └── web
9
+ ├── deployment-1.yaml
10
+ ├── deployment-2.yaml
11
+ ├── service-1.yaml
12
+ └── service-2.yaml
14
13
 
15
14
  Only words before the dash are used to infer the resource kind.
16
15
 
@@ -4,11 +4,10 @@ title: YAML Multiple Resources
4
4
 
5
5
  Kubes encourages a structure with files that matches the resource kind. Example:
6
6
 
7
- .kubes
8
- └── resources
9
- └── web
10
- ├── deployment.yaml
11
- └── service.yaml
7
+ .kubes/resources
8
+ └── web
9
+ ├── deployment.yaml
10
+ └── service.yaml
12
11
 
13
12
  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
13
 
@@ -18,8 +17,8 @@ Next, we'll cover how to create multiple resource of the same kinds.
18
17
 
19
18
  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
19
 
21
- .kubes
22
- └── resources
20
+ .kubes/resources
21
+ └── web
23
22
  └── deployments.yaml
24
23
 
25
24
  .kubes/resources/web/deployments.yaml
@@ -72,19 +71,19 @@ Layering works just fine with multiple resource definitions. The layering is pro
72
71
  Notes:
73
72
 
74
73
  * 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.
74
+ * The layering definitions for the post layers must be in a folder with plural form, but define a singular resource override.
76
75
  * Resources in the main "middle" layer is the only one that allows for multiple resource definitions.
77
76
 
78
77
  Multiple resources layering structure.
79
78
 
80
79
  .kubes/resources/
81
80
  ├── base
82
- │ ├── all.rb
81
+ │ ├── all.rb # SINGULAR
83
82
  │ └── deployment.rb # SINGULAR
84
83
  └── web
85
84
  ├── deployments # PLURAL
86
- │ ├── dev.rb
87
- │ └── prod.rb
85
+ │ ├── dev.rb # SINGULAR
86
+ │ └── prod.rb # SINGULAR
88
87
  └── deployments.rb # PLURAL
89
88
 
90
89
  The main difference is the pluralized filenames.
@@ -30,15 +30,14 @@ kubes delete -y
30
30
  <h3>Structure</h3>
31
31
  <div class="commands">
32
32
  {% highlight sh %}
33
- .kubes
34
- └── resources
35
- ├── clock
36
- │ └── deployment.yaml
37
- ├── worker
38
- └── deployment.yaml
39
- └── web
40
- ├── deployment.yaml
41
- └── service.yaml
33
+ .kubes/resources
34
+ ├── clock
35
+ │ └── deployment.yaml
36
+ ├── worker
37
+ │ └── deployment.yaml
38
+ └── web
39
+ ├── deployment.yaml
40
+ └── service.yaml
42
41
  {% endhighlight %}
43
42
  </div>
44
43
  </div>
@@ -2,19 +2,18 @@
2
2
 
3
3
  On the other hand, Kubes defines a conventional project structure. Here's a project directory example:
4
4
 
5
- .kubes
6
- └── resources
7
- ├── base
8
- ├── all.yaml
9
- │ └── deployment.yaml
10
- ├── shared
11
- └── namespace.yaml
12
- └── web
13
- ├── deployment
14
- ├── dev.yaml
15
- │ └── prod.yaml
16
- ├── deployment.yaml
17
- └── service.yaml
5
+ .kubes/resources
6
+ ├── base
7
+ ├── all.yaml
8
+ └── deployment.yaml
9
+ ├── shared
10
+ │ └── namespace.yaml
11
+ └── web
12
+ ├── deployment
13
+ ├── dev.yaml
14
+ └── prod.yaml
15
+ ├── deployment.yaml
16
+ └── service.yaml
18
17
 
19
18
  A Kubes project structure also supports introduces a role concept or folder. The folder structure only shows a web role for simplicity. You can always add more roles. For example:
20
19
 
@@ -3,17 +3,13 @@ module Kubes::Compiler::Dsl::Core
3
3
  extend Fields
4
4
  include DslEvaluator
5
5
  include Helpers
6
- include Kubes::Compiler::Shared::CustomHelpers
7
- include Kubes::Compiler::Shared::CustomVariables
8
- include Kubes::Compiler::Shared::PluginHelpers
6
+ include Kubes::Compiler::Shared::RuntimeHelpers
9
7
 
10
8
  def initialize(options={})
11
9
  @options = options
12
10
  @name = options[:name]
13
11
  @path = options[:path]
14
- load_plugin_helpers
15
- load_custom_variables
16
- load_custom_helpers
12
+ load_runtime_helpers
17
13
  end
18
14
 
19
15
  def run
@@ -1,7 +1,6 @@
1
1
  module Kubes::Compiler::Dsl::Syntax
2
2
  class Resource < Kubes::Compiler::Dsl::Core::Base
3
3
  include Kubes::Compiler::Util::Normalize
4
- include Kubes::Compiler::Shared::Helpers
5
4
 
6
5
  fields :apiVersion, # <string>
7
6
  :kind, # <string>
@@ -0,0 +1,78 @@
1
+ module Kubes::Compiler::Shared
2
+ module RuntimeHelpers
3
+ include Kubes::Compiler::Shared::Helpers
4
+
5
+ def load_runtime_helpers
6
+ load_custom_variables # also load custom variables
7
+ load_plugin_helpers
8
+ load_custom_helpers
9
+ end
10
+
11
+ @@custom_helpers_loaded = false
12
+ def load_custom_helpers
13
+ return if @@custom_helpers_loaded
14
+ paths = Dir.glob("#{Kubes.root}/.kubes/helpers/**/*.rb")
15
+ paths.sort_by! { |p| p.size } # so namespaces are loaded first
16
+
17
+ paths.each do |path|
18
+ filename = path.sub(%r{.*.kubes/helpers/},'').sub('.rb','')
19
+ module_name = filename.camelize
20
+ base_class_for_helper.send :include, module_name.constantize
21
+ end
22
+ @@custom_helpers_loaded = true
23
+ end
24
+
25
+ # Load plugin helper methods from project
26
+ @@plugin_helpers_loaded = false
27
+ def load_plugin_helpers
28
+ return if @@plugin_helpers_loaded
29
+ Kubes::Plugin.plugins.each do |klass|
30
+ helpers_class = "#{klass}::Helpers".constantize # IE: KubesAws::Helpers
31
+ base_class_for_helper.send :include, helpers_class
32
+ end
33
+ @@plugin_helpers_loaded = true
34
+ end
35
+
36
+ def base_class_for_helper
37
+ if self.is_a?(Kubes::Compiler::Strategy::Erb)
38
+ Kubes::Compiler::Strategy::Erb
39
+ else
40
+ Kubes::Compiler::Dsl::Core::Base
41
+ end
42
+ end
43
+
44
+ include DslEvaluator
45
+ # Load custom variables from project
46
+ @@custom_variables_loaded = false
47
+ def load_custom_variables
48
+ return if Kubes.kustomize?
49
+
50
+ ext = File.extname(@path)
51
+ role = @path.sub(%r{.*\.kubes/resources/},'').sub(ext,'').split('/').first # IE: web
52
+ kind = File.basename(@path).sub(ext,'') # IE: deployment
53
+ all = "all"
54
+ if @block_form
55
+ kind = kind.pluralize
56
+ all = all.pluralize
57
+ end
58
+
59
+ layers = [
60
+ "base.rb",
61
+ "#{Kubes.env}.rb",
62
+ "base/all.rb",
63
+ "base/all/#{Kubes.env}.rb",
64
+ "base/#{kind}.rb",
65
+ "base/#{kind}/base.rb",
66
+ "base/#{kind}/#{Kubes.env}.rb",
67
+ "#{role}/#{kind}.rb",
68
+ "#{role}/#{kind}/base.rb",
69
+ "#{role}/#{kind}/#{Kubes.env}.rb",
70
+ ]
71
+
72
+ layers.each do |layer|
73
+ path = "#{Kubes.root}/.kubes/variables/#{layer}"
74
+ evaluate_file(path)
75
+ end
76
+ end
77
+ end
78
+ end
@@ -52,7 +52,8 @@ class Kubes::Compiler::Strategy
52
52
 
53
53
  def merge_layers(layers)
54
54
  layers.inject({}) do |hash, layer|
55
- render(layer)
55
+ data = render(layer)
56
+ hash.deep_merge!(data)
56
57
  end
57
58
  end
58
59
  end
@@ -5,18 +5,13 @@ class Kubes::Compiler::Strategy
5
5
  extend Kubes::Compiler::Dsl::Core::Fields
6
6
  include Kubes::Compiler::Dsl::Core::Helpers
7
7
  include Kubes::Compiler::Layering
8
- include Kubes::Compiler::Shared::CustomHelpers
9
- include Kubes::Compiler::Shared::CustomVariables
10
- include Kubes::Compiler::Shared::Helpers
11
- include Kubes::Compiler::Shared::PluginHelpers
8
+ include Kubes::Compiler::Shared::RuntimeHelpers
12
9
 
13
10
  def initialize(options={})
14
11
  super
15
12
  # For ERB scope is in this same Strategy::Erb class
16
13
  # For DSL scope is within the each for the Resource classes. IE: kubes/compile/dsl/core/base.rb
17
- load_plugin_helpers
18
- load_custom_variables
19
- load_custom_helpers
14
+ load_runtime_helpers
20
15
  end
21
16
 
22
17
  def render_result(path)
@@ -1,3 +1,3 @@
1
1
  module Kubes
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
@@ -244,6 +244,12 @@ extra_rdoc_files: []
244
244
  files:
245
245
  - ".dockerignore"
246
246
  - ".gcloudignore"
247
+ - ".github/ISSUE_TEMPLATE.md"
248
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
249
+ - ".github/ISSUE_TEMPLATE/documentation.md"
250
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
251
+ - ".github/ISSUE_TEMPLATE/question.md"
252
+ - ".github/PULL_REQUEST_TEMPLATE.md"
247
253
  - ".gitignore"
248
254
  - ".rspec"
249
255
  - CHANGELOG.md
@@ -609,11 +615,9 @@ files:
609
615
  - lib/kubes/compiler/dsl/syntax/service.rb
610
616
  - lib/kubes/compiler/dsl/syntax/service_account.rb
611
617
  - lib/kubes/compiler/layering.rb
612
- - lib/kubes/compiler/shared/custom_helpers.rb
613
- - lib/kubes/compiler/shared/custom_variables.rb
614
618
  - lib/kubes/compiler/shared/helpers.rb
615
619
  - lib/kubes/compiler/shared/helpers/deprecated.rb
616
- - lib/kubes/compiler/shared/plugin_helpers.rb
620
+ - lib/kubes/compiler/shared/runtime_helpers.rb
617
621
  - lib/kubes/compiler/strategy.rb
618
622
  - lib/kubes/compiler/strategy/base.rb
619
623
  - lib/kubes/compiler/strategy/dispatcher.rb
@@ -1,17 +0,0 @@
1
- module Kubes::Compiler::Shared
2
- module CustomHelpers
3
- # Load custom helper methods from project
4
- @@custom_helpers_loaded = false
5
- def load_custom_helpers
6
- return if @@custom_helpers_loaded
7
- paths = Dir.glob("#{Kubes.root}/.kubes/helpers/**/*.rb")
8
- paths.sort_by! { |p| p.size } # so namespaces are loaded first
9
- paths.each do |path|
10
- filename = path.sub(%r{.*.kubes/helpers/},'').sub('.rb','')
11
- module_name = filename.camelize
12
- self.class.send :include, module_name.constantize
13
- end
14
- @@custom_helpers_loaded = true
15
- end
16
- end
17
- end
@@ -1,38 +0,0 @@
1
- module Kubes::Compiler::Shared
2
- module CustomVariables
3
- include DslEvaluator
4
-
5
- # Load custom variables from project
6
- @@custom_variables_loaded = false
7
- def load_custom_variables
8
- return if Kubes.kustomize?
9
-
10
- ext = File.extname(@path)
11
- role = @path.sub(%r{.*\.kubes/resources/},'').sub(ext,'').split('/').first # IE: web
12
- kind = File.basename(@path).sub(ext,'') # IE: deployment
13
- all = "all"
14
- if @block_form
15
- kind = kind.pluralize
16
- all = all.pluralize
17
- end
18
-
19
- layers = [
20
- "base.rb",
21
- "#{Kubes.env}.rb",
22
- "base/all.rb",
23
- "base/all/#{Kubes.env}.rb",
24
- "base/#{kind}.rb",
25
- "base/#{kind}/base.rb",
26
- "base/#{kind}/#{Kubes.env}.rb",
27
- "#{role}/#{kind}.rb",
28
- "#{role}/#{kind}/base.rb",
29
- "#{role}/#{kind}/#{Kubes.env}.rb",
30
- ]
31
-
32
- layers.each do |layer|
33
- path = "#{Kubes.root}/.kubes/variables/#{layer}"
34
- evaluate_file(path)
35
- end
36
- end
37
- end
38
- end
@@ -1,14 +0,0 @@
1
- module Kubes::Compiler::Shared
2
- module PluginHelpers
3
- # Load plugin helper methods from project
4
- @@plugin_helpers_loaded = false
5
- def load_plugin_helpers
6
- return if @@plugin_helpers_loaded
7
- Kubes::Plugin.plugins.each do |klass|
8
- helpers_class = "#{klass}::Helpers".constantize # IE: KubesAws::Helpers
9
- self.class.send :include, helpers_class
10
- end
11
- @@plugin_helpers_loaded = true
12
- end
13
- end
14
- end