kubernetes_helper 1.12.8 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/kubernetes_helper/core.rb +15 -1
- data/lib/kubernetes_helper/version.rb +1 -1
- data/lib/kubernetes_helper.rb +2 -1
- 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: d7530d88e0f3442c2db0a7fa75d66fd03cac567ea179063ad57d14dcb87e98db
|
4
|
+
data.tar.gz: 21acb0413b2b62935e442a5ac4b03650ff8fc5e6eba8d7bb6daba0c94ecd937d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb2a26a7704e7500a37f06a5d6f56b5dd6979b68283324213e612ace1a9d45204714c761e0737cfd64d9e41700bdcfd6e143d1bcc4c6f957e4f7c29c479410d0
|
7
|
+
data.tar.gz: 59443675ec5cc8705383458ec25de2e3a0fd3488fcb5dbf575cf9375f4b63983d6d01089d8641e5f14be47c99cb5107bb307977858a9dcb29a69aa46789713c6
|
data/README.md
CHANGED
@@ -71,6 +71,10 @@ Below settings are used when configuring the application in the k8s environment
|
|
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
73
|
- `deployment.env_vars` (Hash, optional): List of static env variables (Note: Not recommended for sensitive values). Sample: `{ 'RAILS_ENV' => 'production' }`
|
74
|
+
- `deployment.external_secrets` (Hash, optional): List of env vars imported from external secret config.
|
75
|
+
Basic example: `external_secrets: { paper_trail_port: 'common_secrets' }` will import `paper_trail_port` value from `common_secrets` yml as `PAPER_TRAIL_PORT`
|
76
|
+
Advanced example: `external_secrets: { papertrail_port: { name: 'common_secrets', key: 'paper_trail_port' } }` will import `paper_trail_port` value from `common_secrets` yml as `PAPERTRAIL_PORT`
|
77
|
+
|
74
78
|
- `deployment.command` (String, Optional): Bash command to be used for web containers. Sample: `rails s -b 0.0.0.0`
|
75
79
|
- `deployment.liveness_path` (String, Optional): Relative path to be used for readiness and liveness checker of the web app. Sample: `/check_liveness`
|
76
80
|
- `deployment.custom_volumes` (Hash<name: path>, Optional): Custom volumes to be mounted.
|
@@ -67,12 +67,26 @@ module KubernetesHelper
|
|
67
67
|
def import_secrets(path, secrets_name)
|
68
68
|
path = KubernetesHelper.settings_path(path)
|
69
69
|
data = YAML.load(File.read(path)) # rubocop:disable Security/YAMLLoad
|
70
|
-
data['data'].keys.map do |secret|
|
70
|
+
secrets = data['data'].keys.map do |secret|
|
71
71
|
{
|
72
72
|
'name' => secret.upcase,
|
73
73
|
'valueFrom' => { 'secretKeyRef' => { 'name' => secrets_name, 'key' => secret } }
|
74
74
|
}
|
75
75
|
end
|
76
|
+
secrets + external_secrets
|
77
|
+
end
|
78
|
+
|
79
|
+
def external_secrets
|
80
|
+
data = config_values.dig(:deployment, :external_secrets) || {}
|
81
|
+
data.map do |key, source|
|
82
|
+
source = source.is_a?(Hash) ? source : { name: source.to_s, key: key }
|
83
|
+
{
|
84
|
+
'name' => key.upcase.to_s,
|
85
|
+
'valueFrom' => {
|
86
|
+
'secretKeyRef' => { 'name' => source[:name], 'key' => source[:key].to_s }
|
87
|
+
}
|
88
|
+
}
|
89
|
+
end
|
76
90
|
end
|
77
91
|
|
78
92
|
def render_template(template_name, locals = {})
|
data/lib/kubernetes_helper.rb
CHANGED
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.0
|
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
|