kubernetes_helper 1.12.7 → 1.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/kubernetes_helper/core.rb +3 -1
- data/lib/kubernetes_helper/version.rb +1 -1
- data/lib/kubernetes_helper.rb +3 -1
- data/lib/templates/deployment.yml +2 -2
- data/lib/templates/settings.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 071cbd7243cf091dddbb90ae098afb3af88e8469c0b5db41a22f631907f1e529
|
4
|
+
data.tar.gz: c3d0a6f4bf022441862921cfca4fd3d8be219309a23312c15f693c15ce88f1b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc4adcdfc85d9b12cbfaf7d4b523a9585a12e9f6da55c140429e818aa05ab70380c1c45fd6209fb5a25c7ff59b28e73e45178a051031a4268321382a9f6afc03
|
7
|
+
data.tar.gz: 639e58559bb0768a78fd21e5d568db6c40747d225975679d6cd6873da52d388bd086bb53d0212b8828dd76ed4e562a600277004a41a3a121126db1b79d51a5d7
|
data/README.md
CHANGED
@@ -70,13 +70,17 @@ Below settings are used when configuring the application in the k8s environment
|
|
70
70
|
- `deployment.replicas_range` (Array<min, max, cpu_percentage>, Optional): Defines the minimum and the maximum number of pods that could automatically be created when `CPUUtilizationPercentage` is above than defined. Sample: `[1, 3, 50]`
|
71
71
|
- `deployment.cloud_secret_name` (String, Optional): K8s credentials name where cloud secrets will be saved (includes permission like DB). Sample: `my-app-cloud-secret`
|
72
72
|
- `deployment.cloud_sql_instance` (String, Optional): Cloud sql instance name. Sample: `my-project:europe-west1:my-instance-name=tcp:5432` (5432 => postgres, 3306 => mysql)
|
73
|
-
- `deployment.env_vars` (Hash, optional): List of static env variables (Note: Not recommended for sensitive values).
|
73
|
+
- `deployment.env_vars` (Hash, optional): List of static or external env variables (Note: Not recommended for sensitive values).
|
74
|
+
Sample: `{ 'RAILS_ENV' => 'production' }`
|
75
|
+
Example for external secrets: `{ PAPERTRAIL_PORT: { name: 'common_secrets', key: 'paper_trail_port' }` will import `paper_trail_port` value from `common_secrets` yml as `PAPERTRAIL_PORT`
|
76
|
+
|
74
77
|
- `deployment.command` (String, Optional): Bash command to be used for web containers. Sample: `rails s -b 0.0.0.0`
|
75
78
|
- `deployment.liveness_path` (String, Optional): Relative path to be used for readiness and liveness checker of the web app. Sample: `/check_liveness`
|
76
79
|
- `deployment.custom_volumes` (Hash<name: path>, Optional): Custom volumes to be mounted.
|
77
80
|
Sample volume: `{ my_volume: { kind: 'hostPath', mount_path: '/', settings: { path: '..', type: 'Directory' } } }`
|
78
81
|
Sample secret: `{ pubsub_secret: { kind: 'secret', mount_path: '/secrets/pubsub', settings: { secretName: 'my_secret_name' } } }`
|
79
82
|
- `deployment.log_container` (Boolean, default true): Permits to auto include logs container to print all logs from logs/*.log to stdout (required for papertrail using fluentd)
|
83
|
+
- `deployment.log_folder` (String, default `/app/log`): Logs to be printed from
|
80
84
|
- `deployment.app_port` (Integer, default 3000): Application port number
|
81
85
|
|
82
86
|
- `deployment.job_name` (String, optional): Job deployment name (Note: Underscores are not accepted). Sample: `my-app-job`. Note: This deployment is created only if this value is present
|
@@ -83,9 +83,11 @@ module KubernetesHelper
|
|
83
83
|
|
84
84
|
def static_env_vars
|
85
85
|
(config_values.dig(:deployment, :env_vars) || {}).map do |key, value|
|
86
|
+
external = value.is_a?(Hash)
|
87
|
+
value = { 'secretKeyRef' => { 'name' => value[:name], 'key' => value[:key].to_s } } if external
|
86
88
|
{
|
87
89
|
'name' => key.to_s,
|
88
|
-
'value' => value
|
90
|
+
(external ? 'valueFrom' : 'value') => value
|
89
91
|
}
|
90
92
|
end
|
91
93
|
end
|
data/lib/kubernetes_helper.rb
CHANGED
@@ -48,7 +48,7 @@ documents:
|
|
48
48
|
<% if deployment.log_container %>
|
49
49
|
- &log_volume
|
50
50
|
name: applog
|
51
|
-
mountPath:
|
51
|
+
mountPath: <%= deployment.log_folder %>
|
52
52
|
<% end %>
|
53
53
|
|
54
54
|
<% if deployment.cloud_secret_name %>
|
@@ -80,7 +80,7 @@ documents:
|
|
80
80
|
- &logs_container # print to stdout all log files
|
81
81
|
name: print-logs
|
82
82
|
image: busybox
|
83
|
-
command: [/bin/sh, -c, 'until find
|
83
|
+
command: [/bin/sh, -c, 'until find <%= deployment.log_folder %>/*.log; do sleep 1; done; tail -n+1 -f <%= deployment.log_folder %>/*.log']
|
84
84
|
env: []
|
85
85
|
volumeMounts:
|
86
86
|
- *log_volume
|
data/lib/templates/settings.rb
CHANGED
@@ -17,6 +17,12 @@ settings = {
|
|
17
17
|
# job_services: ['sidekiq', 'cron'] # list of linux services needed.
|
18
18
|
# custom_volumes: { my_volume: { kind: 'hostPath', mount_path: '/', settings: { path: '..', type: 'Directory' } } }
|
19
19
|
},
|
20
|
+
secrets: {
|
21
|
+
name: "#{app_name}-secrets"
|
22
|
+
},
|
23
|
+
service: {
|
24
|
+
name: app_name,
|
25
|
+
},
|
20
26
|
ingress: {
|
21
27
|
name: "#{app_name}-ingress",
|
22
28
|
ip_name: "#{app_name}-static-ip", # nil if static ip is not necessary
|
@@ -32,12 +38,6 @@ settings = {
|
|
32
38
|
docker_build_cmd: 'build -f Dockerfile', # using target: 'build --target production -f Dockerfile '
|
33
39
|
update_deployment: false # permits to reload secrets and re-generate/update deployment yaml
|
34
40
|
},
|
35
|
-
secrets: {
|
36
|
-
name: "#{app_name}-secrets"
|
37
|
-
},
|
38
|
-
service: {
|
39
|
-
name: app_name,
|
40
|
-
}
|
41
41
|
}
|
42
42
|
|
43
43
|
KubernetesHelper.settings(settings)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kubernetes_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- owen2345
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erb
|