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

updog changes to support the Update API #947

Closed
wants to merge 4 commits into from

Conversation

etungsten
Copy link
Contributor

@etungsten etungsten commented Jun 17, 2020

Issue number: #942 (comment) and #942 (comment)

Description of changes:

Author: Erikson Tung <etung@amazon.com>
Date:   Wed Jun 17 11:04:03 2020 -0700

    updog: new subcommand to revert 'update-apply'
    
    Adds a new subcommand for reverting actions done by 'update-apply'.
    Used to "deactivate" an update.
Author: Erikson Tung <etung@amazon.com>
Date:   Wed Jun 17 10:52:25 2020 -0700

    updog: use version-lock and ignore-wave setting for default behavior
    
    updog reads the 'version-lock' and 'ignore-wave' settings for
    determining default update behavior. Still allows overrides via the
    command line options.
Author: Erikson Tung <etung@amazon.com>
Date:   Mon Jun 8 14:33:16 2020 -0700

    settings: add new 'version-lock' and 'ignore-waves' settings
    
    Adds a 'version-lock' setting for specifying the version to update to
    when updating.
    
    Adds a 'ignore-waves' setting for specifying whether to respect update
    waves when updating.
Author: Erikson Tung <etung@amazon.com>
Date:   Mon Jun 8 14:30:21 2020 -0700

    models: new 'FriendlyVersion' model type
    
    Adds a new model type to represent versions that can optionally be
    prefixed with 'v' or represeted by "latest"

Testing done:
Build an image with release version set to 0.3.2, launched instance where version-lock is set to 0.3.3. Then tried the following:

Updog configuration generated properly.

bash-5.0# cat /etc/updog.toml 
metadata_base_url = "https://updates.bottlerocket.aws/2020-02-02/aws-k8s-1.15/x86_64/"
targets_base_url = "https://updates.bottlerocket.aws/targets/"
seed = 191
version_lock = "v0.3.3"
ignore_waves = false
bash-5.0# cat /etc/os-release 
NAME=Bottlerocket
ID=bottlerocket
PRETTY_NAME="Bottlerocket OS 0.3.2"
VARIANT_ID=aws-k8s-1.15
VERSION_ID=0.3.2
BUILD_ID=7192d50a-dirty

Initiate update with updog update-image and see that by default, updog updates to the version-locked version (0.3.3 in this case).

bash-5.0# updog whats      
aws-k8s-1.15 0.3.3
bash-5.0# updog whats --all
aws-k8s-1.15 0.3.4
aws-k8s-1.15 0.3.3
aws-k8s-1.15 0.3.2
aws-k8s-1.15 0.3.1
aws-k8s-1.15 0.3.0
bash-5.0# updog update-image  
Starting update to 0.3.3
Update applied: aws-k8s-1.15 0.3.3

I could also update the boot flags and then revert it via updog revert-update-apply

bash-5.0# updog update-apply
bash-5.0# signpost status
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=1 successful=false
Active:  Set A
Next:    Set B

bash-5.0# updog revert-update-apply   
bash-5.0# signpost status          
OS disk: /dev/nvme0n1
Set A:   boot=/dev/nvme0n1p2 root=/dev/nvme0n1p3 hash=/dev/nvme0n1p4 priority=2 tries_left=0 successful=true
Set B:   boot=/dev/nvme0n1p6 root=/dev/nvme0n1p7 hash=/dev/nvme0n1p8 priority=0 tries_left=1 successful=false
Active:  Set A
Next:    Set A

bash-5.0# updog update-apply       
bash-5.0# signpost status   
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=1 successful=false
Active:  Set A
Next:    Set B
bash-5.0# 

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.

Adds a new model type to represent versions that can optionally be
prefixed with 'v' or represeted by "latest"
Adds a 'version-lock' setting for specifying the version to update to
when updating.

Adds a 'ignore-waves' setting for specifying whether to respect update
waves when updating.
@etungsten etungsten requested review from tjkirch, webern and bcressey June 17, 2020 19:17
@etungsten etungsten mentioned this pull request Jun 17, 2020
updog reads the 'version-lock' and 'ignore-wave' settings for
determining default update behavior. Still allows overrides via the
command line options.
Adds a new subcommand for reverting actions done by 'update-apply'.
Used to "deactivate" an update.
@etungsten
Copy link
Contributor Author

Push above fixes the unit tests that were failing due to the newly added fields.

@etungsten
Copy link
Contributor Author

Merged these changes into the update API PR (#942), closing.

@etungsten etungsten closed this Jun 17, 2020
@etungsten etungsten deleted the updog-changes branch June 17, 2020 20:40
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.

1 participant