From 0a53781e876d2355e78724c3745b217d7b6d59d7 Mon Sep 17 00:00:00 2001 From: ecpullen Date: Tue, 8 Aug 2023 22:38:18 +0000 Subject: [PATCH] testsys: Fix support for metal migration testing Previously all migration testing required a bottlerocket crd to be present, but since EKS Anywhere is used to provision machines, the bottlerocket crd is not created for metal. This means the migration agent needs to use the bottlerocket crd for instance ids if it's available and if not, rely on the cluster crd to get the instance ids. --- tools/testsys/src/migration.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tools/testsys/src/migration.rs b/tools/testsys/src/migration.rs index e90b08851b4..aeb3f7a1bc1 100644 --- a/tools/testsys/src/migration.rs +++ b/tools/testsys/src/migration.rs @@ -17,10 +17,6 @@ pub(crate) fn migration_crd( .cluster_crd_name .as_ref() .expect("A cluster name is required for migrations"); - let bottlerocket_resource_name = migration_input - .bottlerocket_crd_name - .as_ref() - .expect("A cluster name is required for migrations"); let labels = migration_input.crd_input.labels(btreemap! { "testsys/type".to_string() => "migration".to_string(), @@ -58,12 +54,22 @@ pub(crate) fn migration_crd( }; migration_config - .instance_ids_template(bottlerocket_resource_name, instance_id_field_name) + .instance_ids_template( + migration_input + .bottlerocket_crd_name + .as_ref() + .unwrap_or(cluster_resource_name), + instance_id_field_name, + ) .migrate_to_version(migration_version) .tuf_repo(migration_input.crd_input.tuf_repo_config()) .assume_role(migration_input.crd_input.config.agent_role.clone()) - .resources(bottlerocket_resource_name) - .resources(cluster_resource_name) + .set_resources(Some( + vec![cluster_resource_name.to_owned()] + .into_iter() + .chain(migration_input.bottlerocket_crd_name.iter().cloned()) + .collect(), + )) .set_depends_on(Some(migration_input.prev_tests)) .image( migration_input