kubes 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db6959c3513133da9d5340dc8c332e15f86be47e5f72d47188243fafb21b3bd0
4
- data.tar.gz: 94762322cb38b47c1d4167060545012dd6416515628801efdd969fc8dd189b91
3
+ metadata.gz: 895d21705a31fe0ae39b31e41f8896067315d73ddd85f560b6432ff995b8046e
4
+ data.tar.gz: f15fa3e3aae9a06b92be81e99ff7c5f3db3b885979df789339ffb0b5b6beb45e
5
5
  SHA512:
6
- metadata.gz: 9a506b81df303fd915146596f792fcbd6b0ede5b93c81d6bcd75f0fa3123a47129086969decef3d44b273e6740d518facf91053c8f10e61ad3de6698c673a0e9
7
- data.tar.gz: f2ddb1238b542b0279069a5b7417d4ed458384729cdd3859511b55222161c6443131ade97534f91fe19df9f20fae3074943a40120a3470bbf91142cd8d419a89
6
+ metadata.gz: be41b9ed48ede64f2574952be9e3b31fa8817a475780c27bda5159ea7e6ff3e01d8705d6bd3cb6cf98fb10d29a50dde470416a9da70bc5583c3f23f1f0614786
7
+ data.tar.gz: a5c9c3800ad8860779ed1e6eaefb37ea530e279ba20b0358cb5290c3a8513ecb2753dd4db4b622d832d98a7f7169fc5de49a3d06130d76341094d4c9b959a412
data/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
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.9.2] - 2022-10-10
7
+ - [#68](https://github.com/boltops-tools/kubes/pull/68) kubes docker name
8
+ - KUBES_IMAGE_TAG env var override ability
9
+
10
+ ## [0.9.1] - 2022-08-24
11
+ - [#67](https://github.com/boltops-tools/kubes/pull/67) small improvement to show layering: show compiled output path
12
+
6
13
  ## [0.9.0] - 2022-08-24
7
14
  - [#66](https://github.com/boltops-tools/kubes/pull/66) show layering improvements: show resource layers also
8
15
  - only show error if exit_on_fail
@@ -7,6 +7,7 @@ Name | Description | Default
7
7
  auto_prune | Prune and delete old hashed resources like Secret and ConfigMap. | true
8
8
  builder | What docker build command to use. Can use `docker` or `gcloud` to build the Docker image. | docker
9
9
  image | Set a prebuilt Docker image to use. This is optional. Usually, you want to build an image from the Dockerfile. Setting this will change the `docker_image` helper to use a predefined image. See: [Docker Image]({% link _docs/intro/docker-image.md %}) | nil
10
+ image_tag | Normally, kubes will generate an image tag name. You can explicitly set it instead. IE: `latest` | nil
10
11
  kubectl.context | What kubectl context to auto-switch to. | nil
11
12
  kubectl.context_keep | Whether or not to keep the context switched | false
12
13
  kubectl.exit_on_fail.apply | Whether or not continue if the `kubectl apply` fails. Note, can use `KUBES_EXIT_ON_FAIL=0` env var to set to false. | true
@@ -8,7 +8,11 @@ Kube's Layering abilities are so powerful that they can be difficult to debug wh
8
8
 
9
9
  ## Enable Logging
10
10
 
11
- You can debug layers by turning a config to show the **found** layers. Currently, only variables layering is shown.
11
+ You can debug layers by setting `KUBES_LAYERING_SHOW=1`.
12
+
13
+ export KUBES_LAYERING_SHOW=1
14
+
15
+ You can also turn on show layering with a config.
12
16
 
13
17
  .kubes/config.rb
14
18
 
@@ -21,13 +25,13 @@ end
21
25
  This will show the **found** layers.
22
26
 
23
27
  $ kubes compile
24
- Compiling .kubes/resources/shared/namespace.yaml
25
- .kubes/variables/base.rb
26
- .kubes/variables/dev.rb
27
28
  Compiling .kubes/resources/web/deployment.yaml
28
- .kubes/variables/base.rb
29
- .kubes/variables/dev.rb
30
- Compiling .kubes/resources/web/service.yaml
29
+ Resource layers:
30
+ .kubes/resources/base/all.yaml
31
+ .kubes/resources/base/deployment.yaml
32
+ .kubes/resources/web/deployment.yaml
33
+ .kubes/resources/web/deployment/dev.yaml
34
+ Variables layers:
31
35
  .kubes/variables/base.rb
32
36
  .kubes/variables/dev.rb
33
37
 
@@ -37,18 +41,12 @@ If you want to also see all the considered layers use `KUBES_LAYERING_SHOW_ALL=1
37
41
 
38
42
  $ export KUBES_LAYERING_SHOW_ALL=1
39
43
  Compiling .kubes/resources/web/deployment.yaml
40
- Rendering .kubes/resources/web/deployment.yaml
41
- .kubes/variables/base.rb
42
- .kubes/variables/dev.rb
43
- .kubes/variables/base/all.rb
44
- .kubes/variables/base/all/dev.rb
45
- .kubes/variables/base/deployment.rb
46
- .kubes/variables/base/deployment/base.rb
47
- .kubes/variables/base/deployment/dev.rb
48
- .kubes/variables/web/deployment.rb
49
- .kubes/variables/web/deployment/base.rb
50
- .kubes/variables/web/deployment/dev.rb
51
- Rendering .kubes/resources/base/all.yaml
44
+ Resource layers:
45
+ .kubes/resources/base/all.yaml
46
+ .kubes/resources/base/deployment.yaml
47
+ .kubes/resources/web/deployment.yaml
48
+ .kubes/resources/web/deployment/dev.yaml
49
+ Variables layers:
52
50
  .kubes/variables/base.rb
53
51
  .kubes/variables/dev.rb
54
52
  .kubes/variables/base/all.rb
@@ -9,7 +9,25 @@ class Kubes::CLI
9
9
  push if options[:push]
10
10
  end
11
11
 
12
- desc "push IMAGE", "Push the docker image."
12
+ desc "name", "Print the full docker image with tag that was last generated."
13
+ long_desc Help.text("docker:name")
14
+ option :name, type: :boolean, default: false
15
+ def name
16
+ builder = Kubes::Docker.new(options, "build")
17
+ name = builder.read_image_name
18
+ if name
19
+ puts name
20
+ else
21
+ $stderr.puts(<<~EOL)
22
+ WARN: docker image has not yet been built. Please first run:
23
+
24
+ kubes docker build
25
+
26
+ EOL
27
+ end
28
+ end
29
+
30
+ desc "push", "Push the docker image."
13
31
  long_desc Help.text("docker:push")
14
32
  option :push, type: :boolean, default: false
15
33
  def push
@@ -8,6 +8,7 @@ class Kubes::Compiler::Strategy
8
8
  hash = Kubes.deep_merge!(pre_layer, main)
9
9
  Kubes.deep_merge!(hash, post_layer)
10
10
  end
11
+ logger.info "Compiled .kubes/output/#{@save_file}" if Kubes.config.layering.show
11
12
  Result.new(@save_file, data)
12
13
  end
13
14
 
@@ -24,7 +24,7 @@ module Kubes
24
24
 
25
25
  write_full
26
26
 
27
- logger.info "Compiled .kubes/resources files to .kubes/output" if show_compiled_message?
27
+ logger.info "Compiled .kubes/resources files to .kubes/output" if show_compiled_message?
28
28
  end
29
29
 
30
30
  def resources
@@ -51,7 +51,7 @@ module Kubes
51
51
  IO.write(dest, content)
52
52
  end
53
53
 
54
- logger.debug "Compiled #{pretty(dest)}"
54
+ logger.debug "Written #{pretty(dest)}"
55
55
  end
56
56
 
57
57
  def write_full
@@ -62,7 +62,7 @@ module Kubes
62
62
  path = "#{Kubes.root}/.kubes/tmp/full.yaml" # write to tmp instead of output so it doesnt interfere with kubes get
63
63
  FileUtils.mkdir_p(File.dirname(path))
64
64
  IO.write(path, content)
65
- logger.debug "Compiled #{pretty(path)}"
65
+ logger.debug "Written #{pretty(path)}"
66
66
  end
67
67
 
68
68
  def show_compiled_message?
@@ -19,6 +19,12 @@ module Kubes::Docker::Strategy
19
19
  IO.write(image_state_path, text)
20
20
  end
21
21
 
22
+ def read_image_name
23
+ return unless File.exist?(image_state_path)
24
+ data = IO.read(image_state_path).strip
25
+ JSON.load(data)['image']
26
+ end
27
+
22
28
  # output can get entirely wiped so dont use that folder
23
29
  def image_state_path
24
30
  Kubes.config.state.path
@@ -43,7 +49,8 @@ module Kubes::Docker::Strategy
43
49
  @@timestamp = Time.now.strftime('%Y-%m-%dT%H-%M-%S')
44
50
  def generate_name
45
51
  # IE: tongueroo/demo:kubes-
46
- ["#{repo}:kubes-#{@@timestamp}", git_sha].compact.join('-')
52
+ tag = ENV['KUBES_IMAGE_TAG'] || Kubes.config.image_tag || ["kubes-#{@@timestamp}", git_sha].compact.join('-')
53
+ "#{repo}:#{tag}"
47
54
  end
48
55
 
49
56
  def repo
data/lib/kubes/docker.rb CHANGED
@@ -15,5 +15,8 @@ module Kubes
15
15
  klass_name = "Kubes::Docker::Strategy::#{@name.camelize}::#{strategy}"
16
16
  klass_name.constantize
17
17
  end
18
+
19
+ # For `kubes docker image` and read_image_name method
20
+ include Kubes::Docker::Strategy::ImageName
18
21
  end
19
22
  end
data/lib/kubes/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kubes
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.2"
3
3
  end
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.9.0
4
+ version: 0.9.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: 2022-08-24 00:00:00.000000000 Z
11
+ date: 2022-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -855,7 +855,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
855
855
  - !ruby/object:Gem::Version
856
856
  version: '0'
857
857
  requirements: []
858
- rubygems_version: 3.3.12
858
+ rubygems_version: 3.3.21
859
859
  signing_key:
860
860
  specification_version: 4
861
861
  summary: 'Kubernetes Deployment Tool: build docker image, compile Kubernetes YAML