mina-kubernetes 2.7.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +20 -14
- data/lib/mina/kubernetes/version.rb +1 -1
- data/lib/mina/kubernetes.rb +1 -1
- data/mina-kubernetes.gemspec +1 -1
- 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: c9e6f3074267ba8ee5a81ea32236f2710b7cd5279cca64ca2307fb14002d4f8f
|
4
|
+
data.tar.gz: e08d008d5f4994b0159548146df2e94dfc0e993dd3c2808f1c63ab7a83d5df74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2435a682a59c5d1bca7a6257eb352a34b92900dfea28ef975e9b85b7fece25e14b99f0b2af751d191539b90ac286bd13f075a4be0177c7a98fde6297e3ead49
|
7
|
+
data.tar.gz: 760d3d1981dc80c48fb7652a7f97fd142bacbf616a3d8e45da7ac91b412842fcde3cbf0738a6e73abd57180847dbec916ed5c6ccf72cc59be6455e34107473c0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 3.0.0
|
2
|
+
|
3
|
+
*Breaking change*
|
4
|
+
|
5
|
+
- Depend on [Krane 3.0.0](https://github.com/Shopify/krane/blob/master/CHANGELOG.md#300)
|
6
|
+
|
7
|
+
## 2.7.1
|
8
|
+
|
9
|
+
*Fixes*
|
10
|
+
|
11
|
+
- Use `--dry-run=client` instead of deprecated `--dry-run` with kubectl to create/update namespace
|
12
|
+
|
1
13
|
## 2.7.0
|
2
14
|
|
3
15
|
*Enhancements*
|
data/README.md
CHANGED
@@ -32,16 +32,6 @@ 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, for instance `config/deploy/production/webserver.yml.erb` and `config/deploy/production/backgroundjobs.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
|
-
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
35
|
When running `mina production deploy`, it'll check the image is available on the repository and then call the `krane` executable 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
36
|
|
47
37
|
### EJSON Encrypted secrets
|
@@ -59,15 +49,15 @@ Refer to https://github.com/Shopify/krane#usage for a complete set of options
|
|
59
49
|
|
60
50
|
## Tasks available
|
61
51
|
|
62
|
-
|
52
|
+
### `kubernetes:deploy`
|
63
53
|
|
64
54
|
Creates the namespace on cluster if it doesn't exist, prompts for a git branch if no image tag is already specified in stage file, then applies all resources to cluster after checking tagged image is available.
|
65
55
|
|
66
|
-
|
56
|
+
### `kubernetes:bash`
|
67
57
|
|
68
58
|
Prompts for branch unless image tag is set, then spins up a temporary pod with the image and opens up a remote bash terminal.
|
69
59
|
|
70
|
-
|
60
|
+
### `kubernetes:command`
|
71
61
|
|
72
62
|
Prompts for branch unless image tag is set, then spins up a temporary pod with the image and runs the command given in the task variable `command`, for instance with `set :command, "rails console"`. Environment variables can also be passed by defining`env_hash`, i.e. `set :env_hash, {"RAILS_ENV" => "production", "MY_VAR" => "abcd123"}`
|
73
63
|
|
@@ -79,7 +69,23 @@ A `kubectl_pod_overrides` task option is available to pass a value to the `overr
|
|
79
69
|
|
80
70
|
Confirms and delete all resources on cluster under namespace.
|
81
71
|
|
82
|
-
##
|
72
|
+
## Advanced usage examples
|
73
|
+
|
74
|
+
### Deploy environment variable(s) as secret
|
75
|
+
|
76
|
+
Using Rails and its encrypted credentials feature, the `RAILS_MASTER_KEY` environment variable can be deployed as a Kubernetes secrets by adding a `secrets.yml.erb` file like below:
|
77
|
+
```yml
|
78
|
+
apiVersion: v1
|
79
|
+
kind: Secret
|
80
|
+
metadata:
|
81
|
+
name: secrets
|
82
|
+
data:
|
83
|
+
RAILS_MASTER_KEY: <%= Base64.strict_encode64(File.read("#{Dir.pwd}/config/credentials/production.key").strip) %>
|
84
|
+
```
|
85
|
+
|
86
|
+
Krane will deploy it before other resources so it's already available when running pods/jobs/deployments which reference this variable such as Rails migrations.
|
87
|
+
|
88
|
+
### Run an interactive rails console on non-preemptible GKE node
|
83
89
|
|
84
90
|
Add the following to your `deploy.rb`
|
85
91
|
``` ruby
|
data/lib/mina/kubernetes.rb
CHANGED
@@ -62,7 +62,7 @@ def create_namespace_on_cluster
|
|
62
62
|
run :local do
|
63
63
|
comment "Create/update namespace on Kubernetes cluster..."
|
64
64
|
proxy_env = "HTTPS_PROXY=#{fetch(:proxy)}" if fetch(:proxy)
|
65
|
-
command "kubectl create namespace #{fetch(:namespace)} --dry-run -o yaml | #{proxy_env} kubectl apply -f - --context=#{fetch(:kubernetes_context)}"
|
65
|
+
command "kubectl create namespace #{fetch(:namespace)} --dry-run=client -o yaml | #{proxy_env} kubectl apply -f - --context=#{fetch(:kubernetes_context)}"
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
data/mina-kubernetes.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
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 'krane', '~>
|
27
|
+
spec.add_runtime_dependency 'krane', '~> 3'
|
28
28
|
spec.add_runtime_dependency 'tty-prompt'
|
29
29
|
spec.add_runtime_dependency 'tty-spinner'
|
30
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:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antoine Sabourin
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3'
|
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: '
|
82
|
+
version: '3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: tty-prompt
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,7 +126,7 @@ homepage: https://github.com/streemau/mina-kubernetes
|
|
126
126
|
licenses:
|
127
127
|
- MIT
|
128
128
|
metadata: {}
|
129
|
-
post_install_message:
|
129
|
+
post_install_message:
|
130
130
|
rdoc_options: []
|
131
131
|
require_paths:
|
132
132
|
- lib
|
@@ -141,8 +141,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
|
-
rubygems_version: 3.
|
145
|
-
signing_key:
|
144
|
+
rubygems_version: 3.2.15
|
145
|
+
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: Mina plugin to streamline deployment of resources to Kubernetes cluster
|
148
148
|
test_files: []
|