feat: add postgres setup
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Kasper Juul Hermansen 2025-01-12 22:18:05 +01:00
parent 0c6ba3d630
commit 2712707da8
Signed by: kjuulh
SSH Key Fingerprint: SHA256:RjXh0p7U6opxnfd3ga/Y9TCo18FYlHFdSpRIV72S/QM
2 changed files with 22 additions and 1 deletions

View File

@ -14,6 +14,7 @@ use cuddle_clusters::catalog::cluster_vars::ClusterVars;
use cuddle_clusters::catalog::crdb_database::CockroachDB;
use cuddle_clusters::catalog::cuddle_vars::CuddleVars;
use cuddle_clusters::catalog::ingress::Ingress;
use cuddle_clusters::catalog::postgres_database::PostgresDatabase;
use cuddle_clusters::catalog::vault_secret::VaultSecret;
use cuddle_clusters::releaser::Releaser;
use cuddle_clusters::IntoComponent;
@ -153,6 +154,10 @@ impl RustServiceRender {
.await
.map_err(|e| eyre::anyhow!("failed to get cuddle vars: {}", e.to_string()))?
.into_component(),
PostgresDatabase::new(&std::env::current_dir()?)
.await
.map_err(|e| eyre::anyhow!("failed to get cuddle vars: {}", e.to_string()))?
.into_component(),
Ingress::new(&std::env::current_dir()?)
.await
.map_err(|e| eyre::anyhow!("failed to get cuddle vars: {}", e.to_string()))?

View File

@ -36,8 +36,13 @@ spec:
- configMapRef:
name: {{ vars.cuddle_crdb.file_name(service_name) }}
{%- endif %}
{%- if vars.vault_secret.has_values or vars.cuddle_crdb.has_values %}
{%- if vars.cuddle_postgres.has_values %}
- configMapRef:
name: {{ vars.cuddle_postgres.file_name(service_name) }}
{%- endif %}
{%- if vars.vault_secret.has_values or vars.cuddle_crdb.has_values or vars.cuddle_postgres.has_values %}
env:
{%- if vars.vault_secret.has_values %}
{%- for secret in vars.vault_secret.secrets %}
- name: {{secret | upper | replace(".", "_") | replace("-", "_") }}
@ -47,6 +52,17 @@ spec:
key: {{ secret }}
{%- endfor %}
{%- endif %}
{%- if vars.vault_postgres.has_values %}
{%- for env in vars.vault_postgres.env %}
- name: {{ env | upper | replace(".", "_") | replace("-", "_") }}
valueFrom:
secretKeyRef:
name: {{ vars.vault_postgres.file_name(service_name) }}
key: {{ env }}
{%- endfor %}
{%- endif %}
{#
{%- if vars.cuddle_crdb.has_values %}
- name: {{vars.cuddle_crdb.env }}