Class: Kube::Cluster::Standard::CloudNativePg::ExternalSecret
- Inherits:
-
Object
- Object
- Kube::Cluster::Standard::CloudNativePg::ExternalSecret
- Defined in:
- lib/kube/cluster/standard/cloud_native_pg/external_secret.rb
Constant Summary collapse
- DB_HOST =
"postgres-rw.cloudnative-pg.svc.cluster.local"
Instance Method Summary collapse
-
#initialize(name:, env_prefix: "DB", db_host: DB_HOST, &block) ⇒ ExternalSecret
constructor
A new instance of ExternalSecret.
Constructor Details
#initialize(name:, env_prefix: "DB", db_host: DB_HOST, &block) ⇒ ExternalSecret
Returns a new instance of ExternalSecret.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/kube/cluster/standard/cloud_native_pg/external_secret.rb', line 14 def initialize(name:, env_prefix: "DB", db_host: DB_HOST, &block) super() { .name = "#{name}-db" spec.refreshInterval = "1h" spec.secretStoreRef = { kind: "ClusterSecretStore", name: "cnpg-credentials" } spec.target = { name: "#{name}-db", creationPolicy: "Owner", deletionPolicy: "Retain", template: { data: { "#{env_prefix}_URL" => "jdbc:postgresql://#{db_host}:5432/#{name}", "#{env_prefix}_USER" => "{{ .username }}", "#{env_prefix}_PASSWORD" => "{{ .password }}", }, }, } spec.data = [ { secretKey: "username", remoteRef: { key: "postgres-app", property: "username" } }, { secretKey: "password", remoteRef: { key: "postgres-app", property: "password" } }, ] instance_exec(&block) if block_given? } end |