Skip to content

Commit d4f82ac

Browse files
committed
feat: update regex for NvidiaGpuModel
Some devices that support MIG have longer names than a single letter plus numbers. Update the regex to support these devices. Signed-off-by: Matthew Yeazel <[email protected]>
1 parent 9306966 commit d4f82ac

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

bottlerocket-settings-models/modeled-types/src/kubernetes.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,7 +1581,7 @@ pub struct NvidiaGpuModel {
15811581
}
15821582

15831583
lazy_static! {
1584-
pub(crate) static ref NVIDIAGPU_NAME: Regex = Regex::new(r"^([a-z])(\d+)\.(\d+)gb$").unwrap();
1584+
pub(crate) static ref NVIDIAGPU_NAME: Regex = Regex::new(r"^([a-z0-9]+).(\d+)gb$").unwrap();
15851585
}
15861586

15871587
impl TryFrom<&str> for NvidiaGpuModel {
@@ -1652,7 +1652,13 @@ mod test_nvidia_device_plugins {
16521652

16531653
#[test]
16541654
fn valid_gpu_model() {
1655-
for ok in &["a100.40gb", "a100.80gb", "h100.80gb", "h100.141gb"] {
1655+
for ok in &[
1656+
"a100.40gb",
1657+
"a100.80gb",
1658+
"h100.80gb",
1659+
"h100.141gb",
1660+
"rtxpro6000.98gb",
1661+
] {
16561662
assert!(NvidiaGpuModel::try_from(*ok).is_ok());
16571663
}
16581664
}

0 commit comments

Comments
 (0)