kubes 0.7.8 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/docs/.gitignore +1 -0
  4. data/docs/Gemfile +2 -0
  5. data/docs/_config.yml +8 -0
  6. data/docs/_docs/config/app-overrides.md +7 -0
  7. data/docs/_docs/config/boot.md +46 -0
  8. data/docs/_docs/config/env.md +29 -2
  9. data/docs/_docs/config/hooks/docker.md +2 -0
  10. data/docs/_docs/config/hooks/generator.md +16 -0
  11. data/docs/_docs/config/hooks/kubectl.md +2 -0
  12. data/docs/_docs/config/hooks/kubes.md +2 -0
  13. data/docs/_docs/config/reference.md +2 -2
  14. data/docs/_docs/config/skip.md +22 -0
  15. data/docs/_docs/helpers/aws/iam-role.md +1 -0
  16. data/docs/_docs/helpers/google/gke.md +1 -1
  17. data/docs/_docs/install/dependencies.md +18 -0
  18. data/docs/_docs/install/gem.md +6 -0
  19. data/docs/_docs/install/standalone/centos.md +70 -0
  20. data/docs/_docs/install/standalone/details/permissions.md +44 -0
  21. data/docs/_docs/install/standalone/details/uninstall.md +16 -0
  22. data/docs/_docs/install/standalone/details.md +20 -0
  23. data/docs/_docs/install/standalone/macosx.md +45 -0
  24. data/docs/_docs/install/standalone/ubuntu.md +48 -0
  25. data/docs/_docs/install/standalone.md +43 -0
  26. data/docs/_docs/install.md +8 -0
  27. data/docs/_docs/learn/dsl/install.md +1 -1
  28. data/docs/_docs/learn/yaml/install.md +1 -1
  29. data/docs/_docs/patterns/central-deployer.md +38 -0
  30. data/docs/_docs/variables/advanced.md +32 -1
  31. data/docs/_docs/variables/basic.md +1 -0
  32. data/docs/_docs/vs/custom.md +2 -0
  33. data/docs/_docs/vs/helm.md +2 -0
  34. data/docs/_docs/vs/kustomize.md +3 -1
  35. data/docs/_docs/vs.md +2 -0
  36. data/docs/_docs/yaml/erb-comment.md +89 -0
  37. data/docs/_includes/banner/foot.html +2 -0
  38. data/docs/_includes/banner/head.html +5 -0
  39. data/docs/_includes/config/app-overrides-cheatsheet.md +44 -0
  40. data/docs/_includes/config/hooks/generator.md +6 -0
  41. data/docs/_includes/content.html +1 -1
  42. data/docs/_includes/install/gem.md +7 -0
  43. data/docs/_includes/install/wrapper.md +9 -0
  44. data/docs/_includes/layering/layers.md +3 -0
  45. data/docs/_includes/learn/next-steps.md +11 -0
  46. data/docs/_includes/sidebar.html +28 -3
  47. data/docs/_includes/videos/learn/vs.md +4 -0
  48. data/docs/_includes/videos/learn.md +12 -0
  49. data/docs/_includes/videos/youtube.md +1 -0
  50. data/docs/_layouts/default.html +3 -0
  51. data/docs/_reference/kubes-new-hook.md +30 -0
  52. data/docs/_reference/kubes-new-variable.md +7 -0
  53. data/docs/_reference/kubes-new.md +1 -0
  54. data/docs/_sass/theme.scss +11 -0
  55. data/docs/bin/web +1 -1
  56. data/docs/js/scripts.js +7 -0
  57. data/kubes.gemspec +1 -0
  58. data/lib/kubes/booter.rb +26 -0
  59. data/lib/kubes/cli/help/new/hook.md +9 -0
  60. data/lib/kubes/cli/help/new/variable.md +6 -0
  61. data/lib/kubes/cli/init.rb +0 -1
  62. data/lib/kubes/cli/new/hook.rb +18 -0
  63. data/lib/kubes/cli/new.rb +4 -0
  64. data/lib/kubes/command.rb +1 -1
  65. data/lib/kubes/compiler/decorator/hashable.rb +1 -1
  66. data/lib/kubes/compiler/layering.rb +9 -0
  67. data/lib/kubes/compiler/shared/runtime_helpers.rb +8 -1
  68. data/lib/kubes/compiler/strategy/erb/comment.rb +46 -0
  69. data/lib/kubes/compiler/strategy/erb.rb +4 -0
  70. data/lib/kubes/compiler/strategy/result.rb +13 -1
  71. data/lib/kubes/compiler.rb +2 -0
  72. data/lib/kubes/config.rb +6 -2
  73. data/lib/kubes/core.rb +4 -0
  74. data/lib/kubes/kubectl/ordering.rb +9 -6
  75. data/lib/kubes/version.rb +1 -1
  76. data/lib/kubes.rb +3 -0
  77. data/lib/templates/new/hooks/docker.rb +9 -0
  78. data/lib/templates/new/hooks/kubectl.rb +11 -0
  79. data/lib/templates/new/hooks/kubes.rb +9 -0
  80. data/lib/templates/yaml/.kubes/resources/base/deployment.yaml.tt +2 -0
  81. data/spec/kubes/compiler/decorator/post/deployment_spec.rb +1 -1
  82. metadata +51 -5
  83. data/docs/_docs/intro/install.md +0 -6
  84. data/docs/_includes/intro/install.md +0 -19
@@ -2,6 +2,7 @@
2
2
  title: Advanced Variables
3
3
  nav_text: Advanced
4
4
  categories: variables
5
+ order: 2
5
6
  ---
6
7
 
7
8
  Basic variables layering should provides enough flexibility and is generally recommended. This page covers more advanced variables layering.
@@ -44,12 +45,26 @@ And when `KUBES_ENV=prod`:
44
45
 
45
46
  With advanced layering you can target a specific role and kind. So variables are only scoped to the resources you want.
46
47
 
48
+ ## App-Level Overrides
49
+
50
+ If KUBES_APP is set, then app level layer overrides will also be processed. Example:
51
+
52
+ KUBES_APP=app1 kubes deploy
53
+
54
+ Here's an example with some of the additional files that get layered:
55
+
56
+ .kubes/variables/app1.rb
57
+ .kubes/variables/app1/base.rb
58
+ .kubes/variables/app1/dev.rb
59
+
60
+ This is useful if you're using kubes as part of a central deployer pattern. For the full list of layers refer to the table below:
61
+
47
62
  ## Full Layering Table
48
63
 
49
64
  Here's a table showing the the full layering.
50
65
 
51
66
  Folder/Pattern | Example
52
- ------------------|--------------------------------------------
67
+ ------------------|----------------------------
53
68
  base.rb | base.rb
54
69
  ENV.rb | dev.rb
55
70
  base/all.rb | base/all.rb
@@ -61,4 +76,20 @@ ROLE/KIND.rb | web/deployment.rb
61
76
  ROLE/KIND/base.rb | web/deployment/base.rb
62
77
  ROLE/KIND/ENV.rb | web/deployment/dev.rb
63
78
 
79
+ If KUBES_APP is set then these additional layers are also processed:
80
+
81
+ Folder/Pattern | Example
82
+ ------------------|----------------------------
83
+ APP.rb | app1.rb
84
+ APP/base.rb | app1/base.rb
85
+ APP/ENV.rb | app1/dev.rb
86
+ APP/base/all.rb | app1/base/all.rb
87
+ APP/base/all/ENV.rb | app1/base/all/dev.rb
88
+ APP/base/KIND.rb | app1/base/deployment.rb
89
+ APP/base/KIND/base.rb | app1/base/deployment/base.rb
90
+ APP/base/KIND/ENV.rb | app1/base/deployment/dev.rb
91
+ APP/ROLE/KIND.rb | app1/web/deployment.rb
92
+ APP/ROLE/KIND/base.rb | app1/web/deployment/base.rb
93
+ APP/ROLE/KIND/ENV.rb | app1/web/deployment/dev.rb
94
+
64
95
  {% include variables/generator.md %}
@@ -2,6 +2,7 @@
2
2
  title: Basic Variables
3
3
  nav_text: Basic
