Deprecate other transport stacks (ec2, azure, google)

Closes #34253

Signed-off-by: Ryan Emerson <remerson@redhat.com>
This commit is contained in:
Ryan Emerson 2024-10-24 16:34:32 +01:00 committed by Alexander Schwartz
parent 19ef0a608b
commit a79b67cac8
10 changed files with 47 additions and 16 deletions

View file

@ -41,6 +41,11 @@ To enable the previous behavior, choose the transport stack `udp`.
The {project_name} Operator will continue to configure `kubernetes` as a transport stack. The {project_name} Operator will continue to configure `kubernetes` as a transport stack.
= Deprecated transport stacks for distributed caches
The `azure`, `ec2` and `google` transport stacks have been deprecated. Users should use the TCP based `jdbc-ping`
stack as a direct replacement.
= Defining dependencies between provider factories = Defining dependencies between provider factories
When developing extensions for {project_name}, developers can now specify dependencies between provider factories classes by implementing the method `dependsOn()` in the `ProviderFactory` interface. When developing extensions for {project_name}, developers can now specify dependencies between provider factories classes by implementing the method `dependsOn()` in the `ProviderFactory` interface.

View file

@ -247,6 +247,10 @@ The following table shows transport stacks that are available using the `--cache
|=== |===
=== Additional transport stacks === Additional transport stacks
IMPORTANT: The following stacks are deprecated. We recommend that you utilise the `jdbc-ping` stack in such environments
as it does not require additional configuration or dependencies.
The following table shows transport stacks that are supported by {project_name}, but need some extra steps to work. The following table shows transport stacks that are supported by {project_name}, but need some extra steps to work.
Note that _none_ of these stacks are Kubernetes / OpenShift stacks, so no need exists to enable the `google` stack if you want to run {project_name} on top of the Google Kubernetes engine. Note that _none_ of these stacks are Kubernetes / OpenShift stacks, so no need exists to enable the `google` stack if you want to run {project_name} on top of the Google Kubernetes engine.
In that case, use the `kubernetes` stack. In that case, use the `kubernetes` stack.

View file

@ -1,6 +1,9 @@
package org.keycloak.config; package org.keycloak.config;
import java.io.File; import java.io.File;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
@ -64,6 +67,7 @@ public class CachingOptions {
.expectedValues(false) .expectedValues(false)
.description("Define the default stack to use for cluster communication and node discovery.") .description("Define the default stack to use for cluster communication and node discovery.")
.defaultValue(Stack.jdbc_ping_udp) .defaultValue(Stack.jdbc_ping_udp)
.deprecatedValues(Stream.of(Stack.azure, Stack.ec2, Stack.google).map(Object::toString).collect(Collectors.toSet()), "Use 'jdbc-ping' instead")
.build(); .build();
public static final Option<File> CACHE_CONFIG_FILE = new OptionBuilder<>(CACHE_CONFIG_FILE_PROPERTY, File.class) public static final Option<File> CACHE_CONFIG_FILE = new OptionBuilder<>(CACHE_CONFIG_FILE_PROPERTY, File.class)

View file

@ -389,13 +389,16 @@ public class CacheManagerFactory {
String transportStack = Configuration.getRawValue("kc.cache-stack"); String transportStack = Configuration.getRawValue("kc.cache-stack");
if (transportStack != null && !transportStack.isBlank() && !isJdbcPingStack(transportStack)) { if (transportStack != null && !transportStack.isBlank() && !isJdbcPingStack(transportStack)) {
transportConfig.defaultTransport().stack(transportStack); transportConfig.defaultTransport().stack(transportStack);
warnDeprecatedCloudStack(transportStack);
return; return;
} }
var stackXmlAttribute = transportConfig.defaultTransport().attributes().attribute(STACK); var stackXmlAttribute = transportConfig.defaultTransport().attributes().attribute(STACK);
// If the user has explicitly defined a transport stack that is not jdbc-ping or jdbc-ping-udp, return // If the user has explicitly defined a transport stack that is not jdbc-ping or jdbc-ping-udp, return
if (stackXmlAttribute.isModified() && !isJdbcPingStack(stackXmlAttribute.get())) if (stackXmlAttribute.isModified() && !isJdbcPingStack(stackXmlAttribute.get())) {
warnDeprecatedCloudStack(stackXmlAttribute.get());
return; return;
}
var stackName = transportStack != null ? var stackName = transportStack != null ?
transportStack : transportStack :
@ -426,6 +429,15 @@ public class CacheManagerFactory {
transportConfig.defaultTransport().stack(stackName); transportConfig.defaultTransport().stack(stackName);
} }
private void warnDeprecatedCloudStack(String stackName) {
switch (stackName) {
case "azure":
case "ec2":
case "google":
logger.warnf("Stack '%s' is deprecated. We recommend to use 'jdbc-ping' instead", stackName);
}
}
private boolean isJdbcPingStack(String stackName) { private boolean isJdbcPingStack(String stackName) {
return "jdbc-ping".equals(stackName) || "jdbc-ping-udp".equals(stackName); return "jdbc-ping".equals(stackName) || "jdbc-ping-udp".equals(stackName);
} }

View file

@ -58,6 +58,12 @@ public class ClusterConfigDistTest {
assertThat(cliResult.getOutput(), Matchers.containsString("ISPN000078: Starting JGroups channel `ISPN` with stack `jdbc-ping`")); assertThat(cliResult.getOutput(), Matchers.containsString("ISPN000078: Starting JGroups channel `ISPN` with stack `jdbc-ping`"));
} }
@Test
@Launch({ "start-dev", "--cache=ispn", "--cache-stack=azure" })
void warnDeprecatedCloudStack(LaunchResult result) {
assertTrue(result.getOutput().contains("Stack 'azure' is deprecated. We recommend to use 'jdbc-ping' instead"));
}
@Test @Test
@Launch({ "start-dev", "--cache-config-file=invalid" }) @Launch({ "start-dev", "--cache-config-file=invalid" })
void failInvalidClusterConfig(LaunchResult result) { void failInvalidClusterConfig(LaunchResult result) {

View file

@ -97,9 +97,9 @@ Cache:
host is set. host is set.
--cache-stack <stack> --cache-stack <stack>
Define the default stack to use for cluster communication and node discovery. Define the default stack to use for cluster communication and node discovery.
Possible values are: tcp, udp, jdbc-ping, jdbc-ping-udp, kubernetes, ec2, Possible values are: tcp, udp, jdbc-ping, jdbc-ping-udp, kubernetes, ec2
azure, google, or a custom one. Default: jdbc-ping-udp. Available only when (deprecated), azure (deprecated), google (deprecated), or a custom one.
'cache' type is set to 'ispn'. Default: jdbc-ping-udp. Available only when 'cache' type is set to 'ispn'.
Config: Config:

View file

@ -72,9 +72,9 @@ Cache:
as well and the related configuration in XML file should not be present. as well and the related configuration in XML file should not be present.
--cache-stack <stack> --cache-stack <stack>
Define the default stack to use for cluster communication and node discovery. Define the default stack to use for cluster communication and node discovery.
Possible values are: tcp, udp, jdbc-ping, jdbc-ping-udp, kubernetes, ec2, Possible values are: tcp, udp, jdbc-ping, jdbc-ping-udp, kubernetes, ec2
azure, google, or a custom one. Default: jdbc-ping-udp. Available only when (deprecated), azure (deprecated), google (deprecated), or a custom one.
'cache' type is set to 'ispn'. Default: jdbc-ping-udp. Available only when 'cache' type is set to 'ispn'.
Config: Config:

View file

@ -98,9 +98,9 @@ Cache:
host is set. host is set.
--cache-stack <stack> --cache-stack <stack>
Define the default stack to use for cluster communication and node discovery. Define the default stack to use for cluster communication and node discovery.
Possible values are: tcp, udp, jdbc-ping, jdbc-ping-udp, kubernetes, ec2, Possible values are: tcp, udp, jdbc-ping, jdbc-ping-udp, kubernetes, ec2
azure, google, or a custom one. Default: jdbc-ping-udp. Available only when (deprecated), azure (deprecated), google (deprecated), or a custom one.
'cache' type is set to 'ispn'. Default: jdbc-ping-udp. Available only when 'cache' type is set to 'ispn'.
Config: Config:

View file

@ -72,9 +72,9 @@ Cache:
as well and the related configuration in XML file should not be present. as well and the related configuration in XML file should not be present.
--cache-stack <stack> --cache-stack <stack>
Define the default stack to use for cluster communication and node discovery. Define the default stack to use for cluster communication and node discovery.
Possible values are: tcp, udp, jdbc-ping, jdbc-ping-udp, kubernetes, ec2, Possible values are: tcp, udp, jdbc-ping, jdbc-ping-udp, kubernetes, ec2
azure, google, or a custom one. Default: jdbc-ping-udp. Available only when (deprecated), azure (deprecated), google (deprecated), or a custom one.
'cache' type is set to 'ispn'. Default: jdbc-ping-udp. Available only when 'cache' type is set to 'ispn'.
Config: Config:

View file

@ -98,9 +98,9 @@ Cache:
host is set. host is set.
--cache-stack <stack> --cache-stack <stack>
Define the default stack to use for cluster communication and node discovery. Define the default stack to use for cluster communication and node discovery.
Possible values are: tcp, udp, jdbc-ping, jdbc-ping-udp, kubernetes, ec2, Possible values are: tcp, udp, jdbc-ping, jdbc-ping-udp, kubernetes, ec2
azure, google, or a custom one. Default: jdbc-ping-udp. Available only when (deprecated), azure (deprecated), google (deprecated), or a custom one.
'cache' type is set to 'ispn'. Default: jdbc-ping-udp. Available only when 'cache' type is set to 'ispn'.
Config: Config: