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

Host container migrations #294

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

vyaghras
Copy link
Contributor

@vyaghras vyaghras commented Dec 4, 2024

Issue number:

Closes #

Description of changes:
In case of host container upgrade in BoB repo, we need to write migrations. By this PR we are incorperating the concept of weak and strong setting, where a weak setting will be deleted on upgrade and downgrade and default setting will be populated from the settings-defaults.

migrator: remove all the weak setting and settings-generator
apiserver: add version 2 for /tx and /metadata/settings-generator 
apiclient: update README to document version 2 of /tx API 
datastore: support committing metadata from transactions 
models: add strength enum and Settings generator struct 
constants: Use version 2 API to get setting-generators 
openapi: Add version 2 for /tx and /metadata/settings-generator 
settings-committer: change transaction API endpoint to /v2/tx 
sundog: Parse settings generators as a table 
storewolf: enable parsing setting-generator metadata as table

Testing done:
Refer https://gist.github.com/vyaghras/cc7391ade3b276b223d1814a8770eea7

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.

@vyaghras vyaghras force-pushed the host_container_migrations branch 2 times, most recently from e997915 to 4d9addf Compare December 5, 2024 01:46
@vyaghras
Copy link
Contributor Author

vyaghras commented Dec 5, 2024

☝️ Fixed failing tests

vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Dec 5, 2024
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Dec 5, 2024
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Dec 5, 2024
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Dec 5, 2024
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Dec 5, 2024
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Dec 5, 2024
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Dec 5, 2024
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Dec 5, 2024
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Dec 5, 2024
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Dec 5, 2024
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Dec 6, 2024
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Dec 6, 2024
@vyaghras vyaghras requested review from bcressey and cbgbt December 6, 2024 20:56
@cbgbt
Copy link
Contributor

cbgbt commented Dec 6, 2024

Do you mind adding more detail to the PR description about the intent of this changeset? Moving the testing done to a gist may also help to make the PR description a bit less cluttered.

Copy link
Contributor

@cbgbt cbgbt left a comment

Choose a reason for hiding this comment

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

Really nice work!

I'm still working through the final two commits, but have run out of time at the moment. Will follow up with any additional feedback.

sources/api/storewolf/src/main.rs Outdated Show resolved Hide resolved
sources/api/storewolf/src/main.rs Outdated Show resolved Hide resolved
sources/api/storewolf/src/main.rs Outdated Show resolved Hide resolved
sources/api/openapi.yaml Outdated Show resolved Hide resolved
sources/api/openapi.yaml Show resolved Hide resolved
sources/api/datastore/src/filesystem.rs Outdated Show resolved Hide resolved
sources/api/sundog/src/main.rs Outdated Show resolved Hide resolved
sources/api/sundog/src/main.rs Outdated Show resolved Hide resolved
sources/api/sundog/src/main.rs Outdated Show resolved Hide resolved
sources/api/sundog/src/main.rs Outdated Show resolved Hide resolved
sources/api/migration/migrator/src/main.rs Outdated Show resolved Hide resolved
sources/api/migration/migrator/src/main.rs Outdated Show resolved Hide resolved
sources/api/migration/migrator/src/main.rs Outdated Show resolved Hide resolved
sources/api/sundog/src/main.rs Outdated Show resolved Hide resolved
sources/api/datastore/src/filesystem.rs Outdated Show resolved Hide resolved
sources/api/apiserver/src/server/mod.rs Outdated Show resolved Hide resolved
sources/api/apiserver/src/server/mod.rs Outdated Show resolved Hide resolved
sources/api/apiserver/src/server/mod.rs Outdated Show resolved Hide resolved
sources/api/apiserver/src/server/mod.rs Outdated Show resolved Hide resolved
sources/api/apiserver/src/server/controller.rs Outdated Show resolved Hide resolved
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 2, 2025
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 2, 2025
@vyaghras vyaghras mentioned this pull request Jan 2, 2025
7 tasks
@vyaghras vyaghras force-pushed the host_container_migrations branch from 4d9addf to 90a6b85 Compare January 21, 2025 21:57
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 22, 2025
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 22, 2025
@vyaghras vyaghras force-pushed the host_container_migrations branch from 90a6b85 to f189f38 Compare January 22, 2025 16:36
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 22, 2025
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 22, 2025
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
@vyaghras vyaghras force-pushed the host_container_migrations branch from 4830f8c to b1fb425 Compare January 27, 2025 17:08
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 27, 2025
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 27, 2025
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
@vyaghras vyaghras requested a review from cbgbt January 27, 2025 18:09
sources/models/src/lib.rs Outdated Show resolved Hide resolved
sources/models/src/lib.rs Outdated Show resolved Hide resolved
Comment on lines +162 to +171
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
where
M: MapAccess<'de>,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine, but I'm curious if we can use MapAccessDeserializer as is used in the docs here. Could save us having to maintain this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This works for a struct directly but fails if we pass an array of the struct.

sources/api/datastore/src/constraints_check.rs Outdated Show resolved Hide resolved
sources/api/apiserver/src/server/controller.rs Outdated Show resolved Hide resolved
sources/api/apiserver/src/server/controller.rs Outdated Show resolved Hide resolved
sources/api/apiserver/src/server/controller.rs Outdated Show resolved Hide resolved
sources/api/apiserver/src/server/mod.rs Outdated Show resolved Hide resolved
sources/api/apiserver/src/server/mod.rs Outdated Show resolved Hide resolved
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 28, 2025
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 28, 2025
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
@vyaghras vyaghras force-pushed the host_container_migrations branch from b1fb425 to eea3a3d Compare January 28, 2025 17:48
sources/api/migration/migrator/src/main.rs Outdated Show resolved Hide resolved
sources/api/migration/migrator/src/main.rs Outdated Show resolved Hide resolved
sources/api/migration/migrator/src/main.rs Outdated Show resolved Hide resolved
sources/api/migration/migrator/src/main.rs Show resolved Hide resolved
sources/api/apiserver/src/server/controller.rs Outdated Show resolved Hide resolved
sources/api/apiserver/src/server/controller.rs Outdated Show resolved Hide resolved
sources/api/apiserver/src/server/controller.rs Outdated Show resolved Hide resolved
sources/api/apiserver/src/server/mod.rs Outdated Show resolved Hide resolved
sources/api/apiserver/src/server/mod.rs Outdated Show resolved Hide resolved
sources/api/datastore/src/lib.rs Outdated Show resolved Hide resolved
The get API on route /tx is used to fetch the pending settings in
pending transaction. This is used in setting-commiter to just log the
pending settings before committing them. The version 2 of this api will
also return the pending metadata.
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 29, 2025
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 29, 2025
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
@vyaghras vyaghras force-pushed the host_container_migrations branch from eea3a3d to ba2eb64 Compare January 29, 2025 17:19
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 29, 2025
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 29, 2025
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 29, 2025
Updated the `commit_transaction` function to enable committing metadata
from pending transactions. In commit transaction we will first commit
metadata and then pending keys to correctly perform the check to
identify
if key exists or not.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.

Refer commit:
bottlerocket-os/bottlerocket-core-kit@20a435e
Refer PR:
bottlerocket-os/bottlerocket-core-kit#294
vyaghras added a commit to vyaghras/bottlerocket that referenced this pull request Jan 29, 2025
Copy link
Contributor

@cbgbt cbgbt left a comment

Choose a reason for hiding this comment

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

Nice work!

It's a nit, but I might reword the sundog commit message to something like:

sundog: add support for v2 setting generator api

This gets more at the intent of the change and would be easier to find if we were to come looking for the commit later.

sources/api/apiserver/src/server/mod.rs Outdated Show resolved Hide resolved
Updated the `commit_transaction` function to enable committing strength metadata
from pending transactions. In commit transaction we will use constraint
check function to validate the pending keys and metadata. The commit
will proceed once check_constraints function returns success.

The strength handling among pending and committed transaction is as:
If pending metadata is strong and committed metadata is weak, commit the
pending setting.

If pending metadata is weak, committed metadata is strong and
the setting is already available, do not downgrade from strong to weak.
Otherwise add the strength file with value as weak.

If pending and committed metadata are the same, no action is performed.

Additionally, made minor changes to metadata functions for improved
access and flexibility:
Introduced a `committed` field to dynamically access metadata in pending
transactions.
Replaced the hardcoded use of live committed metadata with this
committed variable ans pass Committed::Live from previous usages.
For new setting-generator we process following fields from the defaults TOML file:
- command
- strength
- skip-if-populated

This needs to be saved as json in the filesystem.
We will remove the weak settings and all the metadata using the
migrator of the destination migrator.

The storewolf do not repopulate any metadata or setting, if it is
already present. As migrator runs before storewolf, if we will delete the
weak settings and all metadata in migrator, storewolf can populate
the setting-generator from defaults and sundog will populate the new
source using the new setting generator from default.

We are deleting all the metadata as we populate that using defaults only
and also the same is not possible to set the using API.
@vyaghras vyaghras force-pushed the host_container_migrations branch from ba2eb64 to e86464a Compare January 29, 2025 21:42
Earlier we used to have setting generator as a string, but we have now
changed it to a struct containing the command, strength and
skip-if-populated.

Hence after requesting the settings generators from api, we need to
change these in to Setting generator struct instance. We will use default
strength strong and skip_if_populated true if the setting generator
is a string and use what has been provided in the response otherwise.

Then after running the setting generator, we will send the weak and
strong setting settings separately to process them using api.
- `/v2/tx`: We will also return the pending metadata along with pending
  settings(that we used to return in version 1). As the return struct is
changing, we are doing versioning of the API.

- `v2/metadata/settings-generators`: We will also return the
  settings-generators(that contains strength and are saved as JSON
object in datastore). As we just used to return arrays and string
earlier as response for this API, returning object may break the
existing usage. Hence we need to version this API.

- `/settings`(patch and patchkeypair): For both of these we will set
  strength metadata. The default strength used is strong.

- `/tx/commit` and `/tx/commit_and_apply`:  We will commit the pending
  metadata(that just accounts for strength metadata for now) as part of
commit. No changes has been done in apply.
@vyaghras vyaghras force-pushed the host_container_migrations branch from e86464a to 9d67072 Compare January 29, 2025 21:54
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