Skip to content

Commit

Permalink
Merge pull request #81 from bottlerocket-os/fix
Browse files Browse the repository at this point in the history
testsys: add image_id label at metal cluster crd
  • Loading branch information
gthao313 authored Sep 28, 2023
2 parents 09734ab + 8cffe58 commit fcdf2c9
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tools/testsys/src/metal_k8s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,24 @@ impl CrdCreator for MetalK8sCreator {
})?,
)?;

let kube_image_id = cluster_input
.image_id
.to_string()
.replace(['.', '/'], "_")
.chars()
.rev()
.take(60)
.collect::<String>()
.chars()
.rev()
.collect();

let labels = cluster_input.crd_input.labels(btreemap! {
"testsys/type".to_string() => "cluster".to_string(),
"testsys/cluster".to_string() => cluster_name.clone(),
"testsys/controlPlaneEndpoint".to_string() => control_plane_endpoint_ip,
"testsys/k8sVersion".to_string() => k8s_version
"testsys/k8sVersion".to_string() => k8s_version,
"testsys/imageId".to_string() => kube_image_id,
});

// Check if the cluster already has a CRD
Expand All @@ -83,6 +96,7 @@ impl CrdCreator for MetalK8sCreator {
"testsys/type",
"testsys/controlPlaneEndpoint",
"testsys/k8sVersion",
"testsys/imageId",
],
)
.await?
Expand Down Expand Up @@ -152,7 +166,7 @@ impl CrdCreator for MetalK8sCreator {
.to_owned(),
)
.privileged(true)
.build(cluster_name)
.build(cluster_name + "-" + &cluster_input.crd_input.test_type.to_string())
.context(error::BuildSnafu {
what: "metal K8s cluster CRD",
})?;
Expand Down

0 comments on commit fcdf2c9

Please sign in to comment.