fix: ensures that cli and env messages are the same - #23797
Conversation
ghost
left a comment
There was a problem hiding this comment.
Unreported flaky test detected, please review
Unreported flaky test detectedIf the below flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.ui.account2.DeleteAccountTest#deleteOwnAccountSectionNotVisibleWithoutDeleteAccountActionEnabledKeycloak CI - Account Console IT (chrome) org.keycloak.testsuite.ui.account2.DeleteAccountTest#navigationTestKeycloak CI - Account Console IT (firefox) org.keycloak.testsuite.federation.ldap.LDAPProvidersFullNameMapperTest#testUpdatingAttributesWorksEvenWithEmptyAttributes |
vmuzikar
left a comment
There was a problem hiding this comment.
I think this approach doesn't fully fix it as we need to account for fast start that skips CLI args parsing.
@vmuzikar it seems that the operator already is effectively disabling fast-start because of the inclusion of --verbose. I see 3 options:
|
|
I'd go with either 1 or 3. For 1 we'd need to analyze the perf impact. For 3 we could possibly find some way to unify the logic for CLI and env vars. I wonder if config file (and potentially any config source) is affected too. |
As far as I can tell what the cli is primary giving us is expected value validation. Let me see what things look like if that is added separately.
My focus here was strickly on the env because of the issue, but yes if all checks are moved post-cli, then they would be against the full Config, including any config file. |
|
@shawkins @vmuzikar I don't like the way we're handling the configuration. Seems to me that we're making millions of workarounds in our server configuration, which will not be possible to maintain. It probably resolves the problem, but the other one will arise soon. We should provide a better approach for the configuration in general. I like the idea around SmallRye Config philosophy and its multiple configuration sources. In the end, you don't care about the configuration source, whether it's an ENV var, CLI option, or properties file. You just want to get information about a particular property of a system, asses the behavior of the system,... IMO, we should create some sort of abstraction about the configuration. We might just gather the configuration from SmallRye(don't care about the source) and create some sort of representation of the Keycloak configuration. We would be able to use the Keycloak config in a more declarative way, we could execute certain validations at the representation/model level and avoid costly operations around config changes. Something similar to the Operator config. We could easily check the changes in the configuration by, not going through the PropertyMappers again and again, but by checking the hash/revision of the representation and its transitive components. I'd rather focus on the proper design of the server configuration and not provide other workarounds. But if you think otherwise, I'd be glad to discuss it more :)) |
I agree but we have it already, kinda... I think we just need to unify validation. |
@vmuzikar the next stab at this creates a utility method for validating the non-cli properties. It is a much larger change, but it does have specific handling for the optimized start case. If the overall approach seems fine, some additional questions / thoughts:
|
219d83b to
ec514c8
Compare
+1 for just logging that with info level. Anything more than (failure) that might be a bit complicated and confusing. Would we consider env vars? Config file? What if the env var remain set after the previous |
I've added something for this already: Picocli.outputIgnoredProperties - it is directly to the stdout because the quarkus deferred logger will swallow it sometimes otherwise.
It's all the same "configurable" sources that we're already checking. The message just says they are being ignored - it's not trying to compare to the existing value, if any.
It can be done in a separate pr if you want. |
There was a problem hiding this comment.
One last nitpick. :) We could use better naming of config sources in the error messages to avoid stuff like:
... From ConfigSource KcEnvVarConfigSource
We can't probably rely on the getName() as we don't own all config sources so we can't change the names there. We'd might need some sort of mapping.
But we already use the same naming e.g. in show-config. So definitely follow-up (if anything).
There was a problem hiding this comment.
Agreed, mentioned this as well in #23797 (comment) - so we'll capture that as a follow-up.
There was a problem hiding this comment.
It'd be nice if we could use logger here to allow users to filter this? But as already discussed offline, it seems not something we can easily achieve as deferred logging sometimes swallow messages.
|
@mabartos @pedroigor I'd like to merge this soon. Let me know if you want to review. :) |
It should be nearly there in terms of tests passing. There may be one more change needed. |
ghost
left a comment
There was a problem hiding this comment.
Unreported flaky test detected, please review
Unreported flaky test detectedIf the below flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.cluster.GroupInvalidationClusterTest#crudWithFailoverKeycloak CI - Legacy Clustering IT |
ghost
left a comment
There was a problem hiding this comment.
Unreported flaky test detected, please review
Unreported flaky test detectedIf the below flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.x509.X509BrowserCRLTest#loginSuccessWithCRLSignedWithIntermediateCA3FromTruststoreKeycloak CI - FIPS IT (non-strict) org.keycloak.testsuite.x509.X509BrowserCRLTest#loginFailedWithIntermediateRevocationListFromFileKeycloak CI - FIPS IT (non-strict) org.keycloak.testsuite.x509.X509BrowserCRLTest#loginFailedWithIntermediateRevocationListFromHttpKeycloak CI - FIPS IT (non-strict) org.keycloak.testsuite.forms.RegisterTest#registerExistingEmailAllowedKeycloak CI - Forms IT (chrome) org.keycloak.testsuite.forms.RegisterTest#registerExistingEmailForbiddenKeycloak CI - Forms IT (chrome) org.keycloak.testsuite.forms.RegisterTest#registerExistingUser_emailAsUsernameKeycloak CI - Forms IT (chrome) |
|
There errors seem to be from an unrelated issue with liquibase - there's a sql related exception in the failed pod logs. I'll rebase to see if we can get this pr clean. |
also adds better messages for unknown options closes keycloak#13608
vmuzikar
left a comment
There was a problem hiding this comment.
LGTM. Are we ready to merge this yet? :)
I think once it tests cleanly yes - see above that there some liqiubase errors in the previous run. |
Fix for inconsistency between cli and env usage. This seems to be the simplest way to handle this - pulling the relevant env as cli options. There is of course some messiness to doing this, and it's adding an extra parsing of the command line options, but I didn't see another way to quickly determine the target command.
closes #13608