kubes 0.7.9 → 0.7.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ee8de54a6c00bee7cbcfec249f26c5adc0beaabe0ab5d47d87d2a26fb673f71
4
- data.tar.gz: 5c2330ca0688b565f0db169e3c3ce776e51d59fc26375c2ebeee429939a81425
3
+ metadata.gz: 6529d951f35f31cf105591f8d5ea0f3b8819e358f0b3388f22d17340af1f2bbf
4
+ data.tar.gz: d1c6e87a899a75a8f7078046c4058c69c46328c3b7138b4a934dae7fe287be4d
5
5
  SHA512:
6
- metadata.gz: 77ca91f3c0ce775bb69f9ab3630fac958625426ee719186a1fc966262d633d31eaccf98fc7052e90f1c62f38c3ac0a365238cb17c769429c9100020a7d9e99c0
7
- data.tar.gz: 8b8a284692016d2487bdcb281d757511f2bb5bc2d8db4614de0b1a9ff1c97075d38bf4a9eefa757c005f8244548d5a6ba606163315838f0f6600ad338ef38643
6
+ metadata.gz: 245ca41ceec0499da84ef056b19ad6f99e422f3c1013718d3e466128aeab6503fc1d0c3be19892633dab1acff1865816885fa6f7d1589c60d5ebe65cfaffab50
7
+ data.tar.gz: 551a265282d0a6af874517382859492bbe27bcd201790e94f3f7a9540d6ffeb4b6dc678b0aa1cfeab4e5983a0a591625da21ef7ec59bb01fe8c33fdbf681e8c2
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.7.10] - 2021-12-18
7
+ - [#56](https://github.com/boltops-tools/kubes/pull/56) New hook generator
8
+ - [#57](https://github.com/boltops-tools/kubes/pull/57) Fix activesupport require
9
+ - add nokogiri dependency. looks like aws-sdk removed it and its breaking specs
10
+ - hook generator docs
11
+ - new hook generator
12
+
6
13
  ## [0.7.9] - 2021-11-07
7
14
  - [#55](https://github.com/boltops-tools/kubes/pull/55) make helper methods available in variables files
8
15
 
data/docs/.gitignore CHANGED
@@ -3,3 +3,4 @@ _site
3
3
  .jekyll-metadata
4
4
  .jekyll-cache
5
5
  Gemfile.lock
6
+ _config-dev.yml
data/docs/Gemfile CHANGED
@@ -7,6 +7,7 @@ gem "opal-browser"
7
7
  gem "opal-jquery"
8
8
  gem "rake"
9
9
  gem "rerun"
10
+ gem "webrick"
10
11
 
11
12
  # GitHub pages does not support this plugin.
12
13
  # GitHub pages will not serve zipped assets even if we precompress them before hand.
data/docs/_config.yml CHANGED
@@ -69,3 +69,5 @@ defaults:
69
69
 
70
70
  plugins_dir:
71
71
  # - jekyll-gzip - GitHub pages does not support this plugin.
72
+
73
+ ads_url: "https://ads.boltops.com"
@@ -4,6 +4,8 @@ nav_text: Docker
4
4
  categories: hooks
5
5
  ---
6
6
 
7
+ {% include config/hooks/generator.md type="docker" %}
8
+
7
9
  Here are some examples of running custom hooks before and after the docker commands.
8
10
 
9
11
  ## Build Hooks
@@ -0,0 +1,16 @@
1
+ ---
2
+ title: Hook Generator
3
+ nav_text: Generator
4
+ categories: hooks
5
+ order: 9
6
+ ---
7
+
8
+ ## Examples
9
+
10
+ $ kubes new hook docker
11
+ create .kubes/config/hooks/docker.rb
12
+ $ kubes new hook kubectl
13
+ create .kubes/config/hooks/kubectl.rb
14
+ $ kubes new hook kubes
15
+ create .kubes/config/hooks/kubes.rb
16
+ $
@@ -4,6 +4,8 @@ nav_text: Kubectl
4
4
  categories: hooks
5
5
  ---
6
6
 
7
+ {% include config/hooks/generator.md type="kubectl" %}
8
+
7
9
  You can use hooks to run scripts at any part of the `kubectl` commands. Here's an example of running a script before and after the `kubectl apply` command for the `web/deployment` resource.
8
10
 
9
11
  .kubes/config/hooks/kubectl.rb
@@ -4,6 +4,8 @@ nav_text: Kubes
4
4
  categories: hooks
5
5
  ---
6
6
 
7
+ {% include config/hooks/generator.md type="kubes" %}
8
+
7
9
  You can use hooks to run scripts at specific steps of the `kubes deploy` lifecycle.
8
10
 
9
11
  ## Lifecycle Hooks
@@ -16,6 +16,7 @@ iam_role = KubesAws::IamRole.new(
16
16
  namespace: "demo-#{Kubes.env}", # defaults to APP-ENV when not set. IE: demo-dev
17
17
  managed_policies: ["AmazonS3ReadOnlyAccess", "AmazonSSMReadOnlyAccess"], # defaults to empty when not set
18
18
  inline_policies: [:secrets_read_only], # See Secrets Read Only Inline Policy at the bottom
19
+ # cluster: "eks-cluster-name", # inferred with kubectl when not set
19
20
  )
20
21
  before("apply",
21
22
  label: "create iam role",
@@ -135,7 +135,7 @@ You can even define your own custom helpers for even more control. See: [Helpers
135
135
 
136
136
  ## Kubes Features
137
137
 
138
- Kubes does a lot more than build YAML files. Here's a list of features:
138
+ Kubes does a lot more than building YAML files. Here's a list of features:
139
139
 
140
140
  {% include intro/features.md %}
141
141
 
@@ -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,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
@@ -16,4 +16,4 @@ Kubes calls docker. Kubes has been tested with docker 18.x-ce+. Generally, it sh
16
16
 
17
17
  ## gcloud
18
18
 
19
- If you are using the [gcloud builder](% link _docs/config/builder.md %), set up and configure the [gcloud cli](https://cloud.google.com/sdk/install).
19
+ If you are using the [gcloud builder]({% link _docs/config/builder.md %}), set up and configure the [gcloud cli](https://cloud.google.com/sdk/install).
@@ -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 %}
@@ -72,7 +72,7 @@
72
72
  </li>
73
73
  <li><a href="{% link _docs/config/hooks.md %}">Hooks</a>
74
74
  <ul>
75
- {% assign docs = site.docs | where: "categories","hooks" %}
75
+ {% assign docs = site.docs | where: "categories","hooks" | sort: "order" %}
76
76
  {% for doc in docs -%}
77
77
  <li><a href="{{ doc.url }}">{{ doc.nav_text }}</a></li>
78
78
  {% endfor %}
@@ -27,9 +27,11 @@
27
27
  </head>
28
28
 
29
29
  <body>
30
+ {% include banner/head.html %}
30
31
  {% include header.html %}
31
32
  {% include content.html %}
32
33
  {% include footer.html %}
34
+ {% include banner/foot.html %}
33
35
  {% include js.html %}
34
36
  </body>
35
37
  </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
 
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 "$@"
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,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
@@ -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/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kubes
2
- VERSION = "0.7.9"
2
+ VERSION = "0.7.10"
3
3
  end
data/lib/kubes.rb CHANGED
@@ -5,6 +5,7 @@ $:.unshift(File.expand_path("../", __FILE__))
5
5
  require "kubes/autoloader"
6
6
  Kubes::Autoloader.setup
7
7
 
8
+ require "active_support"
8
9
  require "active_support/core_ext/class"
9
10
  require "active_support/core_ext/hash"
10
11
  require "active_support/core_ext/string"
@@ -0,0 +1,9 @@
1
+ # Docs: https://kubes.guru/docs/config/hooks/docker/
2
+
3
+ before("build",
4
+ execute: "echo 'docker build before hook'",
5
+ )
6
+
7
+ after("build",
8
+ execute: "echo 'docker build after hook'",
9
+ )
@@ -0,0 +1,11 @@
1
+ # Docs: https://kubes.guru/docs/config/hooks/kubectl/
2
+
3
+ before("apply",
4
+ on: "web/deployment",
5
+ execute: "echo 'before apply hook test'",
6
+ )
7
+
8
+ after("delete",
9
+ on: "web/deployment",
10
+ execute: "echo 'after delete hook test'",
11
+ )
@@ -0,0 +1,9 @@
1
+ # Docs: https://kubes.guru/docs/config/hooks/kubes/
2
+
3
+ before("apply",
4
+ execute: "echo 'kubes before apply hook'",
5
+ )
6
+
7
+ after("apply",
8
+ execute: "echo 'kubes after apply hook'",
9
+ )
@@ -2,7 +2,9 @@ spec:
2
2
  selector:
3
3
  matchLabels:
4
4
  app: <%= app %>
5
+ env: <%= Kubes.env %>
5
6
  template:
6
7
  metadata:
7
8
  labels:
8
9
  app: <%= app %>
10
+ env: <%= Kubes.env %>
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.9
4
+ version: 0.7.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-07 00:00:00.000000000 Z
11
+ date: 2021-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: nokogiri
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rainbow
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -281,6 +295,7 @@ files:
281
295
  - docs/_docs/config/env.md
282
296
  - docs/_docs/config/hooks.md
283
297
  - docs/_docs/config/hooks/docker.md
298
+ - docs/_docs/config/hooks/generator.md
284
299
  - docs/_docs/config/hooks/kubectl.md
285
300
  - docs/_docs/config/hooks/kubes.md
286
301
  - docs/_docs/config/hooks/ruby.md
@@ -386,7 +401,10 @@ files:
386
401
  - docs/_docs/yaml.md
387
402
  - docs/_docs/yaml/multiple-files.md
388
403
  - docs/_docs/yaml/multiple-resources.md
404
+ - docs/_includes/banner/foot.html
405
+ - docs/_includes/banner/head.html
389
406
  - docs/_includes/commands.html
407
+ - docs/_includes/config/hooks/generator.md
390
408
  - docs/_includes/config/hooks/options.md
391
409
  - docs/_includes/content.html
392
410
  - docs/_includes/dsl/methods.md
@@ -435,6 +453,7 @@ files:
435
453
  - docs/_reference/kubes-logs.md
436
454
  - docs/_reference/kubes-new-help.md
437
455
  - docs/_reference/kubes-new-helper.md
456
+ - docs/_reference/kubes-new-hook.md
438
457
  - docs/_reference/kubes-new-resource.md
439
458
  - docs/_reference/kubes-new-variable.md
440
459
  - docs/_reference/kubes-new.md
@@ -578,11 +597,14 @@ files:
578
597
  - lib/kubes/cli/help/deploy.md
579
598
  - lib/kubes/cli/help/exec.md
580
599
  - lib/kubes/cli/help/new/helper.md
600
+ - lib/kubes/cli/help/new/hook.md
581
601
  - lib/kubes/cli/help/new/resource.md
602
+ - lib/kubes/cli/help/new/variable.md
582
603
  - lib/kubes/cli/init.rb
583
604
  - lib/kubes/cli/logs.rb
584
605
  - lib/kubes/cli/new.rb
585
606
  - lib/kubes/cli/new/helper.rb
607
+ - lib/kubes/cli/new/hook.rb
586
608
  - lib/kubes/cli/new/resource.rb
587
609
  - lib/kubes/cli/new/variable.rb
588
610
  - lib/kubes/cli/prune.rb
@@ -683,6 +705,9 @@ files:
683
705
  - lib/templates/dsl/.kubes/resources/web/deployment/prod.rb
684
706
  - lib/templates/dsl/.kubes/resources/web/service.rb
685
707
  - lib/templates/new/helper/file.rb
708
+ - lib/templates/new/hooks/docker.rb
709
+ - lib/templates/new/hooks/kubectl.rb
710
+ - lib/templates/new/hooks/kubes.rb
686
711
  - lib/templates/new/resource/dsl/backend_config.rb
687
712
  - lib/templates/new/resource/dsl/config_map.rb
688
713
  - lib/templates/new/resource/dsl/daemon_set.rb
@@ -796,7 +821,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
796
821
  - !ruby/object:Gem::Version
797
822
  version: '0'
798
823
  requirements: []
799
- rubygems_version: 3.1.6
824
+ rubygems_version: 3.2.32
800
825
  signing_key:
801
826
  specification_version: 4
802
827
  summary: 'Kubernetes Deployment Tool: build docker image, compile Kubernetes YAML