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

Fix settings.container-runtime migration #2523

Merged
merged 1 commit into from
Oct 27, 2022

Conversation

stmcginnis
Copy link
Contributor

Issue number:

Closes #2522

Description of changes:

This migration used AddSettingsMigration when it actually should have been using AddPrefixesMigration to properly remove anything set on downgrade.

Testing done:

Built all source and verified no errors.

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.

This migration used `AddSettingsMigration` when it actually should have
been using `AddPrefixesMigration` to properly remove anything set on
downgrade.

Signed-off-by: Sean McGinnis <[email protected]>
@arnaldo2792
Copy link
Contributor

As discussed offline, could you please exercise upgrade/downgrade testing? (If you did, great! but the PR description didn't include that in the Testing section).

@etungsten
Copy link
Contributor

Verified that the new container-runtime settings migration works as expected:

Launched 1.10.1 instance and set up settings.container-runtime settings:

bash-5.1# apiclient get os
{
  "os": {
    "arch": "x86_64",
    "build_id": "99630be9",
    "pretty_name": "Bottlerocket OS 1.10.1 (aws-k8s-1.23)",
    "variant_id": "aws-k8s-1.23",
    "version_id": "1.10.1"
  }
}
bash-5.1# apiclient set settings.container-runtime.enable-unprivileged-icmp=true
bash-5.1# apiclient set settings.container-runtime.enable-unprivileged-ports=true
bash-5.1# apiclient set settings.container-runtime.max-concurrent-downloads=1024 
bash-5.1# apiclient set settings.container-runtime.max-container-log-line-size=1000000 

Verified that they're applied in the datastore:

bash-5.1# ls -al /var/lib/bottlerocket/datastore/current/live/settings/container-runtime/
total 24
drwxr-xr-x.  2 root root 4096 Oct 26 20:55 .
drwxr-xr-x. 13 root root 4096 Oct 26 20:55 ..
-rw-r--r--.  1 root root    4 Oct 26 20:55 enable-unprivileged-icmp
-rw-r--r--.  1 root root    4 Oct 26 20:55 enable-unprivileged-ports
-rw-r--r--.  1 root root    4 Oct 26 20:55 max-concurrent-downloads
-rw-r--r--.  1 root root    7 Oct 26 20:55 max-container-log-line-size

Downgraded to v1.10.0 and checked to make sure the settings are deleted on downgrade:

bash-5.1# apiclient get os
{
  "os": {
    "arch": "x86_64",
    "build_id": "3949354b",
    "pretty_name": "Bottlerocket OS 1.10.0 (aws-k8s-1.23)",
    "variant_id": "aws-k8s-1.23",
    "version_id": "1.10.0"
  }
}
bash-5.1#  ls -al /var/lib/bottlerocket/datastore/current/live/settings/container-runtime/      
ls: cannot access '/var/lib/bottlerocket/datastore/current/live/settings/container-runtime/': No such file or directory
bash-5.1# apiclient get settings.container-runtime
{}
ash-5.1# journalctl -u migrator  
Oct 26 20:51:33 localhost systemd[1]: Starting Bottlerocket data store migrator...
Oct 26 20:51:34 localhost migrator[1400]: Data store does not exist at given path, exiting (/var/lib/bottlerocket/datastore/current)
Oct 26 20:51:34 localhost systemd[1]: Finished Bottlerocket data store migrator.
Oct 26 20:53:39 ip-192-168-28-5.us-west-2.compute.internal systemd[1]: migrator.service: Deactivated successfully.
Oct 26 20:53:39 ip-192-168-28-5.us-west-2.compute.internal systemd[1]: Stopped Bottlerocket data store migrator.
-- Boot 6a92fb9d44fe4dcab4af39cd70affe59 --
Oct 26 20:53:47 localhost systemd[1]: Starting Bottlerocket data store migrator...
Oct 26 20:53:47 localhost migrator[1417]: 20:53:47 [INFO] New data store is being built at work location /var/lib/bottlerocket/datastore/v1.10.1_EqgXqtlL1mcSiypc
Oct 26 20:53:47 localhost migrator[1417]: 20:53:47 [INFO] Running migration command: "/proc/self/fd/4" "--forward" "--source-datastore" "/var/lib/bottlerocket/datastore/v1.10.0_iCQs5JWbtuNfpuJa" "--target-datastore" "/var/lib/bottlerocket/datastore/v1.10.1_EqgXqtlL1mcSiypc"
Oct 26 20:53:47 localhost migrator[1417]: 20:53:47 [INFO] New data store is being built at work location /var/lib/bottlerocket/datastore/v1.10.1_6w9hnbgn2nSVEmMi
Oct 26 20:53:47 localhost migrator[1417]: 20:53:47 [INFO] Running migration command: "/proc/self/fd/4" "--forward" "--source-datastore" "/var/lib/bottlerocket/datastore/v1.10.1_EqgXqtlL1mcSiypc" "--target-datastore" "/var/lib/bottlerocket/datastore/v1.10.1_6w9hnbgn2nSVEmMi"
Oct 26 20:53:47 localhost migrator[1417]: 20:53:47 [INFO] Flipping /var/lib/bottlerocket/datastore/v1.10.1 to point to v1.10.1_6w9hnbgn2nSVEmMi
Oct 26 20:53:47 localhost migrator[1417]: 20:53:47 [INFO] Flipping /var/lib/bottlerocket/datastore/v1.10 to point to v1.10.1
Oct 26 20:53:47 localhost migrator[1417]: 20:53:47 [INFO] Flipping /var/lib/bottlerocket/datastore/v1 to point to v1.10
Oct 26 20:53:47 localhost migrator[1417]: 20:53:47 [INFO] Flipping /var/lib/bottlerocket/datastore/current to point to v1
Oct 26 20:53:47 localhost systemd[1]: Finished Bottlerocket data store migrator.
Oct 26 21:36:12 ip-192-168-28-5.us-west-2.compute.internal systemd[1]: migrator.service: Deactivated successfully.
Oct 26 21:36:12 ip-192-168-28-5.us-west-2.compute.internal systemd[1]: Stopped Bottlerocket data store migrator.
-- Boot 6ac90497c1164148b9b35250b1213c8e --
Oct 26 21:36:20 localhost systemd[1]: Starting Bottlerocket data store migrator...
Oct 26 21:36:20 localhost migrator[1424]: 21:36:20 [INFO] New data store is being built at work location /var/lib/bottlerocket/datastore/v1.10.0_gLO2miwmbWZDR26E
Oct 26 21:36:20 localhost migrator[1424]: 21:36:20 [INFO] Running migration command: "/proc/self/fd/4" "--backward" "--source-datastore" "/var/lib/bottlerocket/datastore/v1.10.1_6w9hnbgn2nSVEmMi" "--target-datastore" "/var/lib/bottlerocket/datastore/v1.10.0_gLO2miwmbWZDR26E"
Oct 26 21:36:20 localhost migrator[1424]: 21:36:20 [INFO] New data store is being built at work location /var/lib/bottlerocket/datastore/v1.10.0_76G1K9xOngB64oWz
Oct 26 21:36:20 localhost migrator[1424]: 21:36:20 [INFO] Running migration command: "/proc/self/fd/4" "--backward" "--source-datastore" "/var/lib/bottlerocket/datastore/v1.10.0_gLO2miwmbWZDR26E" "--target-datastore" "/var/lib/bottlerocket/datastore/v1.10.0_76G1K9xOngB64oWz"
Oct 26 21:36:20 localhost migrator[1424]: 21:36:20 [INFO] Flipping /var/lib/bottlerocket/datastore/v1.10.0 to point to v1.10.0_76G1K9xOngB64oWz
Oct 26 21:36:20 localhost migrator[1424]: 21:36:20 [INFO] Flipping /var/lib/bottlerocket/datastore/v1.10 to point to v1.10.0
Oct 26 21:36:20 localhost migrator[1424]: 21:36:20 [INFO] Flipping /var/lib/bottlerocket/datastore/v1 to point to v1.10
Oct 26 21:36:20 localhost migrator[1424]: 21:36:20 [INFO] Flipping /var/lib/bottlerocket/datastore/current to point to v1
Oct 26 21:36:20 localhost systemd[1]: Finished Bottlerocket data store migrator.

@stmcginnis stmcginnis merged commit 9d43084 into bottlerocket-os:develop Oct 27, 2022
@stmcginnis stmcginnis deleted the cr-migration branch October 27, 2022 02:29
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.

Incorrect migration type used for container-runtime settings
3 participants