Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void registerTransformers(SubsystemTransformerRegistration registration)
}
}

if (UndertowSubsystemModel.VERSION_14_0_0.requiresTransformation(version)) {
if (UndertowSubsystemModel.VERSION_15_0_0.requiresTransformation(version)) {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@baranowb An explanation for this change...

We'll need to think a bit more about how to develop domain transformer stuff for things that are below default stability. It doesn't really work now and won't until wildfly/wildfly-core#6214 or something like it is done.

What you did in your earlier work on various undertow subsystem stuff at lower stability was good as it got the needed transformation logic in place in this class. But the version line ^^^ wasn't right, and there was no way to do it correctly, since no UndertowSubsystemModel.VERSION_15_0_0 existed at that time. I don't remember exactly what wildfly/wildfly-core#6214 does but I'm sure part of it adds a mechanism to differentiate between version 14 on an HC at default stability vs one at preview or community.

But right now we only support mixed domain between default stability HCs so we require transformation if the legacy HC is using version 14 or earlier.

final ResourceTransformationDescriptionBuilder handlers = subsystem.addChildResource(HandlerDefinitions.PATH_ELEMENT);
final ResourceTransformationDescriptionBuilder reverseProxy = handlers.addChildResource(ReverseProxyHandlerDefinition.PATH_ELEMENT);
final AttributeTransformationDescriptionBuilder reverseProxyAttributeTransformationDescriptionBuilder = reverseProxy.getAttributeBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ public enum UndertowSubsystemModel implements SubsystemModel {
VERSION_12_0_0(12), // WildFly 27
VERSION_13_0_0(13), // WildFly 28
VERSION_14_0_0(14), // WildFly 32-present
VERSION_15_0_0(15), // WildFly 32-present
;
static final UndertowSubsystemModel CURRENT = VERSION_14_0_0;
static final UndertowSubsystemModel CURRENT = VERSION_15_0_0;

private final ModelVersion version;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public class UndertowSubsystemTransformerTestCase extends AbstractSubsystemTest
@Parameters
public static Collection<Object[]> parameters() {
return List.<Object[]>of(
new Object[] { ModelTestControllerVersion.EAP_7_4_0, UndertowSubsystemModel.VERSION_11_0_0 }
new Object[] { ModelTestControllerVersion.EAP_7_4_0, UndertowSubsystemModel.VERSION_11_0_0 },
new Object[] { ModelTestControllerVersion.EAP_8_1_0, UndertowSubsystemModel.VERSION_14_0_0 }
);
}

Expand All @@ -53,17 +54,26 @@ private void addDependencies(LegacyKernelServicesInitializer initializer) throws
.addMavenResourceURL(this.controllerVersion.createGAV("wildfly-clustering-web-container"))
.addParentFirstClassPattern("org.jboss.msc.service.ServiceName")
.addParentFirstClassPattern("org.jboss.as.clustering.controller.CapabilityServiceConfigurator")
;
switch (this.controllerVersion) {
case EAP_7_4_0:
initializer.addMavenResourceURL("io.undertow:undertow-core:2.2.5.Final");
initializer.addMavenResourceURL("io.undertow:undertow-servlet:2.2.5.Final");
initializer.addMavenResourceURL("org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.5_spec:2.0.0.Final");
break;
default: {
throw new IllegalArgumentException();
}
}
.addMavenResourceURL(getDependencies());
}

private String[] getDependencies() {
return switch (this.controllerVersion) {
case EAP_7_4_0 -> new String[] {
"io.undertow:undertow-core:2.2.5.Final",
"io.undertow:undertow-servlet:2.2.5.Final",
"org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.5_spec:2.0.0.Final",
};
case EAP_8_1_0 -> new String[] {
this.controllerVersion.createCoreGAV("wildfly-controller"),
this.controllerVersion.createCoreGAV("wildfly-service"),
this.controllerVersion.createCoreGAV("wildfly-subsystem"),
this.controllerVersion.createCoreGAV("wildfly-io"),
this.controllerVersion.createGAV("wildfly-clustering-service"),
this.controllerVersion.createGAV("wildfly-undertow"),
};
default -> throw new IllegalArgumentException();
};
}

private final ModelTestControllerVersion controllerVersion;
Expand All @@ -80,7 +90,8 @@ private AdditionalInitialization createAdditionalInitialization() {
RuntimeCapability.resolveCapabilityName(SocketBinding.SERVICE_DESCRIPTOR, "ajp"),
RuntimeCapability.resolveCapabilityName(SocketBinding.SERVICE_DESCRIPTOR, "http"),
RuntimeCapability.resolveCapabilityName(SocketBinding.SERVICE_DESCRIPTOR, "https"),
RuntimeCapability.buildDynamicCapabilityName(Capabilities.REF_SSL_CONTEXT, "ssl")
RuntimeCapability.buildDynamicCapabilityName(Capabilities.REF_SSL_CONTEXT, "ssl"),
"org.wildfly.io.worker.default"
);
}

Expand Down Expand Up @@ -129,10 +140,17 @@ public void testRejections() throws Exception {

FailedOperationTransformationConfig config = new FailedOperationTransformationConfig();
PathAddress subsystemAddress = PathAddress.pathAddress(UndertowRootDefinition.PATH_ELEMENT);
PathAddress servletContainerAddress = subsystemAddress.append(PathElement.pathElement(ServletContainerDefinition.PATH_ELEMENT.getKey(), "rejected-container"));
PathAddress affinityCookiePath = subsystemAddress.append(PathElement.pathElement(ServletContainerDefinition.PATH_ELEMENT.getKey(), "affinity-cookie-container")).append(AffinityCookieDefinition.PATH_ELEMENT);

if (UndertowSubsystemModel.VERSION_15_0_0.requiresTransformation(this.modelVersion)) {
PathAddress ajpListenerAddress = subsystemAddress.append(PathElement.pathElement(ServerDefinition.PATH_ELEMENT.getKey(), "default-server"))
.append(PathElement.pathElement(AjpListenerResourceDefinition.PATH_ELEMENT.getKey(), "ajp"));

config.addFailedAttribute(ajpListenerAddress, new FailedOperationTransformationConfig.NewAttributesConfig(AjpListenerResourceDefinition.ALLOWED_REQUEST_ATTRIBUTES_PATTERN));
}
if (UndertowSubsystemModel.VERSION_13_0_0.requiresTransformation(this.modelVersion)) {
PathAddress servletContainerAddress = subsystemAddress.append(PathElement.pathElement(ServletContainerDefinition.PATH_ELEMENT.getKey(), "rejected-container"));
PathAddress affinityCookiePath = subsystemAddress.append(PathElement.pathElement(ServletContainerDefinition.PATH_ELEMENT.getKey(), "affinity-cookie-container")).append(AffinityCookieDefinition.PATH_ELEMENT);

config.addFailedAttribute(servletContainerAddress, new FailedOperationTransformationConfig.NewAttributesConfig(ServletContainerDefinition.ORPHAN_SESSION_ALLOWED));

config.addFailedAttribute(affinityCookiePath, FailedOperationTransformationConfig.REJECTED_RESOURCE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
~ SPDX-License-Identifier: Apache-2.0
-->

<subsystem xmlns="urn:jboss:domain:undertow:14.0" default-server="default-server" default-servlet-container="default-container" default-virtual-host="default-host" instance-id="foo">
<subsystem xmlns="urn:jboss:domain:undertow:15.0" default-server="default-server" default-servlet-container="default-container" default-virtual-host="default-host" instance-id="foo">
<byte-buffer-pool name="default" thread-local-cache-size="45" buffer-size="1000" direct="false" leak-detection-percent="50" max-pool-size="1000"/>
<server name="default-server" default-host="default-host">
<ajp-listener name="ajp" allowed-request-attributes-pattern="test" socket-binding="ajp"/>
<host name="default-host"/>
</server>
<servlet-container name="default-container"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
~ SPDX-License-Identifier: Apache-2.0
-->

<subsystem xmlns="urn:jboss:domain:undertow:14.0" default-server="default-server" default-servlet-container="default-container" default-virtual-host="default-host" instance-id="foo">
<subsystem xmlns="urn:jboss:domain:undertow:15.0" default-server="default-server" default-servlet-container="default-container" default-virtual-host="default-host" instance-id="foo">
<server name="default-server" default-host="default-host">
<ajp-listener name="ajp" socket-binding="ajp"/>
<http-listener name="http" socket-binding="http"/>
Expand Down