Skip to content

Commit

Permalink
[camel-k] enable servlet customizer for integration that need exposer…
Browse files Browse the repository at this point in the history
…e through k8s service

Fix syndesisio#5221 syndesisio#5222
  • Loading branch information
lburgazzoli authored and valdar committed May 23, 2019
1 parent a48320a commit e4960be
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.HashMap;

import io.syndesis.common.model.integration.IntegrationDeployment;
import io.syndesis.server.controller.integration.camelk.crd.ConfigurationSpec;
import io.syndesis.server.controller.integration.camelk.crd.Integration;
import io.syndesis.server.controller.integration.camelk.crd.IntegrationSpec;
import io.syndesis.server.controller.integration.camelk.crd.TraitSpec;
Expand Down Expand Up @@ -47,6 +48,19 @@ public Integration customize(IntegrationDeployment deployment, Integration integ
.putConfiguration("port", Integer.toString(OpenShiftService.INTEGRATION_SERVICE_PORT))
.build()
);

spec.addConfiguration(
new ConfigurationSpec.Builder()
.type("property")
.value("customizer.servlet.enabled=true")
.build()
);
spec.addConfiguration(
new ConfigurationSpec.Builder()
.type("property")
.value("customizer.servlet.bindPort=" +OpenShiftService.INTEGRATION_SERVICE_PORT)
.build()
);
}

if (exposure.contains(Exposure.ROUTE)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.syndesis.server.controller.integration.camelk.customizer;

import java.util.EnumSet;
import java.util.Objects;

import io.syndesis.common.model.integration.Integration;
import io.syndesis.common.model.integration.IntegrationDeployment;
Expand Down Expand Up @@ -55,6 +56,17 @@ public void testExposureCustomizerWithServiceExposure() {
entry("auto", "false"),
entry("port", Integer.toString(OpenShiftService.INTEGRATION_SERVICE_PORT))
);

assertThat(i.getSpec().getConfiguration())
.filteredOn("type", "property")
.anyMatch(
c -> Objects.equals(c.getValue(), "customizer.servlet.enabled=true")
);
assertThat(i.getSpec().getConfiguration())
.filteredOn("type", "property")
.anyMatch(
c -> Objects.equals(c.getValue(), "customizer.servlet.bindPort=" +OpenShiftService.INTEGRATION_SERVICE_PORT)
);
}

@Test
Expand Down

0 comments on commit e4960be

Please sign in to comment.