-
Notifications
You must be signed in to change notification settings - Fork 97
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
[BUG] - check_immutable_fields
leads to a version mismatch error when performing an upgrade
#2781
Comments
check_immutable_fields
leads to version mismatch error when performing upgradecheck_immutable_fields
leads to a version mismatch error when performing an upgrade
I'm trying to come up with a potential solution for this. As a quick fix, we could override the Another thing that comes to mind is to crate the instantiate the Pydantic model without any validation. Apparently, calling the nebari/src/_nebari/stages/terraform_state/__init__.py Lines 299 to 301 in 98970ba
we would have something like: nebari_config_state = nebari_plugin_manager.config_schema.model_construct(
**resource["values"]["input"]
) Lack of validation should not pose a problem as the input was validated before being stored in the Terraform state. However, I'm concerned about potential side effects of instantiating a model without validation that I might be overlooking (e.g., casting of specific types). @Adam-D-Lewis @dcmcand @viniciusdc I'm curious if you have any thoughts on this |
After thinking about this, I think Nebari should support non-current versions as valid in the ConfigSchema class (e.g. during upgrades we support old and new nebari version). A few possible options:
|
Thinking a bit more, the broader issue strikes me, we are instantiating an older config and the nebari config schema may or may not have changed since the older config was created. We could keep separate classes for each nebari config schema as it evolves, but I think in this case of checking for changes in immutable fields, we can simple compare the dict representations of the nebari config. |
I think this is the way to go. Keeping separate classes seems like a burden in terms of maintainability and while supporting two different versions might be possible, it wouldn't really solve the general underlying issue. This might not only happen with the version field but also with any other field that we update, like for example the provider field once we finally deprecate DigitalOcean. |
Describe the bug
In our latest release, we introduced a new function called check_immutable_fields, whose main goal is to assert that the user is not updating fields that would cause data destruction, such as changing the primary network storage mode from
efs
toceph
and vice versa.The function relies on a storage snapshot of the
nebari-config.yaml
preserved in the nebari state .tf file under the first stage (e.g for an AWS deployment it will be atstages/01-terraform-state/aws/terraform.tfstate
).This allows us to compare the config's "previous" state with the current version present in your local host.
However, recently, when doing an upgrade from AWS, I noticed that the function raised an error of version mismatch due to inconsistencies with the preserved version on the state and the upgraded version on the host. When inspecting the code, this becomes clearer since we are loading the previous state yaml config into the nebari schema, which has an underlying version check, which results in errors since the installed version has changed.
final expetion:
Right now, there is a workaround for manually updating the data of the preserved configuration under the state file or removing the file entirely, but a better solution is required. I propose adding a circumvention parameter to the schema loading to avoid triggering this error when loading "state" configurations.
Expected behavior
Depllying after upgraded should not lead to mistmacth version errors that are obscure to the user to diagnose. Deploying after upgrading should not lead to mismatched version errors that are obscure to the user's ability to analyze.
OS and architecture in which you are running Nebari
Linux
How to Reproduce the problem?
Command output
No response
Versions and dependencies used.
No response
Compute environment
AWS
Integrations
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: