Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testsys: add image_id label at metal cluster crd #81

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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