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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa7e78cceeb40228bdfb3dea0d9e89e9beb112e484eb61ca8e7302716b69abd4
4
- data.tar.gz: 1b6eda67f29f936e66714f08b538ef868b1f3e3c76f67d3e4f2e09098898e5a1
3
+ metadata.gz: d7530d88e0f3442c2db0a7fa75d66fd03cac567ea179063ad57d14dcb87e98db
4
+ data.tar.gz: 21acb0413b2b62935e442a5ac4b03650ff8fc5e6eba8d7bb6daba0c94ecd937d
5
5
  SHA512:
6
- metadata.gz: 2c7816fd3c3cea7dc303f2923b453338f4ad976cf577bea302d75e0b7c84ee0dee98fc58d06b76c9816de0dc14cb31b8ea0aa19ce7e5cc768bb20faf76cbee7e
7
- data.tar.gz: ea90240216df3170b2185203cc1d27688950eb83130caee7e339b368501dfeb1c613a480895c17dadb7a3e235b3338cabd80871079b0a5d428b4309e7c3949be
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 = {})
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KubernetesHelper
4
- VERSION = '1.12.8'
4
+ VERSION = '1.13.0'
5
5
  end
@@ -24,7 +24,8 @@ module KubernetesHelper
24
24
  },
25
25
  deployment: {
26
26
  log_container: true,
27
- log_folder: '/app/log'
27
+ log_folder: '/app/log',
28
+ external_secrets: {}
28
29
  },
29
30
  service: {
30
31
  port_name: 'http-port',
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.12.8
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-16 00:00:00.000000000 Z
11
+ date: 2022-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erb