Remove warning from StoragePropertyMappers about the deployment state version seed
It duplicates the logic in the provider and is incomplete. A follow-up issue will investigate how a provider can defer a configuration option. Closes #13807
This commit is contained in:
parent
801b20e037
commit
bd926b8fd0
2 changed files with 2 additions and 11 deletions
|
@ -49,8 +49,9 @@ public class MapDeploymentStateProviderFactory implements DeploymentStateProvide
|
||||||
public void init(Config.Scope config) {
|
public void init(Config.Scope config) {
|
||||||
String seed = config.get(RESOURCES_VERSION_SEED);
|
String seed = config.get(RESOURCES_VERSION_SEED);
|
||||||
if (seed == null) {
|
if (seed == null) {
|
||||||
|
// hardcoded until https://github.com/keycloak/keycloak/issues/13828 has been implemented
|
||||||
Logger.getLogger(DeploymentStateProviderFactory.class)
|
Logger.getLogger(DeploymentStateProviderFactory.class)
|
||||||
.warnf("Version seed for deployment state set with a random number. Caution: This can lead to unstable operations when serving resources from the cluster without a sticky loadbalancer or when restarting nodes. Set the '%s' property in the %s provider config of %s SPI for stable operations", RESOURCES_VERSION_SEED, PROVIDER_ID, DeploymentStateSpi.NAME);
|
.warnf("Version seed for deployment state set with a random number. Caution: This can lead to unstable operations when serving resources from the cluster without a sticky loadbalancer or when restarting nodes. Set the 'storage-deployment-state-version-seed' option with a secret seed to ensure stable operations.", RESOURCES_VERSION_SEED, PROVIDER_ID, DeploymentStateSpi.NAME);
|
||||||
//generate random string for this installation
|
//generate random string for this installation
|
||||||
seed = SecretGenerator.getInstance().randomString(10);
|
seed = SecretGenerator.getInstance().randomString(10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,6 @@ final class StoragePropertyMappers {
|
||||||
.build(),
|
.build(),
|
||||||
fromOption(StorageOptions.STORAGE_DEPLOYMENT_STATE_RESOURCES_VERSION_SEED)
|
fromOption(StorageOptions.STORAGE_DEPLOYMENT_STATE_RESOURCES_VERSION_SEED)
|
||||||
.to("kc.spi-deployment-state-map-resources-version-seed")
|
.to("kc.spi-deployment-state-map-resources-version-seed")
|
||||||
.transformer(StoragePropertyMappers::getResourcesVersionSeed)
|
|
||||||
.paramLabel("type")
|
.paramLabel("type")
|
||||||
.build(),
|
.build(),
|
||||||
fromOption(StorageOptions.STORAGE_AUTH_SESSION_PROVIDER)
|
fromOption(StorageOptions.STORAGE_AUTH_SESSION_PROVIDER)
|
||||||
|
@ -319,15 +318,6 @@ final class StoragePropertyMappers {
|
||||||
return of(storage.isEmpty() ? "jpa" : "map");
|
return of(storage.isEmpty() ? "jpa" : "map");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Optional<String> getResourcesVersionSeed(Optional<String> parameterValue, ConfigSourceInterceptorContext context) {
|
|
||||||
if (!parameterValue.isEmpty()) {
|
|
||||||
return parameterValue;
|
|
||||||
}
|
|
||||||
Logger.getLogger(StoragePropertyMappers.class)
|
|
||||||
.warnf("Version seed for deployment state set with a random number. Caution: This can lead to unstable operations when serving resources from the cluster without a sticky loadbalancer or when restarting nodes. Set the '--%s' option with a secret seed to ensure stable operations.", StorageOptions.STORAGE_DEPLOYMENT_STATE_RESOURCES_VERSION_SEED.getKey());
|
|
||||||
return Optional.of(SecretGenerator.getInstance().randomString(10));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Optional<String> getCacheStorage(Optional<String> storage, ConfigSourceInterceptorContext context) {
|
private static Optional<String> getCacheStorage(Optional<String> storage, ConfigSourceInterceptorContext context) {
|
||||||
return of(storage.isEmpty() ? "infinispan" : "map");
|
return of(storage.isEmpty() ? "infinispan" : "map");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue