Skip to content

Commit

Permalink
testsys: Fix support for metal migration testing
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ecpullen committed Sep 12, 2023
1 parent ce1a723 commit 0a53781
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tools/testsys/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0a53781

Please sign in to comment.