4
4
  categories: variables
5
+ order: 1
5
6
  ---
6
7
 
7
8
  ## Basic Layering Example
@@ -4,6 +4,8 @@ nav_text: Custom Solutions
4
4
  categories: vs
5
5
  ---
6
6
 
7
+ {% include videos/learn/vs.md %}
8
+
7
9
  Kubernetes provides a great platform to run and manage Docker containers. The `kubectl` command is usually how you interact with a Kubernetes cluster. It does its job well and is quite a powerful tool.
8
10
 
9
11
  {% include vs/article.md %}
@@ -4,6 +4,8 @@ nav_text: Helm
4
4
  categories: vs
5
5
  ---
6
6
 
7
+ {% include videos/learn/vs.md %}
8
+
7
9
  Kubes and Helm are quite different. Helm is a package manager tool. In contrast, Kubernetes is focused on deploying your application. While you can use package manager tools like Helm to deploy your application, application-focused deploy tools are better for the job. For example, apt-get and yum are also package manager tools. But few companies use `apt-get install` or `yum install` to deploy their application code. Instead, people usually use application-specific tools to deploy their web app.
8
10
 
9
11
  {% include vs/article.md %}
@@ -4,6 +4,8 @@ nav_text: Kustomize
4
4
  categories: vs
5
5
  ---
6
6
 
7
+ {% include videos/learn/vs.md %}
8
+
7
9
  Though both Kubes and Kustomize build YAML files, they are quite different beasts. Kustomize is more like a `kubectl` feature that decorates YAML. Kubes is more like a tool. Kubes also builds YAML, but it also provides additional features.
8
10
 
9
11
  Kustomize lets you customize your Kubernetes YAML files with additional `kustomization.yaml` files. The kustomization.yaml files contain configs that tell `kubectl` how to decorate existing Kubernetes YAML files in a template-free way.
@@ -135,7 +137,7 @@ You can even define your own custom helpers for even more control. See: [Helpers
135
137
 
136
138
  ## Kubes Features
137
139
 
138
- Kubes does a lot more than build YAML files. Here's a list of features:
140
+ Kubes does a lot more than building YAML files. Here's a list of features:
139
141
 
140
142
  {% include intro/features.md %}
141
143
 
data/docs/_docs/vs.md CHANGED
@@ -2,6 +2,8 @@
2
2
  title: Kubes vs. Other Tools
3
3
  ---
4
4
 
5
+ {% include videos/learn/vs.md %}
6
+
5
7
  Here are some useful comparisons to help you compare Kubes vs other tools in the ecosystem:
6
8
 
7
9
  {% assign docs = site.docs | where: "categories","vs" %}
@@ -0,0 +1,89 @@
1
+ ---
2
+ title: ERB Comment Syntax PreProcessor
3
+ ---
4
+
5
+ Kubes allows you build kubernetes resources by compiling down `.kubes/resources` files with ERB. This is a powerful ability, but it can get in the way of IDE kubernetes autocompletion tools.
6
+
7
+ ## Pre-Processing Before ERB
8
+
9
+ To work with IDE kubernetes autocompletion tools, kubes supports a lighter ERB comment-based syntax. It looks like this:
10
+
11
+ .kubes/resources/web/service.yaml
12
+
13
+ ```yaml
14
+ apiVersion: v1
15
+ kind: Service
16
+ metadata:
17
+ name: web
18
+ labels:
19
+ name: web
20
+ #ERB if @role_label
21
+ role: #ERB= @role_label
22
+ #ERB end
23
+ spec:
24
+ ports:
25
+ - port: 80
26
+ protocol: TCP
27
+ targetPort: <%= dockerfile_port %>
28
+ selector:
29
+ role: web
30
+ type: ClusterIP
31
+ ```
32
+
33
+ This allows IDB kubernetes autocompletion plugins and tools to work because the `.kubes/resources/web/service.yaml` source code itself is perfectly valid YAML.
34
+
35
+ The `#ERB` comments are essentially replaced by `<% ... %>` tags before ERB processing happens. Example:
36
+
37
+ .kubes/resources/web/service.yaml.erb
38
+
39
+ ```yaml
40
+ apiVersion: v1
41
+ kind: Service
42
+ metadata:
43
+ name: web
44
+ labels:
45
+ name: web
46
+ <% if @role_label %>
47
+ role: <%= @role_label %>
48
+ <% end %>
49
+ spec:
50
+ ports:
51
+ - port: 80
52
+ protocol: TCP
53
+ targetPort: <%= dockerfile_port %>
54
+ selector:
55
+ role: web
56
+ type: ClusterIP
57
+ ```
58
+
59
+ If you need to keep around the generated `.erb` file for debugging, use the `KUBES_KEEP_ERB` env var. Example:
60
+
61
+ $ KUBES_KEEP_ERB=1 kubes compile
62
+ .kubes/resources/web/service.yaml.erb # kept around
63
+
64
+ ## Multiple Line ERB Comment Syntax
65
+
66
+ The ERB Comment syntax works because kubes simply replaces each line with actual ERB. For multiple line ERB syntax:
67
+
68
+ .kubes/resources/web/service.yaml
69
+
70
+ ```yaml
71
+ #ERB if Kubes.env == "dev"
72
+ #ERB env_label = "development"
73
+ #ERB end
74
+ apiVersion: v1
75
+ kind: Service
76
+ metadata:
77
+ name: web
78
+ labels:
79
+ name: web
80
+ env: #ERB= env_label
81
+ spec:
82
+ ports:
83
+ - port: 80
84
+ protocol: TCP
85
+ targetPort: <%= dockerfile_port %>
86
+ selector:
87
+ role: web
88
+ type: ClusterIP
89
+ ```
@@ -0,0 +1,2 @@
1
+ <div id="foot-banner" class="foot-banner">
2
+ </div>
@@ -0,0 +1,5 @@
1
+ {% assign buildtime = "now" | date: "%Y%m%d%H%M%S" %}
2
+ <link rel="preload" href="{{ site.ads_url }}/ads/{{ site.time | date: '%s' }}.js" as="script" />
3
+ <script data-cfasync="false" async src="{{ site.ads_url }}/ads/{{ site.time | date: '%s' }}.js"></script>
4
+
5
+ <div id="head-banner" class="head-banner"></div>
@@ -0,0 +1,44 @@
1
+ ## App-Level Specific Settings
2
+
3
+ You can override all the different settings at the app-level when KUBES_APP is set.
4
+
5
+ For app1:
6
+
7
+ cd app1
8
+ KUBES_APP=app1 kubes deploy
9
+
10
+ And for app2:
11
+
12
+ cd app2
13
+ KUBES_APP=app2 kubes deploy
14
+
15
+ ## Config Env
16
+
17
+ Override `config/app.rb` with app-level settings like so:
18
+
19
+ .kubes/config/env/app1/base.rb
20
+ .kubes/config/env/app1/dev.rb
21
+ .kubes/config/env/app1/prod.rb
22
+ .kubes/config/env/app2/base.rb
23
+ .kubes/config/env/app2/dev.rb
24
+ .kubes/config/env/app2/prod.rb
25
+
26
+ ## Variables
27
+
28
+ Override `.kubes/variables/base.rb`, `.kubes/variables/dev.rb` etc like so:
29
+
30
+ .kubes/variables/app1/base.rb
31
+ .kubes/variables/app1/dev.rb
32
+ .kubes/variables/app1/prod.rb
33
+ .kubes/variables/app2/base.rb
34
+ .kubes/variables/app2/dev.rb
35
+ .kubes/variables/app2/prod.rb
36
+
37
+ ## Resources
38
+
39
+ Override resources like so:
40
+
41
+ .kubes/resources/shared/config_map/app1.yaml
42
+ .kubes/resources/shared/config_map/app2.yaml
43
+ .kubes/resources/shared/secret/app1.yaml
44
+ .kubes/resources/shared/secret/app2.yaml
@@ -0,0 +1,6 @@
1
+ ## Hook Generator
2
+
3
+ To generator a starter hook:
4
+
5
+ $ kubes new hook {{ include.type }}
6
+ create .kubes/config/hooks/{{ include.type }}.rb
@@ -5,7 +5,7 @@
5
5
  {% else %}
6
6
 
7
7
  <div class="d-flex" id="wrapper">
8
- {% include sidebar.html %}
8
+ {% include_cached sidebar.html %}
9
9
  <div id="content">
10
10
  <div class="menu-top-bar">
11
11
  <div id="menu-toggle">
@@ -0,0 +1,7 @@
1
+ ## RubyGems
2
+
3
+ Install kubes via RubyGems.
4
+
5
+ gem install kubes
6
+
7
+ Ruby 3.0 and above is recommended. For other ways to install Kubes see: [Install Docs]({% link _docs/install.md %}).
@@ -0,0 +1,9 @@
1
+ ## Generated Wrapper
2
+
3
+ The standalone installer creates a wrapper script in `/usr/local/bin`.
4
+
5
+ /usr/local/bin/kubes
6
+
7
+ Most users have `/usr/local/bin` configured in their PATH. So this wrapper should work immediately.
8
+
9
+ Important: If you have a wrapper in `/usr/local/bin` already, the installer will overwrite it.
@@ -46,6 +46,9 @@ pre | ROLE/all.{{ include.ext }} | web/all.{{ include.ext }}
46
46
  main | ROLE/KIND.{{ include.ext }} | web/deployment.{{ include.ext }}
47
47
  post | ROLE/KIND/base.{{ include.ext }} | web/deployment/base.{{ include.ext }}
48
48
  post | ROLE/KIND/ENV.{{ include.ext }} | web/deployment/dev.{{ include.ext }}
49
+ post | ROLE/KIND/APP.{{ include.ext }} | web/deployment/app1.{{ include.ext }}
50
+ post | ROLE/KIND/APP/base.{{ include.ext }} | web/deployment/app1/base.{{ include.ext }}
51
+ post | ROLE/KIND/APP/ENV.{{ include.ext }} | web/deployment/app1/dev.{{ include.ext }}
49
52
 
50
53
  ## Real-World Uses
51
54
 
@@ -4,3 +4,14 @@ You've seen how to get started with Kubes. From here, you can check out the Docs
4
4
  * [Layering]({% link _docs/layering.md %}): Use the same Kubernetes YAML to build multiple environments like dev and prod with [layering]({% link _docs/layering.md %}).
5
5
  * [CLI Customizations]({% link _docs/config.md %}): You can customize the [cli args]({% link _docs/config/kubectl.md %}). You can also run hooks before and after kubectl commands.
6
6
  * [Extra Env]({% link _docs/extra-env.md %}): Create additional envs with little effort.
7
+
8
+ ## Learn Videos
9
+
10
+ Watch BoltOps Learn Kubes videos:
11
+
12
+ * [BoltOps Learn Kubes Videos](https://learn.boltops.com/tagged/kubes)
13
+
14
+
15
+ ## Kubes Features
16
+
17
+ {% include intro/features.md %}
@@ -49,10 +49,32 @@
49
49
  <li><a href="{% link _docs/intro/ordering/custom.md %}">Custom Order</a></li>
50
50
  </ul>
51
51
  </li>
52
- <li><a href="{% link _docs/intro/install.md %}">Install</a></li>
53
52
  <li><a href="{% link _docs/intro/docker-image.md %}">Docker Image</a></li>
54
53
  </ul>
55
54
  </li>
55
+ <li><a href="{% link _docs/install.md %}">Install</a>
56
+ <ul>
57
+ <li><a href="{% link _docs/install/gem.md %}">Gem</a></li>
58
+ <li><a href="{% link _docs/install/standalone.md %}">Standalone</a>
59
+ <ul>
60
+ {% assign docs = site.docs | where: "categories","standalone" | sort:"order" %}
61
+ {% for doc in docs -%}
62
+ {% if doc.nav_text == "Details" %}
63
+ <li><a href="{{ doc.url }}">{{ doc.nav_text }}</a>
64
+ <ul>
65
+ <li><a href="{% link _docs/install/standalone/details/permissions.md %}">Permissions</a></li>
66
+ <li><a href="{% link _docs/install/standalone/details/uninstall.md %}">Uninstall</a></li>
67
+ </ul>
68
+ </li>
69
+ {% else %}
70
+ <li><a href="{{ doc.url }}">{{ doc.nav_text }}</a></li>
71
+ {% endif %}
72
+ {% endfor %}
73
+ </ul>
74
+ </li>
75
+ <li><a href="{% link _docs/install/dependencies.md %}">Dependencies</a>
76
+ </ul>
77
+ </li>
56
78
  <li><a href="{% link _docs/resources.md %}">Resources</a>
57
79
  <ul>
58
80
  <li><a href="{% link _docs/resources/role.md %}">Role</a></li>
@@ -72,16 +94,18 @@
72
94
  </li>
73
95
  <li><a href="{% link _docs/config/hooks.md %}">Hooks</a>
74
96
  <ul>
75
- {% assign docs = site.docs | where: "categories","hooks" %}
97
+ {% assign docs = site.docs | where: "categories","hooks" | sort: "order" %}
76
98
  {% for doc in docs -%}
77
99
  <li><a href="{{ doc.url }}">{{ doc.nav_text }}</a></li>
78
100
  {% endfor %}
79
101
  </ul>
80
102
  </li>
103
+ <li><a href="{% link _docs/config/boot.md %}">Boot Hooks</a></li>
81
104
  <li><a href="{% link _docs/config/docker.md %}">Docker</a></li>
82
105
  <li><a href="{% link _docs/config/env.md %}">Env</a></li>
83
106
  <li><a href="{% link _docs/config/builder.md %}">Builder</a></li>
84
107
  <li><a href="{% link _docs/config/skip.md %}">Skip Option</a></li>
108
+ <li><a href="{% link _docs/config/app-overrides.md %}">App Overrides</a></li>
85
109
  <li><a href="{% link _docs/config/reference.md %}">Reference</a></li>
86
110
  </ul>
87
111
  </li>
@@ -90,6 +114,7 @@
90
114
  <ul>
91
115
  <li><a href="{% link _docs/yaml/multiple-resources.md %}">Multiple Resources</a></li>
92
116
  <li><a href="{% link _docs/yaml/multiple-files.md %}">Multiple Files</a></li>
117
+ <li><a href="{% link _docs/yaml/erb-comment.md %}">ERB Comment Syntax</a></li>
93
118
  </ul>
94
119
  </li>
95
120
  <li><a href="{% link _docs/layering.md %}">Layering</a>
@@ -116,7 +141,7 @@
116
141
  </li>
117
142
  <li><a href="{% link _docs/variables.md %}">Variables</a>
118
143
  <ul>
119
- {% assign docs = site.docs | where: "categories","variables" %}
144
+ {% assign docs = site.docs | where: "categories","variables" | sort:"order" %}
120
145
  {% for doc in docs -%}
121
146
  <li><a href="{{ doc.url }}">{{ doc.nav_text }}</a></li>
122
147
  {% endfor %}
@@ -0,0 +1,4 @@
1
+ {% include videos/learn.md
2
+ url="kubernetes-deploy-tools/lessons/kubernetes-tools-kustomize-vs-helm-vs-kubes"
3
+ img="https://uploads-learn.boltops.com/7bvtooupw8qru86ily4uyrj3mwuf"
4
+ premium=false %}
@@ -0,0 +1,12 @@
1
+ <div class="learn">
2
+ <a href="https://learn.boltops.com/courses/{{ include.url }}">
3
+ {% if include.img %}
4
+ <img src="{{ include.img }}" />
5
+ {% else %}
6
+ <img src="https://learn.boltops.com/courses/{{ include.url }}/thumbnail.png" />
7
+ {% endif %}
8
+ </a>
9
+ {% unless include.premium == false %}
10
+ <div class="note">Note: Premium video content requires a subscription.</div>
11
+ {% endunless %}
12
+ </div>
@@ -0,0 +1 @@
1
+ <div class="video-box"><div class="video-container"><iframe src="https://www.youtube.com/embed/{{ include.video_id }}" frameborder="0" allowfullscreen=""></iframe></div></div>
@@ -24,12 +24,15 @@
24
24
  <script src="/vendor/jquery/jquery.min.js"></script>
25
25
  <script src="/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
26
26
  <script src="/js/app.js"></script>
27
+ <script src="/js/scripts.js"></script>
27
28
  </head>
28
29
 
29
30
  <body>
31
+ {% include banner/head.html %}
30
32
  {% include header.html %}
31
33
  {% include content.html %}
32
34
  {% include footer.html %}
35
+ {% include banner/foot.html %}
33
36
  {% include js.html %}
34
37
  </body>
35
38
  </html>
@@ -0,0 +1,30 @@
1
+ ---
2
+ title: kubes new hook
3
+ reference: true
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ kubes new hook
9
+
10
+ ## Description
11
+
12
+ Generates kubes hook file.
13
+
14
+ ## Examples
15
+
16
+ $ kubes new hook docker
17
+ create .kubes/config/hooks/docker.rb
18
+ $ kubes new hook kubectl
19
+ create .kubes/config/hooks/kubectl.rb
20
+ $ kubes new hook kubes
21
+ create .kubes/config/hooks/kubes.rb
22
+ $
23
+
24
+
25
+ ## Options
26
+
27
+ ```
28
+ y, [--force] # Bypass overwrite are you sure prompt for existing files
29
+ ```
30
+
@@ -11,6 +11,13 @@ reference: true
11
11
 
12
12
  Generates kubes variable file.
13
13
 
14
+ ## Examples
15
+
16
+ $ kubes new variable
17
+ create .kubes/variables/dev.rb
18
+ $ KUBES_ENV=prod kubes new variable
19
+ create .kubes/variables/prod.rb
20
+
14
21
 
15
22
  ## Options
16
23
 
@@ -14,6 +14,7 @@ Generates new resource.
14
14
  ## Subcommands
15
15
 
16
16
  * [kubes new helper]({% link _reference/kubes-new-helper.md %}) - Generates kubes helper file.
17
+ * [kubes new hook]({% link _reference/kubes-new-hook.md %}) - Generates kubes hook file.
17
18
  * [kubes new resource]({% link _reference/kubes-new-resource.md %}) - Generates Kubes Kubernetes resource definition.
18
19
  * [kubes new variable]({% link _reference/kubes-new-variable.md %}) - Generates kubes variable file.
19
20
 
@@ -407,3 +407,14 @@ ul.toc {
407
407
  }
408
408
  }
409
409
  }
410
+
411
+ .learn {
412
+ img {
413
+ max-width: 600px;
414
+ }
415
+ .note {
416
+ font-size: 0.9em;
417
+ }
418
+ border-bottom: 1px solid #696969;
419
+ padding-bottom: 8px;
420
+ }
data/docs/bin/web CHANGED
@@ -5,4 +5,4 @@
5
5
  # bin/web -P 8888
6
6
 
7
7
  bundle exec jekyll clean
8
- exec bundle exec jekyll serve "$@"
8
+ exec bundle exec jekyll serve --trace --config _config.yml,_config-dev.yml --port 4002 --host 0.0.0.0 "$@"
@@ -0,0 +1,7 @@
1
+ $(document).ready(function() {
2
+ // adjust edit-page link
3
+ var github_base = $('#edit-page').attr('href');
4
+ var md_page = window.location.pathname.replace('/','_').replace(/\/$/,'.md');
5
+ var href = github_base + md_page;
6
+ $('#edit-page').attr('href', href);
7
+ });
data/kubes.gemspec CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency "dsl_evaluator"
24
24
  spec.add_dependency "hash_squeezer"
25
25
  spec.add_dependency "memoist"
26
+ spec.add_dependency "nokogiri"
26
27
  spec.add_dependency "rainbow"
