kubes 0.8.0 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/docs/_docs/helpers/aws/secret_data.md +55 -0
- data/docs/_docs/helpers/builtin/config-map-files.md +63 -0
- data/docs/_docs/helpers/builtin.md +16 -0
- data/docs/_docs/helpers/google/secret_data.md +55 -0
- data/docs/_docs/helpers.md +3 -12
- data/docs/_docs/install/gem/custom-version.md +70 -0
- data/docs/_docs/patterns/central-deployer.md +6 -4
- data/docs/_docs/yaml/erb-comment.md +1 -1
- data/docs/_includes/sidebar.html +12 -3
- data/kubes.gemspec +2 -2
- data/lib/kubes/command.rb +1 -1
- data/lib/kubes/compiler/shared/helpers/config_map_helper.rb +35 -0
- data/lib/kubes/compiler/shared/helpers/docker_helper.rb +23 -0
- data/lib/kubes/compiler/shared/helpers/extra_helper.rb +12 -0
- data/lib/kubes/compiler/shared/helpers/secret_helper.rb +29 -0
- data/lib/kubes/compiler/shared/helpers.rb +4 -37
- data/lib/kubes/version.rb +1 -1
- metadata +19 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f78e6b8aa9788c03dbc38391b936a5792353249c5d9e743d7ebf87fc52c74488
|
4
|
+
data.tar.gz: a77d273302faaf434f751f36305cfafc9e7e5e7491db010f1468088d4806f8b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1241bd270d3212d96a04b5e1edbd1085efee439105fff63896ec2b06dc84520e02ffbe7fd0830db246979c201c279c63adfcd41332e809cfbc3997b205a0459b
|
7
|
+
data.tar.gz: 6382b7380c842621e54f388e7d66fcf981e407a3952928996148be0037d0321e14779ea79a016991c0b5d0b0c5c02dccfe9de3ef77a62295a62fe549fa2a335c
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@
|
|
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.8.4] - 2022-02-16
|
7
|
+
- bump kubes_aws and kubes_google dependencies
|
8
|
+
|
9
|
+
## [0.8.3] - 2022-02-16
|
10
|
+
- [#60](https://github.com/boltops-tools/kubes/pull/60) Config files
|
11
|
+
|
12
|
+
## [0.8.2] - 2022-02-07
|
13
|
+
- improve gem dependency version specifiers
|
14
|
+
|
15
|
+
## [0.8.1] - 2022-02-06
|
16
|
+
- allow --version command to run outside project
|
17
|
+
|
6
18
|
## [0.8.0] - 2022-02-06
|
7
19
|
- [#58](https://github.com/boltops-tools/kubes/pull/58) standalone install docs
|
8
20
|
- [#59](https://github.com/boltops-tools/kubes/pull/59) central deployer support
|
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
title: AWS Secrets
|
3
|
+
nav_text: Secrets Data
|
4
|
+
categories: helpers-aws
|
5
|
+
---
|
6
|
+
|
7
|
+
The `aws_secret_data` helper fetches secret data that is one single file from AWS Secrets.
|
8
|
+
|
9
|
+
## Example
|
10
|
+
|
11
|
+
For example if you have these secret values stored as one file with multiple values separated by `=`.
|
12
|
+
|
13
|
+
$ aws secretsmanager get-secret-value --secret-id demo-dev-secret-data | jq '.SecretString'
|
14
|
+
KEY1=secretvalue1
|
15
|
+
KEY2=secretvalue2
|
16
|
+
|
17
|
+
Kubes can fetch the secret data and base64 encode the values properly. Example:
|
18
|
+
|
19
|
+
.kubes/resources/shared/secret.yaml
|
20
|
+
|
21
|
+
```yaml
|
22
|
+
apiVersion: v1
|
23
|
+
kind: Secret
|
24
|
+
metadata:
|
25
|
+
name: demo
|
26
|
+
labels:
|
27
|
+
app: demo
|
28
|
+
data:
|
29
|
+
<%= aws_secret_data("demo-dev-secret-data") %>
|
30
|
+
```
|
31
|
+
|
32
|
+
Notice how the text is idented properly by 2 spaces and the values are automatically base64 encoded.
|
33
|
+
|
34
|
+
.kubes/output/shared/secret.yaml
|
35
|
+
|
36
|
+
```yaml
|
37
|
+
metadata:
|
38
|
+
namespace: demo
|
39
|
+
name: demo-2a78a13682
|
40
|
+
labels:
|
41
|
+
app: demo
|
42
|
+
apiVersion: v1
|
43
|
+
kind: Secret
|
44
|
+
data:
|
45
|
+
KEY1: c2VjcmV0dmFsdWUx
|
46
|
+
KEY2: c2VjcmV0dmFsdWUy
|
47
|
+
```
|
48
|
+
|
49
|
+
## Options
|
50
|
+
|
51
|
+
Here's an example of the available options for `aws_secret_data`.
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
aws_secret_data("demo-#{Kubes.env}-secret-data", base64: true, ident: 2)
|
55
|
+
```
|
@@ -0,0 +1,63 @@
|
|
1
|
+
---
|
2
|
+
title: Config Map Files
|
3
|
+
nav_text: Config Map Files
|
4
|
+
---
|
5
|
+
|
6
|
+
The `config_map_files` helper allows you to add config map data from a list of files. The files support layerying.
|
7
|
+
|
8
|
+
## Example
|
9
|
+
|
10
|
+
Here's how to use it.
|
11
|
+
|
12
|
+
.kubes/resources/shared/config_map.yaml
|
13
|
+
|
14
|
+
```yaml
|
15
|
+
apiVersion: v1
|
16
|
+
kind: ConfigMap
|
17
|
+
metadata:
|
18
|
+
name: demo
|
19
|
+
labels:
|
20
|
+
app: demo
|
21
|
+
data:
|
22
|
+
<%= config_map_files %>
|
23
|
+
```
|
24
|
+
|
25
|
+
You can conveniently set multiple configmap values in files like so:
|
26
|
+
|
27
|
+
.kubes/resources/shared/config_map/base.txt
|
28
|
+
|
29
|
+
KEY1=cmvalue1
|
30
|
+
KEY2=cmvalue2
|
31
|
+
|
32
|
+
.kubes/resources/shared/config_map/dev.txt
|
33
|
+
|
34
|
+
KEY2=cmvalue2-dev-override
|
35
|
+
KEY3=cmvalue3
|
36
|
+
|
37
|
+
The resulting generated ConfigMap will be:
|
38
|
+
|
39
|
+
```yaml
|
40
|
+
---
|
41
|
+
metadata:
|
42
|
+
namespace: demo-dev
|
43
|
+
labels:
|
44
|
+
app: demo
|
45
|
+
name: demo-928146dd24
|
46
|
+
apiVersion: v1
|
47
|
+
kind: ConfigMap
|
48
|
+
data:
|
49
|
+
KEY1: cmvalue1
|
50
|
+
KEY2: cmvalue2-dev-override
|
51
|
+
KEY3: cmvalue3
|
52
|
+
```
|
53
|
+
|
54
|
+
## Layering Details
|
55
|
+
|
56
|
+
Layering for Config Map Files and also supports app-scoped layers.
|
57
|
+
|
58
|
+
Name | Example
|
59
|
+
--- | ---
|
60
|
+
configmap root | .kubes/resources/shared/config_map/{base,dev}.txt
|
61
|
+
configmap app-scoped | .kubes/resources/shared/config_map/app1/{base,dev}.txt
|
62
|
+
|
63
|
+
So if `KUBES_APP=app1`, then the app-scoped layer is also used. This handles the [Central Deployer Pattern]({% link _docs/patterns/central-deployer.md %}).
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
title: Core Built-In Helpers
|
3
|
+
---
|
4
|
+
|
5
|
+
Kubes provides some helper methods to help write Kubernetes YAML files. Here's a list of the helper methods. These are available whether you write your resources in YAML or DSL.
|
6
|
+
|
7
|
+
Helper | Description
|
8
|
+
--- | ---
|
9
|
+
decode64 | Base64 decode a string.
|
10
|
+
docker_image | Method refers to the latest Docker image built by Kubes. This spares you from having to update the image manually in the deployment resource. Note, this can be overridden with the `--image` cli option or the `Kubes.config.image` setting. See: [Docker Image]({% link _docs/intro/docker-image.md %})
|
11
|
+
dockerfile_port | Exposed port extracted from the Dockerfile of the project.
|
12
|
+
encode64 | Base64 encode a string. Also available as `base64` method.
|
13
|
+
extra | The `KUBES_EXTRA` value.
|
14
|
+
with_extra | Appends the `KUBES_EXTRA` value to a string if it's set. It's covered in the [Extra Env Docs]({% link _docs/extra-env.md %}).
|
15
|
+
|
16
|
+
Here's also the source code with most of the helpers: [helpers.rb](https://github.com/boltops-tools/kubes/blob/master/lib/kubes/compiler/shared/helpers.rb).
|
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
title: Google Secrets
|
3
|
+
nav_text: Secrets Data
|
4
|
+
categories: helpers-google
|
5
|
+
---
|
6
|
+
|
7
|
+
The `google_secret_data` helper fetches secret data that is one single file from Google Secrets.
|
8
|
+
|
9
|
+
## Example
|
10
|
+
|
11
|
+
For example if you have these secret values stored as one file with multiple values separated by `=`.
|
12
|
+
|
13
|
+
$ gcloud secrets versions access latest --secret demo-dev-secret-data
|
14
|
+
KEY1=secretvalue1
|
15
|
+
KEY2=secretvalue2
|
16
|
+
|
17
|
+
Kubes can fetch the secret data and base64 encode the values properly. Example:
|
18
|
+
|
19
|
+
.kubes/resources/shared/secret.yaml
|
20
|
+
|
21
|
+
```yaml
|
22
|
+
apiVersion: v1
|
23
|
+
kind: Secret
|
24
|
+
metadata:
|
25
|
+
name: demo
|
26
|
+
labels:
|
27
|
+
app: demo
|
28
|
+
data:
|
29
|
+
<%= google_secret_data("demo-dev-secret-data") %>
|
30
|
+
```
|
31
|
+
|
32
|
+
Notice how the text is idented properly by 2 spaces and the values are automatically base64 encoded.
|
33
|
+
|
34
|
+
.kubes/output/shared/secret.yaml
|
35
|
+
|
36
|
+
```yaml
|
37
|
+
metadata:
|
38
|
+
namespace: demo
|
39
|
+
name: demo-2a78a13682
|
40
|
+
labels:
|
41
|
+
app: demo
|
42
|
+
apiVersion: v1
|
43
|
+
kind: Secret
|
44
|
+
data:
|
45
|
+
KEY1: c2VjcmV0dmFsdWUx
|
46
|
+
KEY2: c2VjcmV0dmFsdWUy
|
47
|
+
```
|
48
|
+
|
49
|
+
## Options
|
50
|
+
|
51
|
+
Here's an example of the available options for `google_secret_data`.
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
google_secret_data("demo-#{Kubes.env}-secret-data", base64: true, ident: 2)
|
55
|
+
```
|
data/docs/_docs/helpers.md
CHANGED
@@ -2,18 +2,9 @@
|
|
2
2
|
title: Helpers
|
3
3
|
---
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
--- | ---
|
9
|
-
decode64 | Base64 decode a string.
|
10
|
-
docker_image | Method refers to the latest Docker image built by Kubes. This spares you from having to update the image manually in the deployment resource. Note, this can be overridden with the `--image` cli option or the `Kubes.config.image` setting. See: [Docker Image]({% link _docs/intro/docker-image.md %})
|
11
|
-
dockerfile_port | Exposed port extracted from the Dockerfile of the project.
|
12
|
-
encode64 | Base64 encode a string. Also available as `base64` method.
|
13
|
-
extra | The `KUBES_EXTRA` value.
|
14
|
-
with_extra | Appends the `KUBES_EXTRA` value to a string if it's set. It's covered in the [Extra Env Docs]({% link _docs/extra-env.md %}).
|
15
|
-
|
16
|
-
Here's also the source code with most of the helpers: [helpers.rb](https://github.com/boltops-tools/kubes/blob/master/lib/kubes/compiler/shared/helpers.rb).
|
5
|
+
## Built-In Helpers
|
6
|
+
|
7
|
+
Kubes provides core helper methods to help write Kubernetes YAML files. Docs: [Built-In Helpers]({% link _docs/helpers/builtin.md %}).
|
17
8
|
|
18
9
|
## DSL Specific Methods
|
19
10
|
|
@@ -0,0 +1,70 @@
|
|
1
|
+
---
|
2
|
+
title: How to Use Custom Version of Kubes
|
3
|
+
nav_text: Custom Version
|
4
|
+
category: gem
|
5
|
+
order: 1
|
6
|
+
---
|
7
|
+
|
8
|
+
If you want or need to run a forked version of kubes, here's how:
|
9
|
+
|
10
|
+
## Change Version Number
|
11
|
+
|
12
|
+
First, clone down the source and change version number so you can identify that it's a custom version. Clone down the project:
|
13
|
+
|
14
|
+
$ git clone https://github.com/boltops-tools/kubes
|
15
|
+
|
16
|
+
Update [lib/kubes/version.rb](https://github.com/boltops-tools/kubes/blob/master/lib/kubes/version.rb) so you'll be able to tell that it's a custom build. For example:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
module kubes
|
20
|
+
VERSION = "0.8.2.custom"
|
21
|
+
end
|
22
|
+
```
|
23
|
+
|
24
|
+
There are 2 ways to use the custom version:
|
25
|
+
|
26
|
+
1. Gemfile: Forked Git Source
|
27
|
+
2. Gem Package: Build and Install
|
28
|
+
|
29
|
+
## Gemfile: Forked Git Source
|
30
|
+
|
31
|
+
Point `kubes ` to use your repo with the forked version. Example:
|
32
|
+
|
33
|
+
Gemfile:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
source "https://rubygems.org"
|
37
|
+
gem 'kubes', git: 'https://github.com/REPO/kubes', branch: "master"
|
38
|
+
```
|
39
|
+
|
40
|
+
Remember to change `REPO`, to your repo name.
|
41
|
+
|
42
|
+
Then run:
|
43
|
+
|
44
|
+
bundle
|
45
|
+
|
46
|
+
## Gem Package: Build and Install
|
47
|
+
|
48
|
+
Build the gem package:
|
49
|
+
|
50
|
+
$ bundle
|
51
|
+
$ rake build
|
52
|
+
pkg/kubes-0.8.2.custom.gem
|
53
|
+
|
54
|
+
The produced `.gem` file can used to install the gem. You can install it locally:
|
55
|
+
|
56
|
+
$ gem install pkg/kubes-0.8.2.custom.gem
|
57
|
+
$ kubes -v
|
58
|
+
0.8.2.custom
|
59
|
+
|
60
|
+
Or on any machine with Ruby installed. You can copy it to the machine, ssh into it, and install the custom gem:
|
61
|
+
|
62
|
+
$ scp pkg/kubes-0.8.2.custom.gem user@server.com:
|
63
|
+
$ ssh user@server.com
|
64
|
+
$ gem install kubes-0.8.2.custom.gem
|
65
|
+
$ kubes -v
|
66
|
+
0.8.2.custom
|
67
|
+
|
68
|
+
## Contributing
|
69
|
+
|
70
|
+
Learning how to run a forked version of kubes allows you to make changes to the tool. Consider improving kubes by submitting a Pull Request. See: [Contributing]({% link _docs/contributing.md %}).
|
@@ -7,18 +7,18 @@ categories: patterns
|
|
7
7
|
Kubes can be use as either an app-centric or ops-centric tool.
|
8
8
|
|
9
9
|
* **app-centric**: Each app repo has it's own `.kubes` settings files. This is useful if your applications are very differently setup.
|
10
|
-
* **ops-centric**: Each app repo has pretty much the same `.kubes` settings files. This is useful if your applications are very similarly
|
10
|
+
* **ops-centric**: Each app repo has pretty much the same `.kubes` settings files. This is useful if your applications are very similarly set up.
|
11
11
|
|
12
12
|
## Setup
|
13
13
|
|
14
14
|
With an ops-centric approach, you use the same `.kubes` settings files for the app repos you want to use. For example:
|
15
15
|
|
16
|
-
https://github.com/
|
17
|
-
https://github.com/
|
16
|
+
https://github.com/org/app1
|
17
|
+
https://github.com/org/app2
|
18
18
|
|
19
19
|
You then also have a
|
20
20
|
|
21
|
-
https://github.com/
|
21
|
+
https://github.com/org/.kubes
|
22
22
|
|
23
23
|
You can simply copy the `.kubes` folder into the app repo folder or even add the `repo/.kubes` as a submodule.
|
24
24
|
|
@@ -31,6 +31,8 @@ Then to deploy different app level settings.
|
|
31
31
|
|
32
32
|
{% include config/app-overrides-cheatsheet.md %}
|
33
33
|
|
34
|
+
Also check out: [App Overrides Docs]({% link _docs/config/app-overrides.md %}).
|
35
|
+
|
34
36
|
The central deployer approach is removes duplication of the kubes config files between projects. Leveraging app-level overrides gives provides a great degree of control.
|
35
37
|
|
36
38
|
If the settings start to diverge too much, then it probably makes sense to use separate .kubes files in that app specific repo.
|
@@ -30,7 +30,7 @@ spec:
|
|
30
30
|
type: ClusterIP
|
31
31
|
```
|
32
32
|
|
33
|
-
This allows
|
33
|
+
This allows IDE kubernetes autocompletion plugins and tools to work because the `.kubes/resources/web/service.yaml` source code itself is perfectly valid YAML.
|
34
34
|
|
35
35
|
The `#ERB` comments are essentially replaced by `<% ... %>` tags before ERB processing happens. Example:
|
36
36
|
|
data/docs/_includes/sidebar.html
CHANGED
@@ -54,7 +54,11 @@
|
|
54
54
|
</li>
|
55
55
|
<li><a href="{% link _docs/install.md %}">Install</a>
|
56
56
|
<ul>
|
57
|
-
<li><a href="{% link _docs/install/gem.md %}">Gem</a
|
57
|
+
<li><a href="{% link _docs/install/gem.md %}">Gem</a>
|
58
|
+
<ul>
|
59
|
+
<li><a href="{% link _docs/install/gem/custom-version.md %}">Custom Version</a></li>
|
60
|
+
</ul>
|
61
|
+
</li>
|
58
62
|
<li><a href="{% link _docs/install/standalone.md %}">Standalone</a>
|
59
63
|
<ul>
|
60
64
|
{% assign docs = site.docs | where: "categories","standalone" | sort:"order" %}
|
@@ -149,7 +153,11 @@
|
|
149
153
|
</li>
|
150
154
|
<li><a href="{% link _docs/helpers.md %}">Helpers</a>
|
151
155
|
<ul>
|
152
|
-
<li><a href="{% link _docs/helpers/
|
156
|
+
<li><a href="{% link _docs/helpers/builtin.md %}">Built-In</a>
|
157
|
+
<ul>
|
158
|
+
<li><a href="{% link _docs/helpers/builtin/config-map-files.md %}">Config Map Files</a>
|
159
|
+
</ul>
|
160
|
+
</li>
|
153
161
|
<li><a href="{% link _docs/helpers/aws.md %}">AWS</a>
|
154
162
|
<ul>
|
155
163
|
{% assign docs = site.docs | where: "categories","helpers-aws" %}
|
@@ -188,6 +196,7 @@
|
|
188
196
|
{% endfor %}
|
189
197
|
</ul>
|
190
198
|
</li>
|
199
|
+
<li><a href="{% link _docs/helpers/custom.md %}">Custom</a></li>
|
191
200
|
</ul>
|
192
201
|
</li>
|
193
202
|
<li><a href="{% link _docs/patterns.md %}">Patterns</a>
|
@@ -235,7 +244,7 @@
|
|
235
244
|
<h2>sidebar options:</h2>
|
236
245
|
<ul class="list-unstyled">
|
237
246
|
<li><a href="#" id="expand-all">expand all</a></li>
|
238
|
-
<li><a href="{{ site.gh_url }}/blob/master/docs/
|
247
|
+
<li><a href="{{ site.gh_url }}/blob/master/docs/" id="edit-page" target="_blank">edit page</a></li>
|
239
248
|
</ul>
|
240
249
|
</div>
|
241
250
|
</div>
|
data/kubes.gemspec
CHANGED
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_dependency "zeitwerk"
|
31
31
|
|
32
32
|
# core helper libs
|
33
|
-
spec.add_dependency "kubes_aws", "
|
34
|
-
spec.add_dependency "kubes_google", "
|
33
|
+
spec.add_dependency "kubes_aws", ">= 0.3.2"
|
34
|
+
spec.add_dependency "kubes_google", ">= 0.3.9"
|
35
35
|
|
36
36
|
spec.add_development_dependency "bundler"
|
37
37
|
spec.add_development_dependency "byebug"
|
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
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Kubes::Compiler::Shared::Helpers
|
2
|
+
module ConfigMapHelper
|
3
|
+
def config_map_files(options={})
|
4
|
+
indent = options[:indent] || 2
|
5
|
+
|
6
|
+
shared_config_map = "#{Kubes.root}/.kubes/resources/shared/config_map"
|
7
|
+
layers = [
|
8
|
+
[shared_config_map, "base.txt"],
|
9
|
+
[shared_config_map, "#{Kubes.env}.txt"],
|
10
|
+
]
|
11
|
+
if Kubes.app
|
12
|
+
layers += [
|
13
|
+
[shared_config_map, Kubes.app, "base.txt"],
|
14
|
+
[shared_config_map, Kubes.app, "#{Kubes.env}.txt"],
|
15
|
+
]
|
16
|
+
end
|
17
|
+
layers.map! { |layer| layer.compact.join('/') }
|
18
|
+
data = {}
|
19
|
+
layers.each do |path|
|
20
|
+
next unless File.exist?(path)
|
21
|
+
lines = IO.readlines(path)
|
22
|
+
lines.each do |line|
|
23
|
+
key, value = line.split('=').map(&:strip)
|
24
|
+
data[key] = value
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
spacing = " " * indent
|
29
|
+
lines = data.map do |key,value|
|
30
|
+
"#{spacing}#{key}: #{value}"
|
31
|
+
end
|
32
|
+
lines.join("\n")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Kubes::Compiler::Shared::Helpers
|
2
|
+
module DockerHelper
|
3
|
+
def docker_image
|
4
|
+
return @options[:image] if @options[:image] # override
|
5
|
+
return Kubes.config.image if Kubes.config.image
|
6
|
+
built_image_helper
|
7
|
+
end
|
8
|
+
|
9
|
+
def built_image
|
10
|
+
Deprecated.new.built_image
|
11
|
+
built_image_helper
|
12
|
+
end
|
13
|
+
|
14
|
+
def built_image_helper
|
15
|
+
path = Kubes.config.state.path
|
16
|
+
unless File.exist?(path)
|
17
|
+
raise Kubes::MissingDockerImage.new("Missing file with docker image built by kubes: #{path}. Try first running: kubes docker build")
|
18
|
+
end
|
19
|
+
data = JSON.load(IO.read(path))
|
20
|
+
data['image']
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Kubes::Compiler::Shared::Helpers
|
2
|
+
module ExtraHelper
|
3
|
+
def with_extra(value)
|
4
|
+
[value, extra].compact.join('-')
|
5
|
+
end
|
6
|
+
|
7
|
+
def extra
|
8
|
+
extra = ENV['KUBES_EXTRA']
|
9
|
+
extra&.strip&.empty? ? nil : extra # if blank string then also return nil
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Kubes::Compiler::Shared::Helpers
|
2
|
+
module SecretHelper
|
3
|
+
# Meant to be used by plugins. IE:
|
4
|
+
# google_secret_data and aws_secret_data
|
5
|
+
def generic_secret_data(plugin_secret_method, name, options={})
|
6
|
+
indent = options[:indent] || 2
|
7
|
+
base64 = options[:base64].nil? ? true : options[:base64]
|
8
|
+
|
9
|
+
full_data = send(plugin_secret_method, name, base64: false)
|
10
|
+
spacing = " " * indent
|
11
|
+
lines = full_data.split("\n")
|
12
|
+
new_lines = lines.map do |line|
|
13
|
+
key, value = line.split('=')
|
14
|
+
value = encode64(value) if base64
|
15
|
+
"#{spacing}#{key}: #{value}"
|
16
|
+
end
|
17
|
+
new_lines.join("\n")
|
18
|
+
end
|
19
|
+
|
20
|
+
def encode64(v)
|
21
|
+
Base64.strict_encode64(v.to_s).strip
|
22
|
+
end
|
23
|
+
alias_method :base64, :encode64
|
24
|
+
|
25
|
+
def decode64(v)
|
26
|
+
Base64.strict_decode64(v)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -6,42 +6,9 @@ module Kubes::Compiler::Shared
|
|
6
6
|
extend Kubes::Compiler::Dsl::Core::Fields
|
7
7
|
fields "name"
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def built_image
|
16
|
-
Deprecated.new.built_image
|
17
|
-
built_image_helper
|
18
|
-
end
|
19
|
-
|
20
|
-
def built_image_helper
|
21
|
-
path = Kubes.config.state.path
|
22
|
-
unless File.exist?(path)
|
23
|
-
raise Kubes::MissingDockerImage.new("Missing file with docker image built by kubes: #{path}. Try first running: kubes docker build")
|
24
|
-
end
|
25
|
-
data = JSON.load(IO.read(path))
|
26
|
-
data['image']
|
27
|
-
end
|
28
|
-
|
29
|
-
def with_extra(value)
|
30
|
-
[value, extra].compact.join('-')
|
31
|
-
end
|
32
|
-
|
33
|
-
def extra
|
34
|
-
extra = ENV['KUBES_EXTRA']
|
35
|
-
extra&.strip&.empty? ? nil : extra # if blank string then also return nil
|
36
|
-
end
|
37
|
-
|
38
|
-
def encode64(v)
|
39
|
-
Base64.strict_encode64(v.to_s).strip
|
40
|
-
end
|
41
|
-
alias_method :base64, :encode64
|
42
|
-
|
43
|
-
def decode64(v)
|
44
|
-
Base64.strict_decode64(v)
|
45
|
-
end
|
9
|
+
include ConfigMapHelper
|
10
|
+
include DockerHelper
|
11
|
+
include ExtraHelper
|
12
|
+
include SecretHelper
|
46
13
|
end
|
47
14
|
end
|
data/lib/kubes/version.rb
CHANGED
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.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -154,30 +154,30 @@ dependencies:
|
|
154
154
|
name: kubes_aws
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - "
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.3.
|
159
|
+
version: 0.3.2
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - "
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.3.
|
166
|
+
version: 0.3.2
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: kubes_google
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - "
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.3.
|
173
|
+
version: 0.3.9
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - "
|
178
|
+
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.3.
|
180
|
+
version: 0.3.9
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: bundler
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -334,18 +334,23 @@ files:
|
|
334
334
|
- docs/_docs/helpers/aws/advanced/secrets.md
|
335
335
|
- docs/_docs/helpers/aws/advanced/ssm.md
|
336
336
|
- docs/_docs/helpers/aws/iam-role.md
|
337
|
+
- docs/_docs/helpers/aws/secret_data.md
|
337
338
|
- docs/_docs/helpers/aws/secrets.md
|
338
339
|
- docs/_docs/helpers/aws/ssm.md
|
340
|
+
- docs/_docs/helpers/builtin.md
|
341
|
+
- docs/_docs/helpers/builtin/config-map-files.md
|
339
342
|
- docs/_docs/helpers/custom.md
|
340
343
|
- docs/_docs/helpers/google.md
|
341
344
|
- docs/_docs/helpers/google/advanced.md
|
342
345
|
- docs/_docs/helpers/google/advanced/secrets.md
|
343
346
|
- docs/_docs/helpers/google/gke.md
|
347
|
+
- docs/_docs/helpers/google/secret_data.md
|
344
348
|
- docs/_docs/helpers/google/secrets.md
|
345
349
|
- docs/_docs/helpers/google/service-account.md
|
346
350
|
- docs/_docs/install.md
|
347
351
|
- docs/_docs/install/dependencies.md
|
348
352
|
- docs/_docs/install/gem.md
|
353
|
+
- docs/_docs/install/gem/custom-version.md
|
349
354
|
- docs/_docs/install/standalone.md
|
350
355
|
- docs/_docs/install/standalone/centos.md
|
351
356
|
- docs/_docs/install/standalone/details.md
|
@@ -664,7 +669,11 @@ files:
|
|
664
669
|
- lib/kubes/compiler/dsl/syntax/service_account.rb
|
665
670
|
- lib/kubes/compiler/layering.rb
|
666
671
|
- lib/kubes/compiler/shared/helpers.rb
|
672
|
+
- lib/kubes/compiler/shared/helpers/config_map_helper.rb
|
667
673
|
- lib/kubes/compiler/shared/helpers/deprecated.rb
|
674
|
+
- lib/kubes/compiler/shared/helpers/docker_helper.rb
|
675
|
+
- lib/kubes/compiler/shared/helpers/extra_helper.rb
|
676
|
+
- lib/kubes/compiler/shared/helpers/secret_helper.rb
|
668
677
|
- lib/kubes/compiler/shared/runtime_helpers.rb
|
669
678
|
- lib/kubes/compiler/strategy.rb
|
670
679
|
- lib/kubes/compiler/strategy/base.rb
|