kubes 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/docs/_docs/config/reference.md +1 -1
- data/docs/_docs/intro/docker-image.md +2 -2
- data/docs/_docs/patterns/multiple-envs.md +6 -6
- data/docs/_docs/yaml/multiple-resources.md +6 -6
- data/lib/kubes/cli/compile.rb +1 -1
- data/lib/kubes/command.rb +1 -0
- data/lib/kubes/compiler/shared/helpers.rb +4 -2
- data/lib/kubes/config.rb +1 -1
- data/lib/kubes/docker/strategy/image_name.rb +7 -3
- data/lib/kubes/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a5b3cde73260cb3fdcb98eb32357de95112ebb253ec38c82ee14828253cf704
|
4
|
+
data.tar.gz: 7251020f3a8c71c09f0cbcb6ed05fa801201a133064a6522df7f6ad439cfef24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9ee9fbfcae307f81105f48cdd69a8a86f120d464d5ec7c1b8d02fc54ebac0e9a033fc3da8ecf46d72f1b96f2b0b86da39046392de533321ae385c20e5eb49ae
|
7
|
+
data.tar.gz: 67434cdf1ea6a0babb94da14369f332950a55394f46b89616fa41e6dc10c8a99fe6562ad25e01b069f31e99411e5e1581fd29fd5021b1a394289670956c5ed15
|
data/CHANGELOG.md
CHANGED
@@ -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.2] - 2020-12-04
|
7
|
+
- [#43](https://github.com/boltops-tools/kubes/pull/43) store docker image name in env based folder
|
8
|
+
- fix kubes help
|
9
|
+
|
6
10
|
## [0.7.1] - 2020-11-16
|
7
11
|
- [#42](https://github.com/boltops-tools/kubes/pull/42) load helpers for dsl properly
|
8
12
|
- fix merge layer
|
@@ -18,5 +18,5 @@ logger.level | Logger level. Can also be set with `KUBES_LOG_LEVEL` env var | in
|
|
18
18
|
repo | The Docker repo to use. Required to be set. | nil
|
19
19
|
repo_auto_auth | Whether or not to try to auth authorize docker repo registry if not yet logged in. Can also be set with env var `KUBES_REPO_AUTO_AUTO` | true
|
20
20
|
skip | List of resources to skip. Can also be set with the `KUBES_SKIP` env var. `KUBES_SKIP` should be a list of strings separated by spaces. It adds onto the `config.skip` option. | []
|
21
|
-
state.
|
21
|
+
state.path | Where to store the state file with the last build Docker image. | .kubes/state/KUBES_env/data.json
|
22
22
|
suffix_hash | Whether or not to append suffix hash to ConfigMap and Secret | true
|
@@ -16,7 +16,7 @@ Kubes uses the image from the `--image` option if specified. It's a quick way to
|
|
16
16
|
|
17
17
|
kubes deploy --image repo/image:tag
|
18
18
|
|
19
|
-
When the `--image` option is set, Kubes skips the Docker build phase.
|
19
|
+
When the `--image` option is set, Kubes skips the Docker build phase. You can also set `config.image = false` to simply disable image building.
|
20
20
|
|
21
21
|
## 2. Kubes Config
|
22
22
|
|
@@ -30,7 +30,7 @@ Kubes.configure do |config|
|
|
30
30
|
end
|
31
31
|
```
|
32
32
|
|
33
|
-
When `config.image` is set, Kubes skips the Docker build phase.
|
33
|
+
When `config.image` is set, Kubes skips the Docker build phase. You can also set `config.image = false` to simply disable image building.
|
34
34
|
|
35
35
|
## 3. Built Docker Image
|
36
36
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
---
|
2
|
-
title: Multiple
|
3
|
-
nav_text: Multiple
|
2
|
+
title: Multiple Environments with Layering
|
3
|
+
nav_text: Multiple Environments
|
4
4
|
categories: patterns
|
5
5
|
---
|
6
6
|
|
7
|
-
You can use Kubes to easily create multiple
|
7
|
+
You can use Kubes to easily create multiple environments with the same YAML configs. This is thanks to [Kubes Layering]({% link _docs/layering.md %}). We'll walk through an example to help understand how it works.
|
8
8
|
|
9
|
-
## Creating Multiple
|
9
|
+
## Creating Multiple Environments
|
10
10
|
|
11
|
-
To create multiple
|
11
|
+
To create multiple environments like dev and prod just change KUBES_ENV. Example:
|
12
12
|
|
13
13
|
KUBES_ENV=dev kubes deploy
|
14
14
|
KUBES_ENV=prod kubes deploy
|
@@ -17,7 +17,7 @@ Different env files will be layered and merged to produce YAML files specific to
|
|
17
17
|
|
18
18
|
## Project Structure
|
19
19
|
|
20
|
-
Here's an example structure, so we can understand how layering works to create multiple
|
20
|
+
Here's an example structure, so we can understand how layering works to create multiple environments.
|
21
21
|
|
22
22
|
.kubes/resources/
|
23
23
|
├── base
|
@@ -78,12 +78,12 @@ Multiple resources layering structure.
|
|
78
78
|
|
79
79
|
.kubes/resources/
|
80
80
|
├── base
|
81
|
-
│ ├── all.
|
82
|
-
│ └── deployment.
|
81
|
+
│ ├── all.yaml # SINGULAR
|
82
|
+
│ └── deployment.yaml # SINGULAR
|
83
83
|
└── web
|
84
|
-
├── deployments
|
85
|
-
│ ├── dev.
|
86
|
-
│ └── prod.
|
87
|
-
└── deployments.
|
84
|
+
├── deployments # PLURAL
|
85
|
+
│ ├── dev.yaml # SINGULAR
|
86
|
+
│ └── prod.yaml # SINGULAR
|
87
|
+
└── deployments.yaml # PLURAL
|
88
88
|
|
89
89
|
The main difference is the pluralized filenames.
|
data/lib/kubes/cli/compile.rb
CHANGED
@@ -16,7 +16,7 @@ class Kubes::CLI
|
|
16
16
|
|
17
17
|
# auto build docker image and push image if kubes docker build not yet called
|
18
18
|
def build_docker_image
|
19
|
-
return if File.exist?(
|
19
|
+
return if File.exist?(Kubes.config.state.path)
|
20
20
|
Build.new(@options).run
|
21
21
|
end
|
22
22
|
end
|
data/lib/kubes/command.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "base64"
|
2
|
+
require "json"
|
2
3
|
|
3
4
|
module Kubes::Compiler::Shared
|
4
5
|
module Helpers
|
@@ -17,11 +18,12 @@ module Kubes::Compiler::Shared
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def built_image_helper
|
20
|
-
path = Kubes.config.state.
|
21
|
+
path = Kubes.config.state.path
|
21
22
|
unless File.exist?(path)
|
22
23
|
raise Kubes::MissingDockerImage.new("Missing file with docker image built by kubes: #{path}. Try first running: kubes docker build")
|
23
24
|
end
|
24
|
-
IO.read(path)
|
25
|
+
data = JSON.load(IO.read(path))
|
26
|
+
data['image']
|
25
27
|
end
|
26
28
|
|
27
29
|
def with_extra(value)
|
data/lib/kubes/config.rb
CHANGED
@@ -39,7 +39,7 @@ module Kubes
|
|
39
39
|
config.skip = []
|
40
40
|
|
41
41
|
config.state = ActiveSupport::OrderedOptions.new
|
42
|
-
config.state.
|
42
|
+
config.state.path = "#{Kubes.root}/.kubes/state/#{Kubes.env}/data.json"
|
43
43
|
|
44
44
|
config.suffix_hash = true # append suffix hash to ConfigMap and Secret
|
45
45
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "json"
|
2
|
+
|
1
3
|
module Kubes::Docker::Strategy
|
2
4
|
module ImageName
|
3
5
|
extend Memoist
|
@@ -13,12 +15,13 @@ module Kubes::Docker::Strategy
|
|
13
15
|
# Only when a new docker build command gets run will the image name state be updated.
|
14
16
|
def store_image_name
|
15
17
|
FileUtils.mkdir_p(File.dirname(image_state_path))
|
16
|
-
|
18
|
+
text = JSON.pretty_generate(image: @@image_name)
|
19
|
+
IO.write(image_state_path, text)
|
17
20
|
end
|
18
21
|
|
19
22
|
# output can get entirely wiped so dont use that folder
|
20
23
|
def image_state_path
|
21
|
-
Kubes.config.state.
|
24
|
+
Kubes.config.state.path
|
22
25
|
end
|
23
26
|
|
24
27
|
# full_image - Includes the tag. Examples:
|
@@ -33,7 +36,8 @@ module Kubes::Docker::Strategy
|
|
33
36
|
logger.error "ERROR: Unable to find #{image_state_path} which contains the last docker image name built with kubes build. Please run `kubes docker build` first."
|
34
37
|
exit 1
|
35
38
|
end
|
36
|
-
IO.read(image_state_path)
|
39
|
+
data = JSON.load(IO.read(image_state_path))
|
40
|
+
data['image']
|
37
41
|
end
|
38
42
|
|
39
43
|
@@timestamp = Time.now.strftime('%Y-%m-%dT%H-%M-%S')
|
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.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|