mina-kubernetes 2.0.0 → 2.2.3
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 +4 -4
- data/CHANGELOG.md +18 -1
- data/README.md +24 -6
- data/lib/mina/kubernetes.rb +8 -4
- data/lib/mina/kubernetes/version.rb +2 -2
- data/mina-kubernetes.gemspec +3 -3
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b7a41b6c828e694f7f34d0a6b83b3f968efdeed4933c119841234a7e8ae53cf
|
4
|
+
data.tar.gz: 19c70439dff8af06ec903ab246d4c18b12264cc187ca0f9b9d4841d38f8d80f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5a625f268be5d1babd3322c7dc1781e5bf30e6ec5737b8459e5ee9f811fa720c85cafab6937c7d9a0dbcf1705c5299196cc8251cf16d609f548842df6d8dc93
|
7
|
+
data.tar.gz: 1a16eea518ee1f5ec2a0405053a8a76b0c4cdd4652da431e1e76183b49eb58dafaa937d7ff747dc9f71c8fa2833b79c1e8f4b8f0840abe06ec90b66af5d2f017
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
## 2.2.1 to 2.2.3
|
2
|
+
|
3
|
+
*Fixes*
|
4
|
+
|
5
|
+
- handle nil/undefined options passed to `krane`
|
6
|
+
|
7
|
+
## 2.2.0
|
8
|
+
|
9
|
+
*Enhancements*
|
10
|
+
|
11
|
+
- Using `krane` 1.0.0 (previously `kubernetes-deploy`)
|
12
|
+
- Allow passing of options to `krane`
|
13
|
+
|
14
|
+
## 2.1.0
|
15
|
+
|
16
|
+
Yanked release.
|
17
|
+
|
1
18
|
## 2.0.0
|
2
19
|
|
3
20
|
*Breaking*
|
@@ -7,4 +24,4 @@
|
|
7
24
|
|
8
25
|
*Fixes*
|
9
26
|
|
10
|
-
- Not overriding $KUBE_CONFIG environment variable anymore
|
27
|
+
- Not overriding $KUBE_CONFIG environment variable anymore
|
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# mina-kubernetes
|
2
|
-
Plugin for the [mina](https://github.com/mina-deploy/mina) deployment tool to streamline deployment of resources to Kubernetes
|
2
|
+
Plugin for the [mina](https://github.com/mina-deploy/mina) deployment tool to streamline deployment of resources to Kubernetes clusters, using the [krane](https://github.com/Shopify/krane) gem and [mina-multistage](https://github.com/endoze/mina-multistage) plugin.
|
3
3
|
|
4
|
-
Requires local Docker and [kubectl](https://cloud.google.com/kubernetes-engine/docs/quickstart) with authentication set up to connect to the destination Kubernetes cluster.
|
4
|
+
Requires local Docker and [kubectl](https://cloud.google.com/kubernetes-engine/docs/quickstart) with local authentication set up to connect to the destination Kubernetes cluster as context in your local KUBE_CONFIG. See https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl#generate_kubeconfig_entry for example with Google Kubernetes Engine.
|
5
5
|
|
6
|
-
NB: `docker manifest inspect` is used to check the image is available. This requires experimental features to be enabled in your local Docker config by adding `"experimental": "enabled"` to `~/.docker/config.json`.
|
6
|
+
NB: `docker manifest inspect` is used to check whether the Docker image with requested tag is available. This requires experimental features to be enabled in your local Docker config by adding `"experimental": "enabled"` to `~/.docker/config.json`.
|
7
7
|
If the image repository is not public authentication will need to be set up for your local Docker, for instance see https://cloud.google.com/container-registry/docs/advanced-authentication#gcloud_as_a_docker_credential_helper for images hosted on the Google Cloud Registry
|
8
8
|
|
9
9
|
## Usage
|
10
10
|
|
11
|
-
Add `mina-kubernetes` to your local Gemfile.
|
11
|
+
Add `mina-kubernetes` to your local Gemfile.
|
12
12
|
|
13
13
|
Create a configuration file for mina in `config/deploy.rb` like the one below:
|
14
14
|
```ruby
|
@@ -32,7 +32,25 @@ If `set :image_tag, "my_image_tag"` is also defined, it'll be used to deploy the
|
|
32
32
|
|
33
33
|
Then add `*.yml.erb` Kubernetes resource definition files in the stage folder, i.e. `config/deploy/production/app.yml.erb`. Occurences of `<%= image_repo %>` and `<%= current_sha %>` in these files will be dynamically replaced on deploy by the image repository URL and the latest commit hash of the selected branch on its git origin.
|
34
34
|
|
35
|
-
|
35
|
+
You can also get the RAILS_MASTER_KEY for encrypted credentials deployed as a Kubernetes secrets by adding a secrets.yml.erb like below:
|
36
|
+
```yml
|
37
|
+
apiVersion: v1
|
38
|
+
kind: Secret
|
39
|
+
metadata:
|
40
|
+
name: secrets
|
41
|
+
data:
|
42
|
+
RAILS_MASTER_KEY: <%= Base64.strict_encode64(File.read("#{Dir.pwd}/config/credentials/production.key").strip) %>
|
43
|
+
```
|
44
|
+
|
45
|
+
When running `mina production deploy`, it'll prompt for a branch and check the image tagged with current commit hash from selected branch is available on the repository. Then the `krane` executable is called to fill in the variables in the resource templates and apply them all to the cluster under the given namespace (see https://github.com/Shopify/krane#deploy-walkthrough for more details)
|
46
|
+
|
47
|
+
### Passing options to krane
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
invoke :"kubernetes:deploy", "--no-prune"
|
51
|
+
```
|
52
|
+
|
53
|
+
Refer to https://github.com/Shopify/krane#usage for a complete set of options
|
36
54
|
|
37
55
|
### Tasks available
|
38
56
|
|
@@ -50,4 +68,4 @@ Prompts for branch unless image tag is set, then spins up a temporary pod with t
|
|
50
68
|
|
51
69
|
#### `kubernetes:delete`
|
52
70
|
|
53
|
-
Confirms and delete all resources on cluster under namespace.
|
71
|
+
Confirms and delete all resources on cluster under namespace.
|
data/lib/mina/kubernetes.rb
CHANGED
@@ -9,12 +9,12 @@ set :execution_mode, :pretty
|
|
9
9
|
|
10
10
|
namespace :kubernetes do
|
11
11
|
|
12
|
-
task :deploy do
|
12
|
+
task :deploy, [:options] do |task, args|
|
13
13
|
desc "Set image tag to be latest commit of prompted branch (unless provided) then applies resources to cluster"
|
14
14
|
set_tag_from_branch_commit unless fetch(:image_tag)
|
15
15
|
wait_until_image_ready(fetch(:image_tag))
|
16
16
|
create_namespace_on_cluster
|
17
|
-
apply_kubernetes_resources
|
17
|
+
apply_kubernetes_resources(args[:options])
|
18
18
|
end
|
19
19
|
|
20
20
|
task :bash do
|
@@ -88,9 +88,13 @@ def run_terminal_command(command, env_hash = {})
|
|
88
88
|
system "kubectl run #{label}-#{SecureRandom.hex(4)} --rm -i --tty --restart=Never --context=#{fetch(:kubernetes_context)} --image #{fetch(:image_repo)}:#{fetch(:image_tag)} #{env} -- #{command}"
|
89
89
|
end
|
90
90
|
|
91
|
-
def apply_kubernetes_resources
|
91
|
+
def apply_kubernetes_resources(options)
|
92
92
|
run :local do
|
93
93
|
comment "Apply all Kubernetes resources..."
|
94
|
-
|
94
|
+
filepaths = options&.[](:filepaths) || "config/deploy/#{fetch(:stage)}"
|
95
|
+
render_cmd = "krane render --bindings=image_repo=#{fetch(:image_repo)},image_tag=#{fetch(:image_tag)},namespace=#{fetch(:namespace)} --current_sha #{fetch(:image_tag)} -f #{filepaths}"
|
96
|
+
deploy_cmd = "krane deploy #{fetch(:namespace)} #{fetch(:kubernetes_context)} --stdin "
|
97
|
+
deploy_cmd += options[:deployment_options] if options&.[](:deployment_options)
|
98
|
+
command "#{render_cmd} | #{deploy_cmd}"
|
95
99
|
end
|
96
100
|
end
|
data/mina-kubernetes.gemspec
CHANGED
@@ -21,10 +21,10 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
23
23
|
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
-
|
24
|
+
|
25
25
|
spec.add_runtime_dependency 'mina', '~> 1.0'
|
26
26
|
spec.add_runtime_dependency 'mina-multistage', '~> 1.0'
|
27
|
-
spec.add_runtime_dependency '
|
27
|
+
spec.add_runtime_dependency 'krane', '~> 1.0'
|
28
28
|
spec.add_runtime_dependency 'tty-prompt'
|
29
29
|
spec.add_runtime_dependency 'tty-spinner'
|
30
|
-
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mina-kubernetes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antoine Sabourin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,19 +67,19 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: krane
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
75
|
+
version: '1.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
82
|
+
version: '1.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: tty-prompt
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
|
-
rubygems_version: 3.0.
|
144
|
+
rubygems_version: 3.0.6
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: Mina plugin to streamline deployment of resources to Kubernetes cluster
|