feat: add crdb
Some checks reported errors
continuous-integration/drone/push Build encountered an error

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-05-26 23:15:06 +02:00
parent 7fc0d8c204
commit 4308016351
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394
3 changed files with 32 additions and 8 deletions

2
Cargo.lock generated
View File

@ -1136,7 +1136,7 @@ dependencies = [
[[package]] [[package]]
name = "cuddle-clusters" name = "cuddle-clusters"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.front.kjuulh.io/kjuulh/cuddle-clusters?branch=main#4bbca2079783c24400b0641ba94ec4c5bde2b9cd" source = "git+https://git.front.kjuulh.io/kjuulh/cuddle-clusters?branch=main#616d23c5503c560e11dad655ac2400dd604e29f1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",

View File

@ -9,6 +9,7 @@ use cuddle_ci::rust_service::RustService;
use cuddle_ci::rust_service::{extensions::*, RustServiceContext}; use cuddle_ci::rust_service::{extensions::*, RustServiceContext};
use cuddle_ci::{Context, CuddleCI, MainAction, PullRequestAction}; use cuddle_ci::{Context, CuddleCI, MainAction, PullRequestAction};
use cuddle_clusters::catalog::cluster_vars::ClusterVars; 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::cuddle_vars::CuddleVars;
use cuddle_clusters::catalog::vault_secret::VaultSecret; use cuddle_clusters::catalog::vault_secret::VaultSecret;
use cuddle_clusters::releaser::Releaser; use cuddle_clusters::releaser::Releaser;
@ -76,6 +77,10 @@ impl RustServiceRender {
.into_component(), .into_component(),
ClusterVars::default().into_component(), ClusterVars::default().into_component(),
VaultSecret::default().into_component(), VaultSecret::default().into_component(),
CockroachDB::new(&std::env::current_dir()?)
.await
.map_err(|e| eyre::anyhow!("failed to get cuddle vars: {}", e.to_string()))?
.into_component(),
], ],
cuddle_clusters::process::ProcessOpts { cuddle_clusters::process::ProcessOpts {
path: std::env::current_dir()?, path: std::env::current_dir()?,
@ -106,13 +111,13 @@ impl MainAction for RustServiceRender {
self.render_templates(&image_tag).await?; self.render_templates(&image_tag).await?;
cuddle_ci::cuddle_x::well_known::render(vec![ // cuddle_ci::cuddle_x::well_known::render(vec![
"--cluster", // "--cluster",
"clank-prod", // "clank-prod",
"--image_tag", // "--image_tag",
&image_tag, // &image_tag,
]) // ])
.await?; // .await?;
Ok(()) Ok(())
} }

View File

@ -32,6 +32,25 @@ spec:
envFrom: envFrom:
- configMapRef: - configMapRef:
name: {{service_name}}-config name: {{service_name}}-config
{%- if vars.vault_secret.has_values or vars.cuddle_crdb.has_values %}
env:
{%- if vars.vault_secret.has_values %}
{%- for secret in vars.vault_secret.secrets %}
- name: {{secret | upper | replace(".", "_") | replace("-", "_") }}
valueFrom:
secretKeyRef:
name: {{ vars.vault_secret.file_name(service_name) }}
key: {{ secret }}
{%- endfor %}
{%- endif %}
{%- if vars.cuddle_crdb.has_values %}
- name: {{vars.cuddle_crdb.env }}
valueFrom:
secretKeyRef:
name: {{ vars.cuddle_crdb.file_name(service_name) }}
key: {{ vars.cuddle_crdb.env }}
{%- endif %}
{%- endif %}
ports: ports:
- containerPort: 3000 - containerPort: 3000
name: external-http name: external-http