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: refactor and allow overrides in shared 'migration_crd' generation #2683

Merged
merged 2 commits into from
Jan 3, 2023

Conversation

etungsten
Copy link
Contributor

@etungsten etungsten commented Dec 22, 2022

Issue number:
N/A

Description of changes:

    testsys: refactor and allow aws region override in 'migration_crd'
    
    Migration testing for VMware variants require a region for SSM to
    dispatch upgrade/downgrade RunCommands to managed instances in vSphere.
    
    Unlike ECS or EKS, TestSys cannot assume the cluster resource CRD
    includes a region for vmware-k8s testing. Therefore we pass 'us-west-2'
    as the override region when creating the migration test CRD.
    testsys: add param to 'migration_crd' to specify instance id field name
    
    The TestSys EC2 resource CRD stores the instance IDs of created
    instances in a field named "ids", but the vSphere VM resource CRD stores
    the instance IDs of the managed instances in a field named
    "instance_ids".

Before these changes, migration testing on vSphere will fail because the templated fields for migration test don't exist in the VM resource CRD:

[2022-12-21T21:17:05Z ERROR migration_test_agent] client error: Unable to resolve config templates: An error occured while resolving the config: No field 'region' in created resource

Testing done:

The migration tests successfully kick-off and finish:

Every 2.0s: testsys --kubeconfig /home/etung/1.12.0-release/testsys_kubeconfig.yaml status                                                                                   Thu Dec 22 00:09:47 2022

 NAME                                                      TYPE                         STATE                         PASSED                     SKIPPED                     FAILED
 x86-64-vmware-k8s-124                                     Resource                     completed
 x86-64-vmware-k8s-124-1-initial                           Test                         pass                          1                          6972                        0
 x86-64-vmware-k8s-124-2-migrate                           Test                         pass                          2                          0                           0
 x86-64-vmware-k8s-124-3-migrated                          Test                         pass                          1                          6972                        0
 x86-64-vmware-k8s-124-4-migrate                           Test                         pass                          2                          0                           0
 x86-64-vmware-k8s-124-5-final                             Test                         pass                          1                          6972                        0
 x86-64-vmware-k8s-124-test                                Test                         running                       2                          0                           0
 x86-64-vmware-k8s-124-vms-conformance                     Resource                     completed

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

Migration testing for VMware variants require a region for SSM to
dispatch upgrade/downgrade RunCommands to managed instances in vSphere.

Unlike ECS or EKS, TestSys cannot assume the cluster resource CRD
includes a region for vmware-k8s testing. Therefore we pass 'us-west-2'
as the override region when creating the migration test CRD.
The TestSys EC2 resource CRD stores the instance IDs of created
instances in a field named "ids", but the vSphere VM resource CRD stores
the instance IDs of the managed instances in a field named
"instance_ids".
@etungsten etungsten marked this pull request as ready for review December 22, 2022 00:13
use model::Test;
use snafu::OptionExt;

/// Create a CRD for migrating Bottlerocket instances using SSM commands.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to keep this in aws_resources.rs to signify that this migration is performed using aws tools.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this a little bit more and I think it makes sense to separate out the migration CRD construction from aws_resources since the migration CRD is for a test CRD and the test itself is not limited to just run on EKS/ECS. Sure it may use AWS tools but we also use AWS tools in VMware VMs and cluster resource as well.

@etungsten etungsten merged commit 5f405af into bottlerocket-os:develop Jan 3, 2023
@etungsten etungsten deleted the migration-crd-plsss branch January 3, 2023 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants