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

migrations: Adds new migration for bumping host container versions #536

Merged
merged 1 commit into from
Nov 19, 2019

Conversation

etungsten
Copy link
Contributor

@etungsten etungsten commented Nov 19, 2019

Adds migration for the default admin and control container versions v0.1 <-> v0.2

Issue #, if available: #534

Description of changes:

Testing done:
Locally testing forward migration, and it bumps version correctly from v0.1 to v0.2:

$ echo '"328549459982.dkr.ecr.us-west-2.amazonaws.com/thar-admin:v0.1"' > ds/live/settings/host-containers/admin/source
$ cargo run -- --datastore-path ds --forward
    SNIP
     Running `/home/ANT.AMAZON.COM/etung/thar/PRIVATE-thar/workspaces/target/debug/host-containers-version-migration --datastore-path ds --forward`
$ cat ds/live/settings/host-containers/admin/source 
"328549459982.dkr.ecr.us-west-2.amazonaws.com/thar-admin:v0.2"

Run again:

$ cargo run -- --datastore-path ds --forward
$ cat ds/live/settings/host-containers/admin/source 
"328549459982.dkr.ecr.us-west-2.amazonaws.com/thar-admin:v0.2"

If the admin container is a custom container, no modification is made:

$ echo '"super-cool-custom-admin-containerv123"' > ds/live/settings/host-containers/admin/source
$ cargo run -- --datastore-path ds --forward
$ cat ds/live/settings/host-containers/admin/source 
"super-cool-custom-admin-containerv123"

For control container, same, bumps version correctly from v0.1 to v0.2:

$ echo '"328549459982.dkr.ecr.us-west-2.amazonaws.com/thar-control:v0.1"' > ds/live/settings/host-containers/control/source
$ cargo run -- --datastore-path ds --forward
$ cat ds/live/settings/host-containers/control/source 
"328549459982.dkr.ecr.us-west-2.amazonaws.com/thar-control:v0.2"

For backwards migration, admin downgrades from v0.2 to v0.1:

$ cat ds/live/settings/host-containers/admin/source 
"328549459982.dkr.ecr.us-west-2.amazonaws.com/thar-admin:v0.2"
$ cargo run -- --datastore-path ds --backward
$ cat ds/live/settings/host-containers/admin/source 
"328549459982.dkr.ecr.us-west-2.amazonaws.com/thar-admin:v0.1"

Backwards control container version migration:

$ cat ds/live/settings/host-containers/control/source 
"328549459982.dkr.ecr.us-west-2.amazonaws.com/thar-control:v0.2"
$ cargo run -- --datastore-path ds --backward
$ cat ds/live/settings/host-containers/control/source 
"328549459982.dkr.ecr.us-west-2.amazonaws.com/thar-control:v0.1"

Tested in live Thar instance, launched Thar v0.1.6 (datastore version v0.0), loaded new image into side B using dd, loaded migrations, ran updates and verified that default image versions got bumped:

bash-5.0# signpost status                                                                                                                   min/source
OS disk: /dev/nvme0n1
Set A:   boot=/dev/nvme0n1p2 root=/dev/nvme0n1p3 hash=/dev/nvme0n1p4 priority=1 tries_left=0 successful=true
Set B:   boot=/dev/nvme0n1p6 root=/dev/nvme0n1p7 hash=/dev/nvme0n1p8 priority=2 tries_left=0 successful=true
Active:  Set B
Next:    Set B
bash-5.0# cat /var/lib/thar/datastore/current/live/settings/host-containers/admin/source                                                    
"328549459982.dkr.ecr.us-west-2.amazonaws.com/thar-admin:v0.2"

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@iliana iliana added this to the v0.2.0 milestone Nov 19, 2019
@etungsten etungsten force-pushed the host-containers-version-migrations branch from 8804779 to 95d702a Compare November 19, 2019 18:15
Copy link
Contributor

@sam-aws sam-aws left a comment

Choose a reason for hiding this comment

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

This migration should be under migrations/v0.2 right?

@etungsten
Copy link
Contributor Author

Addresses @tjkirch 's comments:
Use constants for the image names
Other clean ups.

Tests still pass.

Copy link
Contributor

@sam-aws sam-aws left a comment

Choose a reason for hiding this comment

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

Ah wait, we're going from 0.0 -> 0.1, all good ;)

Adds migration for bumping the default admin and control container
versions from 0.1 to 0.2
@etungsten etungsten force-pushed the host-containers-version-migrations branch from 95d702a to a55cd4f Compare November 19, 2019 18:34
@etungsten
Copy link
Contributor Author

Addresses @tjkirch 's comments on constant use

Copy link
Contributor

@zmrow zmrow left a comment

Choose a reason for hiding this comment

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

🏙

@etungsten etungsten merged commit deb1312 into develop Nov 19, 2019
@etungsten etungsten deleted the host-containers-version-migrations branch November 19, 2019 20:55
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.

None yet

5 participants