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

implements overlay-configs options for tembo apply #466

Merged
merged 40 commits into from
Jan 10, 2024
Merged

Conversation

joshuajerin
Copy link
Contributor

@joshuajerin joshuajerin commented Jan 4, 2024

  • Adding --merge for overlay of Base and Second Instance toml files.

https://linear.app/tembo/issue/TEM-2162/tembo-apply-overlay-configs

@joshuajerin
Copy link
Contributor Author

Closes Linear-2162

@joshuajerin joshuajerin marked this pull request as ready for review January 4, 2024 18:36
Copy link
Contributor

@sjmiller609 sjmiller609 left a comment

Choose a reason for hiding this comment

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

Great change, and thank you! Let's add a test that uses --merge option

tembo-cli/src/cli/tembo_config.rs Outdated Show resolved Hide resolved
tembo-cli/src/cmd/apply.rs Show resolved Hide resolved
@joshuajerin joshuajerin enabled auto-merge (squash) January 5, 2024 05:06
Copy link
Contributor Author

@joshuajerin joshuajerin left a comment

Choose a reason for hiding this comment

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

Done!

Copy link
Contributor

@sjmiller609 sjmiller609 left a comment

Choose a reason for hiding this comment

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

Looking great, just a few things. I think it looks like maybe the overlay will reset the instance settings to default if not specified in the overlay config, so I want to see a test for that. Also there are some files that don't need to be committed that could be cleaned up. To get the lint rules to pass in CI, run cargo clippy --fix --all and run cargo fmt.

tembo-cli/tests/tomls/merge/postgres.conf Outdated Show resolved Hide resolved
tembo-cli/tests/tomls/merge/migrations/1_extensions.sql Outdated Show resolved Hide resolved
tembo-cli/tests/tomls/merge/Dockerfile Outdated Show resolved Hide resolved
tembo-cli/tests/tomls/merge/second-instance.toml Outdated Show resolved Hide resolved
tembo-cli/tests/integration_tests.rs Outdated Show resolved Hide resolved
info!("Running validation!");
super::validate::execute(verbose)?;
info!("Validation completed!");

let env = get_current_context()?;

let instance_settings = get_instance_settings(_merge_path.clone())?;
println!("Instance settings: {:?}", instance_settings);
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can add a println in the get_instance_settings function towards the end saying overlay file merged successfully. I don't think you need to print the values but I'm fine keeping it if you think it will be helpful and just move it to get_instance_settings function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

get_instance_settings is called in delete.rs as well. I felt that the user wouldn't want the instance settings to show up if he calls delete.rs and also that the user would like to see the merged instances together.

tembo-cli/src/main.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for creating the .gitignore.

@shahadarsh shahadarsh changed the title setting up get_instance_settings implements overlay-configs options for tembo apply Jan 10, 2024
Copy link
Collaborator

@shahadarsh shahadarsh left a comment

Choose a reason for hiding this comment

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

Great work @joshuajerin. Not an easy task for your 1st one. I did some basic testing and local & cloud work as expected. There are a few other improvements we can do especially in how the merge logic is written but I'm fine merging this and doing a follow up PR with improvements.

@joshuajerin joshuajerin merged commit acccc03 into main Jan 10, 2024
7 checks passed
@joshuajerin joshuajerin deleted the overlay-configs branch January 10, 2024 15:20
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

4 participants