Skip to content

Commit 6d19acc

Browse files
committed
Use strict render helper for challenge manifest templates
Signed-off-by: Robert Detjens <[email protected]>
1 parent 5b1cad2 commit 6d19acc

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

src/deploy/kubernetes/mod.rs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::clients::{apply_manifest_yaml, kube_client, wait_for_status};
1212
use crate::configparser::challenge::ExposeType;
1313
use crate::configparser::config::ProfileConfig;
1414
use crate::configparser::{get_config, get_profile_config, ChallengeConfig};
15-
use crate::utils::TryJoinAll;
15+
use crate::utils::{render_strict, TryJoinAll};
1616

1717
pub mod templates;
1818

@@ -73,10 +73,10 @@ async fn deploy_single_challenge(
7373

7474
let kube = kube_client(profile).await?;
7575

76-
let ns_manifest = minijinja::render!(
76+
let ns_manifest = render_strict(
7777
templates::CHALLENGE_NAMESPACE,
78-
chal, slug => chal.slugify()
79-
);
78+
minijinja::context! { chal, slug => chal.slugify() },
79+
)?;
8080
trace!("NAMESPACE:\n{}", ns_manifest);
8181

8282
debug!("applying namespace for chal {:?}", chal.directory);
@@ -94,10 +94,13 @@ async fn deploy_single_challenge(
9494

9595
for pod in &chal.pods {
9696
let pod_image = chal.container_tag_for_pod(profile_name, &pod.name)?;
97-
let depl_manifest = minijinja::render!(
97+
let depl_manifest = render_strict(
9898
templates::CHALLENGE_DEPLOYMENT,
99-
chal, pod, pod_image, profile_name, slug => chal.slugify(),
100-
);
99+
minijinja::context! {
100+
chal, pod, pod_image, profile_name,
101+
slug => chal.slugify(),
102+
},
103+
)?;
101104
trace!("DEPLOYMENT:\n{}", depl_manifest);
102105

103106
debug!(
@@ -132,10 +135,13 @@ async fn deploy_single_challenge(
132135
.partition(|p| matches!(p.expose, ExposeType::Tcp(_)));
133136

134137
if !tcp_ports.is_empty() {
135-
let tcp_manifest = minijinja::render!(
138+
let tcp_manifest = render_strict(
136139
templates::CHALLENGE_SERVICE_TCP,
137-
chal, pod, tcp_ports, slug => chal.slugify(), domain => profile.challenges_domain
138-
);
140+
minijinja::context! {
141+
chal, pod, tcp_ports,
142+
slug => chal.slugify(), domain => profile.challenges_domain
143+
},
144+
)?;
139145
trace!("TCP SERVICE:\n{}", tcp_manifest);
140146

141147
debug!(
@@ -168,10 +174,13 @@ async fn deploy_single_challenge(
168174
}
169175

170176
if !http_ports.is_empty() {
171-
let http_manifest = minijinja::render!(
177+
let http_manifest = render_strict(
172178
templates::CHALLENGE_SERVICE_HTTP,
173-
chal, pod, http_ports, slug => chal.slugify(), domain => profile.challenges_domain
174-
);
179+
minijinja::context! {
180+
chal, pod, http_ports,
181+
slug => chal.slugify(), domain => profile.challenges_domain
182+
},
183+
)?;
175184
trace!("HTTP INGRESS:\n{}", http_manifest);
176185

177186
debug!(

0 commit comments

Comments
 (0)