diff --git a/crates/cuddle-rust-service-plan/src/main.rs b/crates/cuddle-rust-service-plan/src/main.rs index 9fdc8ef..5a7e8c7 100644 --- a/crates/cuddle-rust-service-plan/src/main.rs +++ b/crates/cuddle-rust-service-plan/src/main.rs @@ -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()))? diff --git a/templates/clusters/deployment.yaml.jinja2 b/templates/clusters/deployment.yaml.jinja2 index 02695b2..f3e90af 100644 --- a/templates/clusters/deployment.yaml.jinja2 +++ b/templates/clusters/deployment.yaml.jinja2 @@ -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 }}