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

Support providing configuration from YAML files #123

Merged
merged 9 commits into from
Jul 2, 2024
Merged

Conversation

lukasz-antoniak
Copy link
Contributor

No description provided.

proxy/pkg/config/config.go Outdated Show resolved Hide resolved
defer file.Close()

dec := yaml.NewDecoder(file)
if err = dec.Decode(c); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

what happens if the same config settings are defined in multiple files? As it stands it seems that they will be overwritten which is not a very clear behavior. We should probably return an error and fail the launch if that happens.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was intentional to allow to override. At the end we already print all applied configuration variables, so there should be no confusion.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I heavily disagree with this, I don't see any benefit to it and it might just lead to user error, users never check the configuration that is printed in the logs, it's mostly for us devs to troubleshoot issues.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I hadn't thought about the possibility of the same value being set in multiple files, but it is a good point and definitely a risk.

I would see the value in supporting multiple files so that users can have one with stricter governance and another with easier access. For example, they may want to have one file containing credentials / SCB path / contact points, with restricted access, and another with things like read mode, primary cluster, log level etc etc which can be more easily accessed.

This could also be managed by having clearly structured and named files, from which we extract only the expected properties. This would not leave it up to the user to define any property in any file, and would ensure that each property is defined and considered exactly once. The downside is that we need to parse each file specifically for the expected content, but the configuration properties themselves do not tend to change, so I wouldn't see it as a big problem.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we are overengeneering this a bit... In general most tools just allow you to provide a config file and that's it. In the case of DSE, DSE allows you to set a config setting that is a path to a key file so that DSE can decrypt the credentials.

Can we take a step back and actually think if we need multiple config files? I feel like the DSE approach is a simple one but effective no?

@lukasz-antoniak lukasz-antoniak marked this pull request as ready for review July 2, 2024 08:07
Copy link
Collaborator

@joao-r-reis joao-r-reis left a comment

Choose a reason for hiding this comment

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

Looks good, added a few comments.

We should add a "reference" yaml file so that we can point users when they ask about its structure. It wouldn't be used by the proxy like the java driver does it but it would sit on the repo so that we can use it for documentation and example purposes. It should contain all settings (except the performance tuning ones) including the default values (or commented if they don't have a default value)

proxy/pkg/config/config.go Show resolved Hide resolved
proxy/pkg/config/config.go Outdated Show resolved Hide resolved
proxy/main_profiling.go Outdated Show resolved Hide resolved
proxy/main.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
proxy/main.go Outdated Show resolved Hide resolved
proxy/main.go Outdated Show resolved Hide resolved
proxy/main_profiling.go Outdated Show resolved Hide resolved
@joao-r-reis joao-r-reis closed this Jul 2, 2024
@joao-r-reis joao-r-reis reopened this Jul 2, 2024
Copy link
Collaborator

@joao-r-reis joao-r-reis left a comment

Choose a reason for hiding this comment

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

the reference yml looks really good 💯 , left a few NITs

docs/assets/zdm-config-reference.yml Outdated Show resolved Hide resolved

# Control connection failure threshold. If threshold is exceeded,
# readiness probe of ZDM will report failure and pod will be recreated.
heartbeat_failure_threshold: 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we can comment out all of the optional settings (but have the commented line here anyway just so that it is easy for someone to uncomment and set a specific value).

The required settings should be left uncommented like they are now 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left all required and sensitive properties uncommented, but commented majority.

# origin_tls_client_key_path:

# Comma separated ist of target cluster contact points.
target_contact_points: target.datastax.com
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe 127.0.0.2 as target and 127.0.0.1 as origin? feels a bit weird to see a valid hostname here (even if it doesn't exist, at least I don't think it does? but the datastax.com domain definitely exists 😅 )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, fixed.

@lukasz-antoniak lukasz-antoniak merged commit a10b166 into main Jul 2, 2024
8 checks passed
@lukasz-antoniak lukasz-antoniak deleted the config-file branch July 2, 2024 15:47
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