-
Notifications
You must be signed in to change notification settings - Fork 1.5k
rationalizing Config constructors / building #7204
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
base: main
Are you sure you want to change the base?
Conversation
b804e07
to
d23e034
Compare
To reply to #7190 (comment) There are three options:
@manusa @rohanKanojia this should be ready, but it looks like there is some flakeyness to one of the jdk tests. See the main pr comment for more of the thinking behind these changes. |
I'm not sure of the reason why, but tests have become extremely brittle and flaky. Regarding the changes in general. I'm still unsure why this is necessary but if it helps then I'm happy with the changes.
The main goal for the config simplification was to make it as immutable as possible and to only allow its interaction via builders. Both are impossible given the original situation and the uses that people have been giving to the class. In any case, I'd still strive to remove the setters and any logic bound into them as much as possible. |
d841d5d
to
6debf29
Compare
Sorry, I had hoped the value would have been clearer. Primarily it removes the very large constructors and any confusion that may arrise from updating them. Next it removes some of the steps of adding a new config property. There should just be two steps to add something like watchLists for the other pr - add a field on SundrioConfig, then copy the value from the SundrioConfig to the Config in the Config constructor. Finally it highlights issues with a couple of existing options, such as defaultNamespace and additionalProperties.
Config.setMasterUrl is probably the biggest exception to having logic in the setter. For the rest it's mostly a semantic issue with default handling. For example |
Signed-off-by: Steve Hawkins <[email protected]>
I've been digging a little and I think the
This is precisely the issue with the setters.
I can't see a way how defaultNamespace is actually consumed.
autoConfigure is opt-out, can only be skipped by using Config parsing is the edge case which ideally should be unsupported (however, I'm unsure about who might be actually doing this).
This can be an issue if the user has opted out and is expecting to have a clean OpenShiftConfig. |
Do you want me to do that in this pr?
It's used via config.isDefaultNamespace() in OperationContext.
They are set upon deserialization. If you have anything unrecognized, or are even just parsing an OpenShiftConfig as a Config, then it will be populated. If you currently do something like parsedConfig.edit().build() - the additionalProperties are lost.
I'm a little fuzzy on that too.
This is happening specifically with the |
Yes, I did find that, but it's not set anywhere. It also doesn't make sense to set it in the ConfigBuilder. That's why I'm unsure this is actually ever used.
Yes, but is this a real use-case? i.e. something that can actually happen.
The parsing scenarios are the ones that worry me the least. They shouldn't really be supported. I sort of recall that this could be used in IDE tooling, but hopefully they might have refactored that part. |
It was supposed to be configurable.
I'd want to keep things as regular and predicable as possible. |
61153af
to
8f36dd4
Compare
Description
@manusa @rohanKanojia separated this from the pr dealing with watchLists. I realize that using just the swicth to use a static constructor is pretty narrow change. If possible I'd like to shoot for something bigger. The changes here get rid of all of our messiest constructors and hopely make adding new options more straight-forward.
SundrioConfig -> goes from extending the Config to being a base class (could be renamed BaseConfig or something).
ConfigFluent can just reuse the base logic, no need to mess with updating fluents when a new option is added
You do still have to update the Config copy constructor to copy the value from the SundrioConfig.
For Openshift the paradigm flips. There's now an SundrioOpenShiftConfig extending OpenshiftConfig with the dummy fields moved there.
Other latent issues:
Type of change
test, version modification, documentation, etc.)
Checklist