kubes 0.6.5 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +7 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +84 -0
  4. data/.github/ISSUE_TEMPLATE/documentation.md +12 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +64 -0
  6. data/.github/ISSUE_TEMPLATE/question.md +14 -0
  7. data/.github/PULL_REQUEST_TEMPLATE.md +50 -0
  8. data/CHANGELOG.md +16 -0
  9. data/docs/_docs/dsl/multiple-resources.md +19 -21
  10. data/docs/_docs/helpers/google.md +1 -1
  11. data/docs/_docs/helpers/google/gke.md +7 -3
  12. data/docs/_docs/helpers/google/secrets.md +1 -1
  13. data/docs/_docs/intro/concepts.md +8 -9
  14. data/docs/_docs/intro/ordering.md +9 -10
  15. data/docs/_docs/resources/role.md +8 -9
  16. data/docs/_docs/yaml.md +4 -5
  17. data/docs/_docs/yaml/multiple-files.md +22 -0
  18. data/docs/_docs/yaml/multiple-resources.md +89 -0
  19. data/docs/_includes/commands.html +8 -9
  20. data/docs/_includes/config/hooks/options.md +1 -0
  21. data/docs/_includes/layering/layers.md +7 -4
  22. data/docs/_includes/sidebar.html +6 -1
  23. data/docs/_includes/vs/kubes/structure.md +12 -13
  24. data/kubes.gemspec +2 -2
  25. data/lib/kubes/command.rb +1 -1
  26. data/lib/kubes/compiler/dsl/core/base.rb +3 -7
  27. data/lib/kubes/compiler/dsl/core/blocks.rb +5 -1
  28. data/lib/kubes/compiler/dsl/syntax/endpoint.rb +34 -0
  29. data/lib/kubes/compiler/dsl/syntax/resource.rb +0 -1
  30. data/lib/kubes/compiler/layering.rb +3 -7
  31. data/lib/kubes/compiler/shared/runtime_helpers.rb +78 -0
  32. data/lib/kubes/compiler/strategy.rb +1 -15
  33. data/lib/kubes/compiler/strategy/base.rb +0 -56
  34. data/lib/kubes/compiler/strategy/dispatcher.rb +60 -0
  35. data/lib/kubes/compiler/strategy/erb.rb +8 -14
  36. data/lib/kubes/compiler/strategy/result.rb +6 -2
  37. data/lib/kubes/compiler/util/normalize.rb +2 -2
  38. data/lib/kubes/compiler/util/yaml_dump.rb +7 -4
  39. data/lib/kubes/version.rb +1 -1
  40. data/lib/templates/new/resource/dsl/endpoint.rb +3 -0
  41. data/lib/templates/new/resource/yaml/endpoint.yaml +9 -0
  42. data/spec/kubes/compiler/strategy/{dsl_spec.rb → dispatcher_spec.rb} +10 -9
  43. metadata +21 -12
  44. data/lib/kubes/compiler/shared/custom_helpers.rb +0 -17
  45. data/lib/kubes/compiler/shared/custom_variables.rb +0 -38
  46. data/lib/kubes/compiler/shared/plugin_helpers.rb +0 -14
  47. data/lib/kubes/compiler/strategy/dsl.rb +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5e335602466257bfe7751577e3544f5fcdf73e221e5791fd142275295eea548
4
- data.tar.gz: 9172b806b49193341a4399adfd5c9372b1a02437f6bbd3395632a2c81ddebac0
3
+ metadata.gz: f5e5ce606ff32f7d8083b1c8d6bdff1745700ec971ce7bc0a13a72b5ab370e2a
4
+ data.tar.gz: 2ff9e9cee9c77e227157ffd701504baf4831b2ed66678db7a7b5248303bc02cb
5
5
  SHA512:
6
- metadata.gz: 83a7bc9cc35989a17b2960a7a931295d767f2454006eb696b476fed193a7973066a51a4f0e7309bea99b1fdebca71482ee646ab122820c6ae9e5570edb5cc367
7
- data.tar.gz: d7baee331717cdab66b8dbf028c97fbc9c3e973a87a9497fdeccd5f1195a8af06193586b8075f4b29ea94910b7d55c12d35d07234391596c76be83da1081e294
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,22 @@
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
+
10
+ ## [0.7.0] - 2020-11-16
11
+ - [#41](https://github.com/boltops-tools/kubes/pull/41) multiple resources yaml support
12
+
13
+ ## [0.6.8] - 2020-11-14
14
+ - [#40](https://github.com/boltops-tools/kubes/pull/40) fix version check
15
+
16
+ ## [0.6.7] - 2020-11-12
17
+ - dependencies version bump: kubes_google
18
+
19
+ ## [0.6.6] - 2020-11-12
20
+ - dependencies version bump: kubes_aws and kubes_google
21
+
6
22
  ## [0.6.5] - 2020-11-12
7
23
  - [#39](https://github.com/boltops-tools/kubes/pull/39) google secrets fetcher option
8
24
 
@@ -1,14 +1,13 @@
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:
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
 
@@ -35,7 +33,7 @@ deployment-2.rb | Deployment
35
33
  service-1.rb | Service
36
34
  service-2.rb | Service
37
35
 
38
- Using multiple files is the general recommended approach.
36
+ Using multiple files is the general recommended approach when using the DSL.
39
37
 
40
38
  ## Multiple Resources: Block Form
41
39
 
@@ -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,9 @@ 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 with the simple form only merge with other simple form layers.
90
- * The layering definitions for block forms only merge with other block form layers.
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.
88
+ * Resources in the main "middle" layer are the only ones that are allowed multiple resource definitions.
91
89
 
92
90
  Simple form layering:
93
91
 
@@ -105,8 +103,8 @@ Block form layering:
105
103
 
106
104
  .kubes/resources/
107
105
  ├── base
108
- │ ├── alls.rb
109
- │ └── deployments.rb
106
+ │ ├── all.rb
107
+ │ └── deployment.rb
110
108
  └── web
111
109
  ├── deployments
112
110
  │ ├── dev.rb
@@ -4,7 +4,7 @@ title: Google Helpers
4
4
 
5
5
  List of Google helpers:
6
6
 
7
- {% assign docs = site.docs | where: "categories","helpers-aws" %}
7
+ {% assign docs = site.docs | where: "categories","helpers-google" %}
8
8
  {% for doc in docs -%}
9
9
  * [{{ doc.nav_text }}]({{ doc.url }})
10
10
  {% endfor %}
@@ -19,14 +19,18 @@ KubesGoogle.configure do |config|
19
19
  config.gke.cluster_name = "dev-cluster"
20
20
  config.gke.google_region = ENV['GOOGLE_REGION']
21
21
  config.gke.google_project = ENV['GOOGLE_PROJECT']
22
- config.gke.enable_get_credentials = true # enable hook to call: gcloud container clusters get-credentials
22
+ config.gke.enable_hooks = KubesGoogle.cloudbuild?
23
+ config.gke.enable_get_credentials = KubesGoogle.cloudbuild? # enable hook to call: gcloud container clusters get-credentials
23
24
  end
24
25
  ```
25
26
 
26
- Note: The use of `KubesGoogle.configure` instead of `Kubes.configure` here.
27
-
28
27
  This enables `kubes apply` before and after hooks to add and remove the current machine IP.
29
28
 
29
+ Notes:
30
+
31
+ * Notice the use of `KubesGoogle.configure` instead of `Kubes.configure` here.
32
+ * The `KubesGoogle.cloudbuild?` checks if kubes is running on a CloudBuild machine. So hooks don't run locally on your machine.
33
+
30
34
  ## Options
31
35
 
32
36
  Here are the `config.gke` settings:
@@ -63,7 +63,7 @@ By default, the values are automatically base64 encoded. You can change the defa
63
63
 
64
64
  ```ruby
65
65
  KubesGoogle.configure do |config|
66
- config.secrets.base64 = true
66
+ config.secrets.base64 = false
67
67
  end
68
68
  ```
69
69
 
@@ -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