Skip to content

Commit

Permalink
chore: updated camel-k CRD java objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
valdar committed May 23, 2019
1 parent 6d967c8 commit a48320a
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public interface IntegrationSpec {
// Context string `json:"context,omitempty"`
// Dependencies []string `json:"dependencies,omitempty"`
// Profile TraitProfile `json:"profile,omitempty"`
// Traits map[string]IntegrationTraitSpec `json:"traits,omitempty"`
// Traits map[string]TraitSpec `json:"traits,omitempty"`
// Configuration []ConfigurationSpec `json:"configuration,omitempty"`
// Repositories []string `json:"repositories,omitempty"`
// ServiceAccountName string `json:"serviceAccountName,omitempty"`
Expand Down Expand Up @@ -65,7 +65,7 @@ default List<String> getDependencies() {
String getProfile();

@Value.Default
default Map<String,IntegrationTraitSpec> getTraits() {
default Map<String, TraitSpec> getTraits() {
return Collections.emptyMap();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@

@Value.Immutable
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonDeserialize(builder = IntegrationTraitSpec.Builder.class)
@JsonDeserialize(builder = TraitSpec.Builder.class)
// Immutables generates code that fails these checks
@SuppressWarnings({ "ArrayEquals", "ArrayHashCode", "ArrayToString" })
public interface IntegrationTraitSpec {
// type IntegrationTraitSpec struct {
public interface TraitSpec {
// type TraitSpec struct {
// Configuration map[string]string `json:"configuration,omitempty"`
// }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
import io.syndesis.common.model.integration.IntegrationDeployment;
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.IntegrationTraitSpec;
import io.syndesis.server.controller.integration.camelk.crd.TraitSpec;
import io.syndesis.server.openshift.Exposure;

abstract class AbstractTraitCustomizer implements CamelKIntegrationCustomizer {
@Override
public Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposure) {
Map<String, IntegrationTraitSpec> traits = computeTraits(integration, exposure);
Map<String, TraitSpec> traits = computeTraits(integration, exposure);
if (!traits.isEmpty()) {
IntegrationSpec.Builder spec = new IntegrationSpec.Builder();
if (integration.getSpec() != null) {
Expand All @@ -42,5 +42,5 @@ public Integration customize(IntegrationDeployment deployment, Integration integ
return integration;
}

protected abstract Map<String, IntegrationTraitSpec> computeTraits(Integration integration, EnumSet<Exposure> exposure);
protected abstract Map<String, TraitSpec> computeTraits(Integration integration, EnumSet<Exposure> exposure);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.Map;

import io.syndesis.server.controller.integration.camelk.crd.Integration;
import io.syndesis.server.controller.integration.camelk.crd.IntegrationTraitSpec;
import io.syndesis.server.controller.integration.camelk.crd.TraitSpec;
import io.syndesis.server.endpoint.v1.VersionService;
import io.syndesis.server.openshift.Exposure;
import org.springframework.stereotype.Component;
Expand All @@ -37,10 +37,10 @@ public CamelVersionCustomizer(VersionService versionService) {
}

@Override
protected Map<String, IntegrationTraitSpec> computeTraits(Integration integration, EnumSet<Exposure> exposure) {
protected Map<String, TraitSpec> computeTraits(Integration integration, EnumSet<Exposure> exposure) {
return Collections.singletonMap(
"camel",
new IntegrationTraitSpec.Builder()
new TraitSpec.Builder()
.putConfiguration("version", versionService.getCamelVersion())
.putConfiguration("runtime-version", versionService.getCamelkRuntimeVersion())
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.syndesis.common.model.integration.IntegrationDeployment;
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.IntegrationTraitSpec;
import io.syndesis.server.controller.integration.camelk.crd.TraitSpec;
import io.syndesis.server.openshift.Exposure;
import io.syndesis.server.openshift.OpenShiftService;
import org.springframework.stereotype.Component;
Expand All @@ -41,7 +41,7 @@ public Integration customize(IntegrationDeployment deployment, Integration integ
if (exposure.contains(Exposure.SERVICE)) {
spec.putTraits(
"service",
new IntegrationTraitSpec.Builder()
new TraitSpec.Builder()
.putConfiguration("enabled", "true")
.putConfiguration("auto", "false")
.putConfiguration("port", Integer.toString(OpenShiftService.INTEGRATION_SERVICE_PORT))
Expand All @@ -52,7 +52,7 @@ public Integration customize(IntegrationDeployment deployment, Integration integ
if (exposure.contains(Exposure.ROUTE)) {
spec.putTraits(
"route",
new IntegrationTraitSpec.Builder()
new TraitSpec.Builder()
.putConfiguration("enabled", "true")
.putConfiguration("tls-termination", "edge")
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.Map;

import io.syndesis.server.controller.integration.camelk.crd.Integration;
import io.syndesis.server.controller.integration.camelk.crd.IntegrationTraitSpec;
import io.syndesis.server.controller.integration.camelk.crd.TraitSpec;
import io.syndesis.server.openshift.Exposure;
import org.springframework.stereotype.Component;

Expand All @@ -30,10 +30,10 @@
@Component
public class JolokiaCustomizer extends AbstractTraitCustomizer {
@Override
protected Map<String, IntegrationTraitSpec> computeTraits(Integration integration, EnumSet<Exposure> exposure) {
protected Map<String, TraitSpec> computeTraits(Integration integration, EnumSet<Exposure> exposure) {
return Collections.singletonMap(
"jolokia",
new IntegrationTraitSpec.Builder()
new TraitSpec.Builder()
.putConfiguration("enabled", "true")
.putConfiguration("port", "8778")
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import io.syndesis.common.model.integration.IntegrationDeployment;
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.IntegrationTraitSpec;
import io.syndesis.server.controller.integration.camelk.crd.TraitSpec;
import io.syndesis.server.openshift.Exposure;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -78,7 +78,7 @@ protected void customizeSourceSink(IntegrationDeployment deployment, Integration
spec = spec.from(integration.getSpec());
}
integration.setSpec(
spec.putTraits(KNATIVE_TRAIT, new IntegrationTraitSpec.Builder()
spec.putTraits(KNATIVE_TRAIT, new TraitSpec.Builder()
.putConfiguration("enabled", "true")
.putConfiguration("channel-sources", channelSources)
.putConfiguration("channel-sinks", channelSinks)
Expand All @@ -97,12 +97,12 @@ protected void customizeService(IntegrationDeployment deployment, Integration in
}
integration.setSpec(
spec.putTraits(KNATIVE_SERVICE_TRAIT,
new IntegrationTraitSpec.Builder()
new TraitSpec.Builder()
.putConfiguration("enabled", "true")
.putConfiguration("min-scale", "0")
.build()
).putTraits(DEPLOYER_TRAIT,
new IntegrationTraitSpec.Builder()
new TraitSpec.Builder()
.putConfiguration("kind", KNATIVE_SERVICE_TRAIT)
.build()
).build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package io.syndesis.server.controller.integration.camelk.customizer;

import io.syndesis.server.controller.integration.camelk.crd.Integration;
import io.syndesis.server.controller.integration.camelk.crd.IntegrationTraitSpec;
import io.syndesis.server.controller.integration.camelk.crd.TraitSpec;
import io.syndesis.server.openshift.Exposure;
import io.syndesis.server.openshift.OpenShiftService;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -60,7 +60,7 @@ public class OwnerCustomizer extends AbstractTraitCustomizer {
));

@Override
protected Map<String, IntegrationTraitSpec> computeTraits(Integration integration, EnumSet<Exposure> exposure) {
protected Map<String, TraitSpec> computeTraits(Integration integration, EnumSet<Exposure> exposure) {
List<String> labels = new ArrayList<>(LABELS);
List<String> annotations = new ArrayList<>(ANNOTATIONS);

Expand All @@ -71,7 +71,7 @@ protected Map<String, IntegrationTraitSpec> computeTraits(Integration integratio

return Collections.singletonMap(
"owner",
new IntegrationTraitSpec.Builder()
new TraitSpec.Builder()
.putConfiguration("target-labels", String.join(",", labels))
.putConfiguration("target-annotations", String.join(",", annotations))
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.Map;

import io.syndesis.server.controller.integration.camelk.crd.Integration;
import io.syndesis.server.controller.integration.camelk.crd.IntegrationTraitSpec;
import io.syndesis.server.controller.integration.camelk.crd.TraitSpec;
import io.syndesis.server.openshift.Exposure;
import org.springframework.stereotype.Component;

Expand All @@ -30,10 +30,10 @@
@Component
public class PrometheusCustomizer extends AbstractTraitCustomizer {
@Override
protected Map<String, IntegrationTraitSpec> computeTraits(Integration integration, EnumSet<Exposure> exposure) {
protected Map<String, TraitSpec> computeTraits(Integration integration, EnumSet<Exposure> exposure) {
return Collections.singletonMap(
"prometheus",
new IntegrationTraitSpec.Builder()
new TraitSpec.Builder()
.putConfiguration("enabled", "true")
.putConfiguration("port", "9779")
.putConfiguration("service-monitor", "false")
Expand Down

0 comments on commit a48320a

Please sign in to comment.