kubes 0.3.3 → 0.3.4

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: acd8b3dbc7ee3cbefbfe9f649c00ec37c7eaefb3ea281f056b3cf720e85f68cf
4
- data.tar.gz: 1f9c1ba6f9a6626343239ac267a8f8ccd3c385a09f49f48e471821db084a5ade
3
+ metadata.gz: c14d045b8c029e76e1c001f26a0b77c97ecdabc45ddc964660372f2170f95690
4
+ data.tar.gz: 36a0b622a75cc18e74d78537a2a3f421e15de150cb89978434a58d31c37b799b
5
5
  SHA512:
6
- metadata.gz: 9b5bc20d0bd43ee19f204a4dc692b9e4c71c69a3b490575eb397583187ff2e4a401456a943ceae2c3523a8ba42f2f9456809ed538b65dd0d319c0d48fa4318db
7
- data.tar.gz: 1a3b59c9a047f75acbf79be98a104c3109f6da3a6c57bed29511fe77ba537e2ceb044f3fcae800e29bbdaed171ae8653c0c0554c2b90039135d1bc93f021d94e
6
+ metadata.gz: cd0f40a09c2909be4820c0575d6a8ef850b1977e21cd5d040cb82cb11411500a136608035635f743cb1a967116913856fc5e7997f3fef511b5c07d94d5fe4458
7
+ data.tar.gz: 9f29e9bf7a4615bb2a9864b9acdc9aa83b70583b5743decd5e8c6bac1b85b49bfc90a724403765afe2a86fa1cd1819cccedc53b7b91d6e858a20ececf2630f6a
@@ -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.3.4]
7
+ - #24 fix namespace newline and logs for single container
8
+ - #23 init namespace option
9
+
6
10
  ## [0.3.3]
7
11
  - #22 logs -c option. fix kubes logs for pods with multiple containers
8
12
 
@@ -6,6 +6,7 @@ class Kubes::CLI
6
6
  [:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"],
7
7
  [:type, aliases: ["t"], default: "yaml", desc: "Type: dsl or yaml"],
8
8
  [:repo, required: true, desc: "Docker repo name. Example: user/repo. Configures .kubes/config.rb"],
9
+ [:namespace, aliases: ["n"], desc: "Namespace to use, defaults to the app option"],
9
10
  ]
10
11
  end
11
12
 
@@ -17,6 +18,37 @@ class Kubes::CLI
17
18
  @options[:app]
18
19
  end
19
20
 
21
+ def namespace
22
+ @options[:namespace] || @options[:app]
23
+ end
24
+
25
+ def excludes
26
+ if namespace == "default"
27
+ case options[:type]
28
+ when "dsl"
29
+ %w[
30
+ namespace.rb.tt
31
+ ]
32
+ else
33
+ %w[
34
+ all.yaml.tt
35
+ namespace.yaml.tt
36
+ ]
37
+ end
38
+ else
39
+ []
40
+ end
41
+ end
42
+
43
+ def directory_options
44
+ if excludes.empty?
45
+ {}
46
+ else
47
+ pattern = Regexp.new(excludes.join('|'))
48
+ {exclude_pattern: pattern }
49
+ end
50
+ end
51
+
20
52
  public
21
53
  def create_dockefile
22
54
  return if File.exist?("Dockerfile")
@@ -32,13 +64,13 @@ class Kubes::CLI
32
64
  def create_dsl_files
33
65
  return unless @options[:type] == "dsl"
34
66
  set_source("dsl")
35
- directory ".", "."
67
+ directory ".", ".", directory_options
36
68
  end
37
69
 
38
70
  def create_yaml_files
39
71
  return if @options[:type] == "dsl"
40
72
  set_source("yaml")
41
- directory ".", "."
73
+ directory ".", ".", directory_options
42
74
  end
43
75
 
44
76
  def message
@@ -10,8 +10,9 @@ class Kubes::CLI
10
10
  ns = metadata['namespace']
11
11
 
12
12
  follow = " -f" if @options[:follow]
13
- c = container(deployment)
14
- sh("kubectl logs deployment/#{name}#{follow} -n #{ns} -c #{c}")
13
+ container = container(deployment)
14
+ c = " -c #{container}" if container
15
+ sh("kubectl logs deployment/#{name}#{follow} -n #{ns}#{c}")
15
16
  end
16
17
 
17
18
  private
@@ -1,3 +1,3 @@
1
1
  module Kubes
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -1,2 +1,7 @@
1
- namespace "<%= app %>"
1
+ <%
2
+ unless namespace == "default"
3
+ namespace_line = %Q|namespace "#{namespace}"\n|
4
+ end
5
+ -%>
6
+ <%= namespace_line if namespace_line -%>
2
7
  labels(app: "<%= app %>")
@@ -1,2 +1,2 @@
1
- name "<%= app %>"
1
+ name "<%= namespace %>"
2
2
  labels(app: "<%= app %>")
@@ -1,2 +1,2 @@
1
1
  metadata:
2
- namespace: <%= app %>
2
+ namespace: <%= namespace %>
@@ -1,6 +1,6 @@
1
1
  apiVersion: v1
2
2
  kind: Namespace
3
3
  metadata:
4
- name: <%= app %>
4
+ name: <%= namespace %>
5
5
  labels:
6
6
  app: <%= app %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen