feat: add actual example

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-05-21 22:58:08 +02:00
parent 461f8acb73
commit f27d538b38
9 changed files with 216 additions and 24 deletions

View File

@@ -3,7 +3,10 @@ pub mod common;
mod can_run_for_env;
mod cuddle_vars;
use cuddle_clusters::catalog::cuddle_vars::CuddleVars;
use cuddle_clusters::{
catalog::{cluster_vars::ClusterVars, cuddle_vars::CuddleVars},
IntoComponent,
};
use crate::common::{run_test, run_test_with_components};
@@ -60,3 +63,19 @@ async fn with_cuddle_vars() -> anyhow::Result<()> {
Ok(())
}
#[tokio::test]
async fn with_actual_deployment() -> anyhow::Result<()> {
let current_dir = std::env::current_dir()?.join("tests/with_cuddle_vars");
run_test_with_components(
"with_actual_deployment",
vec![
CuddleVars::new(&current_dir).await?.into_component(),
ClusterVars::default().into_component(),
],
)
.await?;
Ok(())
}

View File

@@ -0,0 +1,15 @@
vars:
service: service
some:
nested:
item: something
array:
- item: item
cuddle/clusters:
dev:
env:
something: thing
nested.item: item

View File

@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: service-config
data:
environment:
NESTED_ITEM: item
SOMETHING: thing

View File

@@ -0,0 +1,37 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: service
cluster: dev
name: service
namespace: dev
spec:
replicas: 3
selector:
matchLabels:
app: service
cluster: dev
template:
metadata:
labels:
app: service
cluster: dev
spec:
containers:
- args:
- serve
command:
- service
image: kasperhermansen/service:main-1715336504
name: service
envFrom:
- configMapRef:
name: service-config
ports:
- containerPort: 3000
name: external-http
- containerPort: 3001
name: internal-http
- containerPort: 3002
name: internal-grpc