27
28
  spec.add_dependency "render_me_pretty"
28
29
  spec.add_dependency "thor"
@@ -0,0 +1,26 @@
1
+ module Kubes
2
+ module Booter
3
+ def boot
4
+ run_hooks
5
+ end
6
+
7
+ # Special boot hooks run super early, even before plugins are loaded.
8
+ # Useful for setting env vars and other early things.
9
+ #
10
+ # config/boot.rb
11
+ # config/boot/dev.rb
12
+ #
13
+ def run_hooks
14
+ run_hook
15
+ run_hook(Kubes.env)
16
+ end
17
+
18
+ def run_hook(env=nil)
19
+ name = env ? "boot/#{env}" : "boot"
20
+ path = "#{Kubes.root}/.kubes/#{name}.rb"
21
+ require path if File.exist?(path)
22
+ end
23
+
24
+ extend self
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ ## Examples
2
+
3
+ $ kubes new hook docker
4
+ create .kubes/config/hooks/docker.rb
5
+ $ kubes new hook kubectl
6
+ create .kubes/config/hooks/kubectl.rb
7
+ $ kubes new hook kubes
8
+ create .kubes/config/hooks/kubes.rb
9
+ $
@@ -0,0 +1,6 @@
1
+ ## Examples
2
+
3
+ $ kubes new variable
4
+ create .kubes/variables/dev.rb
5
+ $ KUBES_ENV=prod kubes new variable
6
+ create .kubes/variables/prod.rb
@@ -85,7 +85,6 @@ class Kubes::CLI
85
85
  def adjust_gitignore
86
86
  ignores = %w[
87
87
  .kubes/output
88
- .kubes/state
89
88
  .kubes/tmp
90
89
  ].map {|l| "#{l}\n"} # the readlines will have lines with \n so keep consistent for processing
91
90
  if File.exist?(".gitignore")
@@ -0,0 +1,18 @@
1
+ class Kubes::CLI::New
2
+ class Hook < Kubes::CLI::Sequence
3
+ argument :type, default: "kubes", description: "IE: docker, kubectl, kubes" # description doesnt really show up
4
+
5
+ def self.options
6
+ [
7
+ [:force, aliases: ["y"], type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"],
8
+ ]
9
+ end
10
+ options.each { |args| class_option(*args) }
11
+
12
+ public
13
+ def create_hook
14
+ set_source("new/hooks")
15
+ template "#{type}.rb", ".kubes/config/hooks/#{type}.rb"
16
+ end
17
+ end
18
+ end
data/lib/kubes/cli/new.rb CHANGED
@@ -11,5 +11,9 @@ class Kubes::CLI
11
11
  long_desc Help.text("new/variable")
12
12
  Variable.options.each { |args| option(*args) }
13
13
  register(Variable, "variable", "variable", "Generates kubes variable file.")
14
+
15
+ long_desc Help.text("new/hook")
16
+ Hook.options.each { |args| option(*args) }
17
+ register(Hook, "hook", "hook", "Generates kubes hook file.")
14
18
  end
15
19
  end
data/lib/kubes/command.rb CHANGED
@@ -58,7 +58,7 @@ module Kubes
58
58
 
59
59
  def check_project!(command_name)
60
60
  return if command_name.nil?
61
- return if %w[-h -v completion completion_script help init new version].include?(command_name)
61
+ return if %w[-h -v --version completion completion_script help init new version].include?(command_name)
62
62
  Kubes.check_project!
63
63
  end
64
64
 
@@ -9,7 +9,7 @@ module Kubes::Compiler::Decorator
9
9
  name = @data.dig('metadata','name')
10
10
  return @data unless name
11
11
 
12
- # puts "name #{name}" # TODO: scope Kind so Secret and ConfigMap can have the same name...
12
+ # scope Kind so Secret and ConfigMap can have same name
13
13
  md5 = md5(@data)
14
14
  @data['metadata']['name'] = "#{name}-#{md5}"
15
15
  Storage.store(@data['kind'], name, md5)
@@ -31,6 +31,15 @@ class Kubes::Compiler
31
31
  "base",
32
32
  Kubes.env.to_s
33
33
  ]
34
+
35
+ if Kubes.app
36
+ layers += [
37
+ Kubes.app,
38
+ "#{Kubes.app}/base",
39
+ "#{Kubes.app}/#{Kubes.env}",
40
+ ]
41
+ end
42
+
34
43
  layers = add_exts(layers)
35
44
  layers.map! do |layer|
36
45
  "#{kind_path}/#{layer}"