Skip to content

Commit 7cc91f6

Browse files
committed
add architecture selector for arm challenges
Signed-off-by: Robert Detjens <[email protected]>
1 parent 034c11d commit 7cc91f6

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/asset_files/challenge_templates/deployment.yaml.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ spec:
2121
spec:
2222
imagePullSecrets:
2323
- name: "rcds-{{ slug }}-pull"
24+
nodeSelector:
25+
kubernetes.io/arch: {{ pod.architecture }}
2426
containers:
2527
- name: "{{ pod.name }}"
2628
image: "{{ pod_image }}"

src/configparser/challenge.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,17 @@ struct Pod {
305305
#[serde(default)]
306306
env: ListOrMap,
307307

308+
#[serde(default = "default_architecture")]
309+
architecture: String,
310+
308311
resources: Option<Resource>,
309312
replicas: i64,
310313
ports: Vec<PortConfig>,
311314
volume: Option<String>,
312315
}
316+
fn default_architecture() -> String {
317+
"amd64".to_string()
318+
}
313319

314320
#[derive(Debug, PartialEq, Serialize, Deserialize)]
315321
#[serde(rename_all = "lowercase")]

src/tests/parsing/challenges.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ fn challenge_pods() {
357357
replicas: 2,
358358
env: ListOrMap::Map(HashMap::new()),
359359
resources: None,
360+
architecture: "amd64".to_string(),
360361
ports: vec![PortConfig {
361362
internal: 80,
362363
expose: ExposeType::Http("test.chals.example.com".to_string())
@@ -373,6 +374,7 @@ fn challenge_pods() {
373374
replicas: 1,
374375
env: ListOrMap::Map(HashMap::new()),
375376
resources: None,
377+
architecture: "amd64".to_string(),
376378
ports: vec![PortConfig {
377379
internal: 8000,
378380
expose: ExposeType::Tcp(12345)
@@ -442,6 +444,7 @@ fn challenge_pod_build() {
442444
replicas: 1,
443445
env: ListOrMap::Map(HashMap::new()),
444446
resources: None,
447+
architecture: "amd64".to_string(),
445448
ports: vec![PortConfig {
446449
internal: 80,
447450
expose: ExposeType::Http("test.chals.example.com".to_string())
@@ -461,6 +464,7 @@ fn challenge_pod_build() {
461464
replicas: 1,
462465
env: ListOrMap::Map(HashMap::new()),
463466
resources: None,
467+
architecture: "amd64".to_string(),
464468
ports: vec![PortConfig {
465469
internal: 80,
466470
expose: ExposeType::Http("test2.chals.example.com".to_string())
@@ -530,6 +534,7 @@ fn challenge_pod_env() {
530534
("BAR".to_string(), "that".to_string()),
531535
])),
532536
resources: None,
537+
architecture: "amd64".to_string(),
533538
ports: vec![PortConfig {
534539
internal: 80,
535540
expose: ExposeType::Http("test.chals.example.com".to_string())
@@ -545,6 +550,7 @@ fn challenge_pod_env() {
545550
("BAR".to_string(), "that".to_string()),
546551
])),
547552
resources: None,
553+
architecture: "amd64".to_string(),
548554
ports: vec![PortConfig {
549555
internal: 80,
550556
expose: ExposeType::Http("test2.chals.example.com".to_string())

0 commit comments

Comments
 (0)