This is an automated email from the ASF dual-hosted git repository.
marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
The following commit(s) were added to refs/heads/main by this push:
new a006d0f Saas feature51 (#453)
a006d0f is described below
commit a006d0f38292f66cc377db2dad67683f8e05a7d1
Author: Marat Gubaidullin <[email protected]>
AuthorDate: Thu Aug 11 18:34:59 2022 -0400
Saas feature51 (#453)
* Remove unused elements
* StepDefinition expand/collaps on select/unselect
---
karavan-builder/README.md | 1 +
karavan-core/src/core/api/CamelDefinitionApiExt.ts | 2 +-
karavan-core/src/core/api/CamelDefinitionYaml.ts | 7 +-
karavan-core/src/core/api/CamelDisplayUtil.ts | 86 ++
.../src/core/model/IntegrationDefinition.ts | 1 +
karavan-core/src/core/model/TraitDefinition.ts | 703 -----------
karavan-core/test/cloneDefinition.spec.ts | 1 -
.../test/getElementPropertiesByName.spec.ts | 2 +-
karavan-demo/postman/project/postman.yaml | 2 +-
karavan-designer/src/App.tsx | 6 +
karavan-designer/src/designer/karavan.css | 4 +
.../src/designer/route/DslConnections.tsx | 6 +-
karavan-designer/src/designer/route/DslElement.tsx | 75 +-
.../src/designer/route/RouteDesigner.tsx | 22 +-
karavan-designer/src/designer/utils/CamelUi.tsx | 3 +
.../camel/karavan/generator/AbstractGenerator.java | 11 -
.../camel/karavan/generator/KaravanGenerator.java | 3 -
.../generator/TraitDefinitionGenerator.java | 184 ---
karavan-generator/src/main/resources/traits.yaml | 1221 --------------------
19 files changed, 164 insertions(+), 2176 deletions(-)
diff --git a/karavan-builder/README.md b/karavan-builder/README.md
index 251ad51..d2c42ab 100644
--- a/karavan-builder/README.md
+++ b/karavan-builder/README.md
@@ -15,6 +15,7 @@
2. Create namespace
```
oc apply -f openshift/karavan-namespace.yaml
+ oc project karavan
```
3. Set git parameters
diff --git a/karavan-core/src/core/api/CamelDefinitionApiExt.ts
b/karavan-core/src/core/api/CamelDefinitionApiExt.ts
index 1614634..070fe30 100644
--- a/karavan-core/src/core/api/CamelDefinitionApiExt.ts
+++ b/karavan-core/src/core/api/CamelDefinitionApiExt.ts
@@ -472,7 +472,7 @@ export class CamelDefinitionApiExt {
);
properties?.filter(p => p.name !== 'steps')
.filter(p => p.name !== 'configurationRef')
- .filter(p => (className === 'RouteDefinition' && p.name ===
'id') || p.name !== 'id')
+ // .filter(p => (className === 'RouteDefinition' && p.name ===
'id') || p.name !== 'id')
.filter(p => (className === 'ToDefinition' && p.name !==
'pattern') || className !== 'ToDefinition')
.forEach(p => {
switch (p.name) {
diff --git a/karavan-core/src/core/api/CamelDefinitionYaml.ts
b/karavan-core/src/core/api/CamelDefinitionYaml.ts
index b05c8eb..2abf53b 100644
--- a/karavan-core/src/core/api/CamelDefinitionYaml.ts
+++ b/karavan-core/src/core/api/CamelDefinitionYaml.ts
@@ -23,19 +23,13 @@ import {CamelDefinitionYamlStep} from
"./CamelDefinitionYamlStep";
export class CamelDefinitionYaml {
static integrationToYaml = (integration: Integration): string => {
- console.log("integrationToYaml");
- console.log(integration);
const clone: any = CamelUtil.cloneIntegration(integration);
- console.log(clone);
const flows = integration.spec.flows
clone.spec.flows = flows?.map((f: any) =>
CamelDefinitionYaml.cleanupElement(f)).filter(x => Object.keys(x).length !== 0);
- console.log(clone);
if (integration.crd) {
delete clone.crd
const i = JSON.parse(JSON.stringify(clone, null, 3)); // fix
undefined in string attributes
- console.log(i);
const text = CamelDefinitionYaml.yamlDump(i);
- console.log(text);
return text;
} else {
const f = JSON.parse(JSON.stringify(clone.spec.flows, null, 3));
@@ -60,6 +54,7 @@ export class CamelDefinitionYaml {
if (object.properties && Object.keys(object.properties).length ===
0) delete object.properties;
}
delete object.uuid;
+ delete object.show;
Object.keys(object)
.forEach(key => {
if (object[key] instanceof CamelElement || (typeof object[key]
=== 'object' && object[key].dslName)) {
diff --git a/karavan-core/src/core/api/CamelDisplayUtil.ts
b/karavan-core/src/core/api/CamelDisplayUtil.ts
new file mode 100644
index 0000000..9954b08
--- /dev/null
+++ b/karavan-core/src/core/api/CamelDisplayUtil.ts
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import {Integration, CamelElement} from "../model/IntegrationDefinition";
+import {CamelUtil} from "./CamelUtil";
+import {CamelDefinitionApi} from "./CamelDefinitionApi";
+import {CamelDefinitionApiExt} from "./CamelDefinitionApiExt";
+
+export class CamelDisplayUtil {
+
+ static isStepDefinitionExpanded = (integration: Integration, stepUuid:
string, selectedUuid: string | undefined): boolean => {
+ const expandedUuids: string[] = [];
+ if (selectedUuid) {
+
expandedUuids.push(...this.getParentStepDefinitions(integration.spec.flows,
selectedUuid));
+ }
+ return expandedUuids.includes(stepUuid);
+ }
+
+ static getParentStepDefinitions = (flows: CamelElement[] | undefined,
uuid: string): string[] => {
+ const result: string[] = [];
+ let meta = CamelDefinitionApiExt.findStep(flows, uuid);
+ while (meta.step?.dslName !== 'FromDefinition') {
+ if (meta.step?.dslName === 'StepDefinition')
result.push(meta.step.uuid);
+ if (meta.parentUuid) meta = CamelDefinitionApiExt.findStep(flows,
meta.parentUuid);
+ }
+ return result;
+ }
+
+ static setIntegrationVisibility = (integration: Integration, selectedUuid:
string | undefined): Integration => {
+ const clone: any = CamelUtil.cloneIntegration(integration);
+ const flows = integration.spec.flows;
+ const expandedUuids: string[] = [];
+ if (selectedUuid) {
+ expandedUuids.push(...this.getParentStepDefinitions(flows,
selectedUuid));
+ }
+ clone.spec.flows = flows?.map((f: any) => this.setElementVisibility(f,
true, expandedUuids)).filter(x => Object.keys(x).length !== 0);
+ return clone;
+ }
+
+ static setElementVisibility = (step: CamelElement, showChildren: boolean,
expandedUuids: string[]): CamelElement => {
+ const result = CamelDefinitionApi.createStep(step.dslName, step);
+ result.show = showChildren;
+ if (result.dslName === 'StepDefinition' &&
!expandedUuids.includes(result.uuid)) {
+ showChildren = false;
+ } else if (result.dslName === 'StepDefinition' &&
expandedUuids.includes(result.uuid)) {
+ showChildren = true;
+ }
+ const ce =
CamelDefinitionApiExt.getElementChildrenDefinition(step.dslName);
+ ce.forEach(e => {
+ const cel = CamelDefinitionApiExt.getElementChildren(step, e);
+ if (e.multiple) {
+ (result as any)[e.name] = this.setElementsVisibility((result
as any)[e.name], showChildren, expandedUuids);
+ } else {
+ const prop = (result as any)[e.name];
+ if (prop && prop.hasOwnProperty("uuid")) {
+ (result as any)[e.name] =
this.setElementVisibility(cel[0], showChildren, expandedUuids);
+ }
+ }
+ })
+ return result;
+ }
+
+ static setElementsVisibility = (steps: CamelElement[] | undefined,
showChildren: boolean, expandedUuids: string[]): CamelElement[] => {
+ const result: CamelElement[] = []
+ if (steps !== undefined) {
+ steps.forEach(step => {
+ step = this.setElementVisibility(step, showChildren,
expandedUuids);
+ result.push(step);
+ })
+ }
+ return result
+ }
+}
diff --git a/karavan-core/src/core/model/IntegrationDefinition.ts
b/karavan-core/src/core/model/IntegrationDefinition.ts
index 6f05b88..4d2f103 100644
--- a/karavan-core/src/core/model/IntegrationDefinition.ts
+++ b/karavan-core/src/core/model/IntegrationDefinition.ts
@@ -53,6 +53,7 @@ export class Integration {
export class CamelElement {
uuid: string = ''
dslName: string = ''
+ show: boolean = true
constructor(dslName: string) {
this.uuid = uuidv4()
diff --git a/karavan-core/src/core/model/TraitDefinition.ts
b/karavan-core/src/core/model/TraitDefinition.ts
deleted file mode 100644
index 73a39db..0000000
--- a/karavan-core/src/core/model/TraitDefinition.ts
+++ /dev/null
@@ -1,703 +0,0 @@
-/**
- * Generated by karavan build tools - do NOT edit this file!
- */
-import {CamelElement} from "./IntegrationDefinition";
-
-export class TraitPropertyMeta {
- name: string
- type: string
- description: string
-
- constructor(name: string, type: string, description: string) {
- this.name = name;
- this.type = type;
- this.description = description;
- }
-}
-
-export class TraitMeta {
- name: string
- platform: boolean
- profiles: string
- description: string
- properties: TraitPropertyMeta[]
-
-
- constructor(name: string, platform:boolean, profiles: string, description:
string, properties: TraitPropertyMeta[]) {
- this.name = name;
- this.platform = platform;
- this.profiles = profiles;
- this.description = description;
- this.properties = properties;
- }
-}
-
-export class Trait extends CamelElement {
- affinity?: AffinityTrait;
- builder?: BuilderTrait;
- camel?: CamelTrait;
- container?: ContainerTrait;
- cron?: CronTrait;
- dependencies?: DependenciesTrait;
- deployer?: DeployerTrait;
- deployment?: DeploymentTrait;
- environment?: EnvironmentTrait;
- errorHandler?: ErrorHandlerTrait;
- gc?: GcTrait;
- health?: HealthTrait;
- ingress?: IngressTrait;
- istio?: IstioTrait;
- jolokia?: JolokiaTrait;
- jvm?: JvmTrait;
- kamelets?: KameletsTrait;
- keda?: KedaTrait;
- knativeService?: KnativeServiceTrait;
- knative?: KnativeTrait;
- logging?: LoggingTrait;
- master?: MasterTrait;
- mount?: MountTrait;
- openapi?: OpenapiTrait;
- owner?: OwnerTrait;
- pdb?: PdbTrait;
- platform?: PlatformTrait;
- pod?: PodTrait;
- prometheus?: PrometheusTrait;
- pullSecret?: PullSecretTrait;
- quarkus?: QuarkusTrait;
- route?: RouteTrait;
- serviceBinding?: ServiceBindingTrait;
- service?: ServiceTrait;
- threeScale?: ThreeScaleTrait;
- toleration?: TolerationTrait;
- tracing?: TracingTrait;
- public constructor(init?: Partial<Trait>) {
- super('Trait')
- Object.assign(this, init)
- }
-}
-export class AffinityTrait extends CamelElement {
- enabled?: boolean;
- podAffinity?: boolean;
- podAntiAffinity?: boolean;
- nodeAffinityLabels?: string[];
- podAffinityLabels?: string[];
- podAntiAffinityLabels?: string[];
- public constructor(init?: Partial<AffinityTrait>) {
- super('AffinityTrait')
- Object.assign(this, init)
- }
-}
-
-export class BuilderTrait extends CamelElement {
- enabled?: boolean;
- verbose?: boolean;
- properties?: string[];
- public constructor(init?: Partial<BuilderTrait>) {
- super('BuilderTrait')
- Object.assign(this, init)
- }
-}
-
-export class CamelTrait extends CamelElement {
- enabled?: boolean;
- runtimeVersion?: string;
- properties?: string[];
- public constructor(init?: Partial<CamelTrait>) {
- super('CamelTrait')
- Object.assign(this, init)
- }
-}
-
-export class ContainerTrait extends CamelElement {
- enabled?: boolean;
- auto?: boolean;
- requestCpu?: string;
- requestMemory?: string;
- limitCpu?: string;
- limitMemory?: string;
- expose?: boolean;
- port?: string;
- portName?: string;
- servicePort?: string;
- servicePortName?: string;
- name?: string;
- image?: string;
- imagePullPolicy?: string;
- probesEnabled?: boolean;
- livenessScheme?: string;
- livenessInitialDelay?: number;
- livenessTimeout?: number;
- livenessPeriod?: number;
- livenessSuccessThreshold?: number;
- livenessFailureThreshold?: number;
- readinessScheme?: string;
- readinessInitialDelay?: number;
- readinessTimeout?: number;
- readinessPeriod?: number;
- readinessSuccessThreshold?: number;
- readinessFailureThreshold?: number;
- public constructor(init?: Partial<ContainerTrait>) {
- super('ContainerTrait')
- Object.assign(this, init)
- }
-}
-
-export class CronTrait extends CamelElement {
- enabled?: boolean;
- schedule?: string;
- components?: string;
- fallback?: boolean;
- concurrencyPolicy?: string;
- auto?: boolean;
- startingDeadlineSeconds?: number;
- activeDeadlineSeconds?: number;
- backoffLimit?: number;
- public constructor(init?: Partial<CronTrait>) {
- super('CronTrait')
- Object.assign(this, init)
- }
-}
-
-export class DependenciesTrait extends CamelElement {
- public constructor(init?: Partial<DependenciesTrait>) {
- super('DependenciesTrait')
- Object.assign(this, init)
- }
-}
-
-export class DeployerTrait extends CamelElement {
- enabled?: boolean;
- kind?: string;
- public constructor(init?: Partial<DeployerTrait>) {
- super('DeployerTrait')
- Object.assign(this, init)
- }
-}
-
-export class DeploymentTrait extends CamelElement {
- enabled?: boolean;
- progressDeadlineSeconds?: number;
- public constructor(init?: Partial<DeploymentTrait>) {
- super('DeploymentTrait')
- Object.assign(this, init)
- }
-}
-
-export class EnvironmentTrait extends CamelElement {
- enabled?: boolean;
- containerMeta?: boolean;
- httpProxy?: boolean;
- vars?: string[];
- public constructor(init?: Partial<EnvironmentTrait>) {
- super('EnvironmentTrait')
- Object.assign(this, init)
- }
-}
-
-export class ErrorHandlerTrait extends CamelElement {
- enabled?: boolean;
- ref?: string;
- public constructor(init?: Partial<ErrorHandlerTrait>) {
- super('ErrorHandlerTrait')
- Object.assign(this, init)
- }
-}
-
-export class GcTrait extends CamelElement {
- enabled?: boolean;
- discoveryCache?: string;
- public constructor(init?: Partial<GcTrait>) {
- super('GcTrait')
- Object.assign(this, init)
- }
-}
-
-export class HealthTrait extends CamelElement {
- enabled?: boolean;
- livenessProbeEnabled?: boolean;
- livenessScheme?: string;
- livenessInitialDelay?: number;
- livenessTimeout?: number;
- livenessPeriod?: number;
- livenessSuccessThreshold?: number;
- livenessFailureThreshold?: number;
- readinessProbeEnabled?: boolean;
- readinessScheme?: string;
- readinessInitialDelay?: number;
- readinessTimeout?: number;
- readinessPeriod?: number;
- readinessSuccessThreshold?: number;
- readinessFailureThreshold?: number;
- public constructor(init?: Partial<HealthTrait>) {
- super('HealthTrait')
- Object.assign(this, init)
- }
-}
-
-export class IngressTrait extends CamelElement {
- enabled?: boolean;
- host?: string;
- auto?: boolean;
- public constructor(init?: Partial<IngressTrait>) {
- super('IngressTrait')
- Object.assign(this, init)
- }
-}
-
-export class IstioTrait extends CamelElement {
- enabled?: boolean;
- allow?: string;
- inject?: boolean;
- public constructor(init?: Partial<IstioTrait>) {
- super('IstioTrait')
- Object.assign(this, init)
- }
-}
-
-export class JolokiaTrait extends CamelElement {
- enabled?: boolean;
- caCert?: string;
- clientPrincipal?: string[];
- discoveryEnabled?: boolean;
- extendedClientCheck?: boolean;
- host?: string;
- password?: string;
- port?: string;
- protocol?: string;
- user?: string;
- useSslClientAuthentication?: boolean;
- options?: string[];
- public constructor(init?: Partial<JolokiaTrait>) {
- super('JolokiaTrait')
- Object.assign(this, init)
- }
-}
-
-export class JvmTrait extends CamelElement {
- enabled?: boolean;
- debug?: boolean;
- debugSuspend?: boolean;
- printCommand?: boolean;
- debugAddress?: string;
- options?: string[];
- classpath?: string;
- public constructor(init?: Partial<JvmTrait>) {
- super('JvmTrait')
- Object.assign(this, init)
- }
-}
-
-export class KameletsTrait extends CamelElement {
- enabled?: boolean;
- auto?: boolean;
- list?: string;
- public constructor(init?: Partial<KameletsTrait>) {
- super('KameletsTrait')
- Object.assign(this, init)
- }
-}
-
-export class KedaTrait extends CamelElement {
- enabled?: boolean;
- auto?: boolean;
- hackControllerReplicas?: boolean;
- pollingInterval?: number;
- cooldownPeriod?: number;
- idleReplicaCount?: number;
- minReplicaCount?: number;
- maxReplicaCount?: number;
- triggers?: string;
- public constructor(init?: Partial<KedaTrait>) {
- super('KedaTrait')
- Object.assign(this, init)
- }
-}
-
-export class KnativeServiceTrait extends CamelElement {
- enabled?: boolean;
- autoscalingClass?: string;
- autoscalingMetric?: string;
- autoscalingTarget?: string;
- minScale?: string;
- maxScale?: string;
- rolloutDuration?: string;
- auto?: boolean;
- public constructor(init?: Partial<KnativeServiceTrait>) {
- super('KnativeServiceTrait')
- Object.assign(this, init)
- }
-}
-
-export class KnativeTrait extends CamelElement {
- enabled?: boolean;
- configuration?: string;
- channelSources?: string[];
- channelSinks?: string[];
- endpointSources?: string[];
- endpointSinks?: string[];
- eventSources?: string[];
- eventSinks?: string[];
- filterSourceChannels?: boolean;
- sinkBinding?: boolean;
- auto?: boolean;
- public constructor(init?: Partial<KnativeTrait>) {
- super('KnativeTrait')
- Object.assign(this, init)
- }
-}
-
-export class LoggingTrait extends CamelElement {
- enabled?: boolean;
- color?: boolean;
- format?: string;
- level?: string;
- json?: boolean;
- jsonPrettyPrint?: boolean;
- public constructor(init?: Partial<LoggingTrait>) {
- super('LoggingTrait')
- Object.assign(this, init)
- }
-}
-
-export class MasterTrait extends CamelElement {
- enabled?: boolean;
- auto?: boolean;
- includeDelegateDependencies?: boolean;
- resourceName?: string;
- resourceType?: string;
- labelKey?: string;
- labelValue?: string;
- public constructor(init?: Partial<MasterTrait>) {
- super('MasterTrait')
- Object.assign(this, init)
- }
-}
-
-export class MountTrait extends CamelElement {
- enabled?: boolean;
- configs?: string[];
- resources?: string[];
- volumes?: string[];
- public constructor(init?: Partial<MountTrait>) {
- super('MountTrait')
- Object.assign(this, init)
- }
-}
-
-export class OpenapiTrait extends CamelElement {
- enabled?: boolean;
- configmaps?: string[];
- public constructor(init?: Partial<OpenapiTrait>) {
- super('OpenapiTrait')
- Object.assign(this, init)
- }
-}
-
-export class OwnerTrait extends CamelElement {
- enabled?: boolean;
- targetAnnotations?: string[];
- targetLabels?: string[];
- public constructor(init?: Partial<OwnerTrait>) {
- super('OwnerTrait')
- Object.assign(this, init)
- }
-}
-
-export class PdbTrait extends CamelElement {
- enabled?: boolean;
- minAvailable?: string;
- maxUnavailable?: string;
- public constructor(init?: Partial<PdbTrait>) {
- super('PdbTrait')
- Object.assign(this, init)
- }
-}
-
-export class PlatformTrait extends CamelElement {
- enabled?: boolean;
- createDefault?: boolean;
- global?: boolean;
- auto?: boolean;
- public constructor(init?: Partial<PlatformTrait>) {
- super('PlatformTrait')
- Object.assign(this, init)
- }
-}
-
-export class PodTrait extends CamelElement {
- public constructor(init?: Partial<PodTrait>) {
- super('PodTrait')
- Object.assign(this, init)
- }
-}
-
-export class PrometheusTrait extends CamelElement {
- enabled?: boolean;
- podMonitor?: boolean;
- podMonitorLabels?: string[];
- public constructor(init?: Partial<PrometheusTrait>) {
- super('PrometheusTrait')
- Object.assign(this, init)
- }
-}
-
-export class PullSecretTrait extends CamelElement {
- enabled?: boolean;
- secretName?: string;
- imagePullerDelegation?: boolean;
- auto?: boolean;
- public constructor(init?: Partial<PullSecretTrait>) {
- super('PullSecretTrait')
- Object.assign(this, init)
- }
-}
-
-export class QuarkusTrait extends CamelElement {
- enabled?: boolean;
- packageType?: string;
- public constructor(init?: Partial<QuarkusTrait>) {
- super('QuarkusTrait')
- Object.assign(this, init)
- }
-}
-
-export class RouteTrait extends CamelElement {
- enabled?: boolean;
- host?: string;
- tlsTermination?: string;
- tlsCertificate?: string;
- tlsCertificateSecret?: string;
- tlsKey?: string;
- tlsKeySecret?: string;
- tlsCaCertificate?: string;
- tlsCaCertificateSecret?: string;
- tlsDestinationCaCertificate?: string;
- tlsDestinationCaCertificateSecret?: string;
- tlsInsecureEdgeTerminationPolicy?: string;
- public constructor(init?: Partial<RouteTrait>) {
- super('RouteTrait')
- Object.assign(this, init)
- }
-}
-
-export class ServiceBindingTrait extends CamelElement {
- enabled?: boolean;
- services?: string[];
- public constructor(init?: Partial<ServiceBindingTrait>) {
- super('ServiceBindingTrait')
- Object.assign(this, init)
- }
-}
-
-export class ServiceTrait extends CamelElement {
- enabled?: boolean;
- auto?: boolean;
- nodePort?: boolean;
- public constructor(init?: Partial<ServiceTrait>) {
- super('ServiceTrait')
- Object.assign(this, init)
- }
-}
-
-export class ThreeScaleTrait extends CamelElement {
- enabled?: boolean;
- auto?: boolean;
- scheme?: string;
- path?: string;
- port?: string;
- descriptionPath?: string;
- public constructor(init?: Partial<ThreeScaleTrait>) {
- super('ThreeScaleTrait')
- Object.assign(this, init)
- }
-}
-
-export class TolerationTrait extends CamelElement {
- enabled?: boolean;
- taints?: string[];
- public constructor(init?: Partial<TolerationTrait>) {
- super('TolerationTrait')
- Object.assign(this, init)
- }
-}
-
-export class TracingTrait extends CamelElement {
- enabled?: boolean;
- auto?: boolean;
- serviceName?: string;
- endpoint?: string;
- samplerType?: string;
- samplerParam?: string;
- public constructor(init?: Partial<TracingTrait>) {
- super('TracingTrait')
- Object.assign(this, init)
- }
-}
-
-export class TraitApi {
-
- static traitsFromYaml(yaml: any) {
- const traits: Trait = new Trait();
- Object.keys(yaml).forEach(key => {
- if (key === 'affinity') traits.affinity = new
AffinityTrait(yaml.affinity.configuration);
- if (key === 'builder') traits.builder = new
BuilderTrait(yaml.builder.configuration);
- if (key === 'camel') traits.camel = new
CamelTrait(yaml.camel.configuration);
- if (key === 'container') traits.container = new
ContainerTrait(yaml.container.configuration);
- if (key === 'cron') traits.cron = new
CronTrait(yaml.cron.configuration);
- if (key === 'dependencies') traits.dependencies = new
DependenciesTrait(yaml.dependencies.configuration);
- if (key === 'deployer') traits.deployer = new
DeployerTrait(yaml.deployer.configuration);
- if (key === 'deployment') traits.deployment = new
DeploymentTrait(yaml.deployment.configuration);
- if (key === 'environment') traits.environment = new
EnvironmentTrait(yaml.environment.configuration);
- if (key === 'errorHandler') traits.errorHandler = new
ErrorHandlerTrait(yaml.errorHandler.configuration);
- if (key === 'gc') traits.gc = new GcTrait(yaml.gc.configuration);
- if (key === 'health') traits.health = new
HealthTrait(yaml.health.configuration);
- if (key === 'ingress') traits.ingress = new
IngressTrait(yaml.ingress.configuration);
- if (key === 'istio') traits.istio = new
IstioTrait(yaml.istio.configuration);
- if (key === 'jolokia') traits.jolokia = new
JolokiaTrait(yaml.jolokia.configuration);
- if (key === 'jvm') traits.jvm = new
JvmTrait(yaml.jvm.configuration);
- if (key === 'kamelets') traits.kamelets = new
KameletsTrait(yaml.kamelets.configuration);
- if (key === 'keda') traits.keda = new
KedaTrait(yaml.keda.configuration);
- if (key === 'knativeService') traits.knativeService = new
KnativeServiceTrait(yaml.knativeService.configuration);
- if (key === 'knative') traits.knative = new
KnativeTrait(yaml.knative.configuration);
- if (key === 'logging') traits.logging = new
LoggingTrait(yaml.logging.configuration);
- if (key === 'master') traits.master = new
MasterTrait(yaml.master.configuration);
- if (key === 'mount') traits.mount = new
MountTrait(yaml.mount.configuration);
- if (key === 'openapi') traits.openapi = new
OpenapiTrait(yaml.openapi.configuration);
- if (key === 'owner') traits.owner = new
OwnerTrait(yaml.owner.configuration);
- if (key === 'pdb') traits.pdb = new
PdbTrait(yaml.pdb.configuration);
- if (key === 'platform') traits.platform = new
PlatformTrait(yaml.platform.configuration);
- if (key === 'pod') traits.pod = new
PodTrait(yaml.pod.configuration);
- if (key === 'prometheus') traits.prometheus = new
PrometheusTrait(yaml.prometheus.configuration);
- if (key === 'pullSecret') traits.pullSecret = new
PullSecretTrait(yaml.pullSecret.configuration);
- if (key === 'quarkus') traits.quarkus = new
QuarkusTrait(yaml.quarkus.configuration);
- if (key === 'route') traits.route = new
RouteTrait(yaml.route.configuration);
- if (key === 'serviceBinding') traits.serviceBinding = new
ServiceBindingTrait(yaml.serviceBinding.configuration);
- if (key === 'service') traits.service = new
ServiceTrait(yaml.service.configuration);
- if (key === '3scale') traits.threeScale = new
ThreeScaleTrait(yaml["3scale"].configuration);
- if (key === 'toleration') traits.toleration = new
TolerationTrait(yaml.toleration.configuration);
- if (key === 'tracing') traits.tracing = new
TracingTrait(yaml.tracing.configuration);
- });
- return traits;
- }
-
- static cloneTrait(t: Trait) {
- const clone = JSON.parse(JSON.stringify(t));
- const traits: Trait = new Trait();
- Object.keys(clone).forEach(key => { if (key === 'affinity')
traits.affinity = new AffinityTrait(clone.affinity);
- if (key === 'builder') traits.builder = new
BuilderTrait(clone.builder);
- if (key === 'camel') traits.camel = new CamelTrait(clone.camel);
- if (key === 'container') traits.container = new
ContainerTrait(clone.container);
- if (key === 'cron') traits.cron = new CronTrait(clone.cron);
- if (key === 'dependencies') traits.dependencies = new
DependenciesTrait(clone.dependencies);
- if (key === 'deployer') traits.deployer = new
DeployerTrait(clone.deployer);
- if (key === 'deployment') traits.deployment = new
DeploymentTrait(clone.deployment);
- if (key === 'environment') traits.environment = new
EnvironmentTrait(clone.environment);
- if (key === 'errorHandler') traits.errorHandler = new
ErrorHandlerTrait(clone.errorHandler);
- if (key === 'gc') traits.gc = new GcTrait(clone.gc);
- if (key === 'health') traits.health = new
HealthTrait(clone.health);
- if (key === 'ingress') traits.ingress = new
IngressTrait(clone.ingress);
- if (key === 'istio') traits.istio = new IstioTrait(clone.istio);
- if (key === 'jolokia') traits.jolokia = new
JolokiaTrait(clone.jolokia);
- if (key === 'jvm') traits.jvm = new JvmTrait(clone.jvm);
- if (key === 'kamelets') traits.kamelets = new
KameletsTrait(clone.kamelets);
- if (key === 'keda') traits.keda = new KedaTrait(clone.keda);
- if (key === 'knativeService') traits.knativeService = new
KnativeServiceTrait(clone.knativeService);
- if (key === 'knative') traits.knative = new
KnativeTrait(clone.knative);
- if (key === 'logging') traits.logging = new
LoggingTrait(clone.logging);
- if (key === 'master') traits.master = new
MasterTrait(clone.master);
- if (key === 'mount') traits.mount = new MountTrait(clone.mount);
- if (key === 'openapi') traits.openapi = new
OpenapiTrait(clone.openapi);
- if (key === 'owner') traits.owner = new OwnerTrait(clone.owner);
- if (key === 'pdb') traits.pdb = new PdbTrait(clone.pdb);
- if (key === 'platform') traits.platform = new
PlatformTrait(clone.platform);
- if (key === 'pod') traits.pod = new PodTrait(clone.pod);
- if (key === 'prometheus') traits.prometheus = new
PrometheusTrait(clone.prometheus);
- if (key === 'pullSecret') traits.pullSecret = new
PullSecretTrait(clone.pullSecret);
- if (key === 'quarkus') traits.quarkus = new
QuarkusTrait(clone.quarkus);
- if (key === 'route') traits.route = new RouteTrait(clone.route);
- if (key === 'serviceBinding') traits.serviceBinding = new
ServiceBindingTrait(clone.serviceBinding);
- if (key === 'service') traits.service = new
ServiceTrait(clone.service);
- if (key === 'threeScale') traits.threeScale = new
ThreeScaleTrait(clone.threeScale);
- if (key === 'toleration') traits.toleration = new
TolerationTrait(clone.toleration);
- if (key === 'tracing') traits.tracing = new
TracingTrait(clone.tracing);
- });
- return traits;
- }
-}
-
-export const CamelTraitMetadata: TraitMeta[] = [ new TraitMeta("affinity",
false, "Kubernetes, Knative, OpenShift", "Allows constraining which nodes the
integration pod(s) are eligible to be scheduled on, based on labels on the
node, or with inter-pod affinity and anti-affinity, based on labels on pods
that are already running on the nodes. It's disabled by default.", [
- ]),
- new TraitMeta("builder", false, "Kubernetes, Knative, OpenShift", "The
builder trait is internally used to determine the best strategy to build and
configure IntegrationKits.", [
- ]),
- new TraitMeta("camel", false, "Kubernetes, Knative, OpenShift", "The Camel
trait can be used to configure versions of Apache Camel K runtime and related
libraries, it cannot be disabled.", [
- ]),
- new TraitMeta("container", false, "Kubernetes, Knative, OpenShift", "The
Container trait can be used to configure properties of the container where the
integration will run. It also provides configuration for Services associated to
the container.", [
- ]),
- new TraitMeta("cron", false, "Kubernetes, Knative, OpenShift", "The Cron
trait can be used to customize the behaviour of periodic timer/cron based
integrations. While normally an integration requires a pod to be always up and
running, some periodic tasks, such as batch jobs, require to be activated at
specific hours of the day or with a periodic delay of minutes. For such tasks,
the cron trait can materialize the integration as a Kubernetes CronJob instead
of a standard deployment, i [...]
- ]),
- new TraitMeta("dependencies", false, "Kubernetes, Knative, OpenShift",
"The Dependencies trait is internally used to automatically add runtime
dependencies based on the integration that the user wants to run.", [
- ]),
- new TraitMeta("deployer", false, "Kubernetes, Knative, OpenShift", "The
deployer trait is responsible for deploying the resources owned by the
integration, and can be used to explicitly select the underlying controller
that will manage the integration pods.", [
- ]),
- new TraitMeta("deployment", false, "Kubernetes, Knative, OpenShift", "The
Deployment trait is responsible for generating the Kubernetes deployment that
will make sure the integration will run in the cluster.", [
- ]),
- new TraitMeta("environment", false, "Kubernetes, Knative, OpenShift", "The
environment trait is used internally to inject standard environment variables
in the integration container, such as `NAMESPACE`, `POD_NAME` and others.", [
- ]),
- new TraitMeta("error-handler", false, "Kubernetes, Knative, OpenShift",
"The error-handler is a platform trait used to inject Error Handler source into
the integration runtime.", [
- ]),
- new TraitMeta("gc", false, "Kubernetes, Knative, OpenShift", "The GC Trait
garbage-collects all resources that are no longer necessary upon integration
updates.", [
- ]),
- new TraitMeta("health", false, "Kubernetes, Knative, OpenShift", "The
health trait is responsible for configuring the health probes on the
integration container. It's disabled by default.", [
- ]),
- new TraitMeta("ingress", false, "Kubernetes", "The Ingress trait can be
used to expose the service associated with the integration to the outside world
with a Kubernetes Ingress. It's enabled by default whenever a Service is added
to the integration (through the `service` trait).", [
- ]),
- new TraitMeta("istio", false, "Kubernetes, Knative, OpenShift", "The Istio
trait allows configuring properties related to the Istio service mesh, such as
sidecar injection and outbound IP ranges.", [
- ]),
- new TraitMeta("jolokia", false, "Kubernetes, Knative, OpenShift", "The
Jolokia trait activates and configures the Jolokia Java agent. See
https://jolokia.org/reference/html/agents.html", [
- ]),
- new TraitMeta("jvm", false, "Kubernetes, Knative, OpenShift", "The JVM
trait is used to configure the JVM that runs the integration.", [
- ]),
- new TraitMeta("kamelets", false, "Kubernetes, Knative, OpenShift", "The
kamelets trait is a platform trait used to inject Kamelets into the integration
runtime.", [
- ]),
- new TraitMeta("keda", false, "Kubernetes, Knative, OpenShift", "The KEDA
trait can be used for automatic integration with KEDA autoscalers. The trait
can be either manually configured using the `triggers` option or automatically
configured via markers in the Kamelets. For information on how to use KEDA
enabled Kamelets with the KEDA trait, refer to
xref:ROOT:kamelets/kamelets-user.adoc#kamelet-keda-user[the KEDA section in the
Kamelets user guide]. If you want to create Kamelets that [...]
- ]),
- new TraitMeta("knative-service", false, "Knative", "The Knative Service
trait allows configuring options when running the Integration as a Knative
service, instead of a standard Kubernetes Deployment. Running an Integration as
a Knative Service enables auto-scaling (and scaling-to-zero), but those
features are only relevant when the Camel route(s) use(s) an HTTP endpoint
consumer.", [
- ]),
- new TraitMeta("knative", false, "Knative", "The Knative trait
automatically discovers addresses of Knative resources and inject them into the
running integration. The full Knative configuration is injected in the
CAMEL_KNATIVE_CONFIGURATION in JSON format. The Camel Knative component will
then use the full configuration to configure the routes. The trait is enabled
by default when the Knative profile is active.", [
- ]),
- new TraitMeta("logging", false, "Kubernetes, Knative, OpenShift", "The
Logging trait is used to configure Integration runtime logging options (such as
color and format). The logging backend is provided by Quarkus, whose
configuration is documented at https://quarkus.io/guides/logging.", [
- ]),
- new TraitMeta("master", false, "Kubernetes, Knative, OpenShift", "The
Master trait allows to configure the integration to automatically leverage
Kubernetes resources for doing leader election and starting *master* routes
only on certain instances. It's activated automatically when using the master
endpoint in a route, e.g. `from(\"master:lockname:telegram:bots\")...`. NOTE:
this trait adds special permissions to the integration service account in order
to read/write configmaps and re [...]
- ]),
- new TraitMeta("mount", false, "Kubernetes, Knative, OpenShift", "The Mount
trait can be used to configure volumes mounted on the Integration Pods.", [
- ]),
- new TraitMeta("openapi", false, "Kubernetes, Knative, OpenShift", "The
OpenAPI DSL trait is internally used to allow creating integrations from a
OpenAPI specs.", [
- ]),
- new TraitMeta("owner", false, "Kubernetes, Knative, OpenShift", "The Owner
trait ensures that all created resources belong to the integration being
created and transfers annotations and labels on the integration onto these
owned resources.", [
- ]),
- new TraitMeta("pdb", false, "Kubernetes, Knative, OpenShift", "The PDB
trait allows to configure the PodDisruptionBudget resource for the Integration
pods.", [
- ]),
- new TraitMeta("platform", false, "Kubernetes, Knative, OpenShift", "The
platform trait is a base trait that is used to assign an integration platform
to an integration. In case the platform is missing, the trait is allowed to
create a default platform. This feature is especially useful in contexts where
there's no need to provide a custom configuration for the platform (e.g. on
OpenShift the default settings work, since there's an embedded container image
registry).", [
- ]),
- new TraitMeta("pod", false, "Kubernetes, Knative, OpenShift", "The pod
trait allows the customization of the Integration pods. It applies the
`PodSpecTemplate` struct contained in the Integration `.spec.podTemplate`
field, into the Integration deployment Pods template, using strategic merge
patch. This can be used to customize the container where Camel routes execute,
by using the `integration` container name.", [
- ]),
- new TraitMeta("prometheus", false, "Kubernetes, Knative, OpenShift", "The
Prometheus trait configures a Prometheus-compatible endpoint. It also creates a
`PodMonitor` resource, so that the endpoint can be scraped automatically, when
using the Prometheus operator. The metrics are exposed using MicroProfile
Metrics. WARNING: The creation of the `PodMonitor` resource requires the
https://github.com/coreos/prometheus-operator[Prometheus Operator] custom
resource definition to be installe [...]
- ]),
- new TraitMeta("pull-secret", false, "Kubernetes, Knative, OpenShift", "The
Pull Secret trait sets a pull secret on the pod, to allow Kubernetes to
retrieve the container image from an external registry. The pull secret can be
specified manually or, in case you've configured authentication for an external
container registry on the `IntegrationPlatform`, the same secret is used to
pull images. It's enabled by default whenever you configure authentication for
an external container regis [...]
- ]),
- new TraitMeta("quarkus", false, "Kubernetes, Knative, OpenShift", "The
Quarkus trait configures the Quarkus runtime. It's enabled by default. NOTE:
Compiling to a native executable, i.e. when using `package-type=native`, is
only supported for kamelets, as well as YAML and XML integrations. It also
requires at least 4GiB of memory, so the Pod running the native build, that is
either the operator Pod, or the build Pod (depending on the build strategy
configured for the platform), must [...]
- ]),
- new TraitMeta("route", false, "OpenShift", "The Route trait can be used to
configure the creation of OpenShift routes for the integration. The certificate
and key contents may be sourced either from the local filesystem or in a
Openshift `secret` object. The user may use the parameters ending in `-secret`
(example: `tls-certificate-secret`) to reference a certificate stored in a
`secret`. Parameters ending in `-secret` have higher priorities and in case the
same route parameter is se [...]
- ]),
- new TraitMeta("service-binding", false, "Kubernetes, Knative, OpenShift",
"The Service Binding trait allows users to connect to Services in Kubernetes:
https://github.com/k8s-service-bindings/spec#service-binding As the
specification is still evolving this is subject to change", [
- ]),
- new TraitMeta("service", false, "Kubernetes, OpenShift", "The Service
trait exposes the integration with a Service resource so that it can be
accessed by other applications (or integrations) in the same namespace. It's
enabled by default if the integration depends on a Camel component that can
expose a HTTP endpoint.", [
- ]),
- new TraitMeta("3scale", false, "Kubernetes, Knative, OpenShift", "The
3scale trait can be used to automatically create annotations that allow 3scale
to discover the generated service and make it available for API management. The
3scale trait is disabled by default.", [
- ]),
- new TraitMeta("toleration", false, "Kubernetes, Knative, OpenShift", "This
trait sets Tolerations over Integration pods. Tolerations allow (but do not
require) the pods to schedule onto nodes with matching taints. See
https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/
for more details. The toleration should be expressed in a similar manner that
of taints, i.e., `Key[=Value]:Effect[:Seconds]`, where values in square
brackets are optional. For examples: - `no [...]
- ]),
- new TraitMeta("tracing", false, "Kubernetes, Knative, OpenShift", "The
Tracing trait can be used to automatically publish tracing information to an
OpenTracing compatible collector. The trait is able to automatically discover
the tracing endpoint available in the namespace (supports **Jaeger**). The
Tracing trait is disabled by default.", [
- ]),
-]
-
diff --git a/karavan-core/test/cloneDefinition.spec.ts
b/karavan-core/test/cloneDefinition.spec.ts
index 3eb6b07..bedff1d 100644
--- a/karavan-core/test/cloneDefinition.spec.ts
+++ b/karavan-core/test/cloneDefinition.spec.ts
@@ -26,7 +26,6 @@ import {ExpressionDefinition} from
"../src/core/model/CamelDefinition";
import {Integration} from "../src/core/model/IntegrationDefinition";
import {RouteDefinition} from "../src/core/model/CamelDefinition";
import {CamelUtil} from "../src/core/api/CamelUtil";
-import {CamelTrait} from "../src/core/model/TraitDefinition";
describe('Clone', () => {
diff --git a/karavan-core/test/getElementPropertiesByName.spec.ts
b/karavan-core/test/getElementPropertiesByName.spec.ts
index a8645e4..a51526e 100644
--- a/karavan-core/test/getElementPropertiesByName.spec.ts
+++ b/karavan-core/test/getElementPropertiesByName.spec.ts
@@ -24,7 +24,7 @@ describe('getElementPropertiesByName', () => {
it('getElementPropertiesByName 1', () => {
const p: PropertyMeta[] =
CamelDefinitionApiExt.getElementPropertiesByName("json");
- expect(p.length).to.equal(23);
+ expect(p.length).to.equal(24);
});
diff --git a/karavan-demo/postman/project/postman.yaml
b/karavan-demo/postman/project/postman.yaml
index 80a7124..9c7b86d 100644
--- a/karavan-demo/postman/project/postman.yaml
+++ b/karavan-demo/postman/project/postman.yaml
@@ -130,4 +130,4 @@ spec:
brokerUrl: tcp://localhost:1883
- beans:
- name: aggregator
- type:
org.apache.camel.processor.aggregate.GroupedBodyAggregationStrategy
\ No newline at end of file
+ type:
org.apache.camel.processor.aggregate.GroupedBodyAggregationStrategy
diff --git a/karavan-designer/src/App.tsx b/karavan-designer/src/App.tsx
index 35930b4..6a95d2f 100644
--- a/karavan-designer/src/App.tsx
+++ b/karavan-designer/src/App.tsx
@@ -24,6 +24,8 @@ import {KaravanDesigner} from "./designer/KaravanDesigner";
import {KameletsPage} from "./kamelets/KameletsPage";
import {ComponentsPage} from "./components/ComponentsPage";
import {EipPage} from "./eip/EipPage";
+import {CamelDefinitionYaml} from "karavan-core/lib/api/CamelDefinitionYaml";
+import {CamelDisplayUtil} from "karavan-core/lib/api/CamelDisplayUtil";
interface Props {
page: "designer" | "kamelets" | "components" | "eip" | "builder";
@@ -51,6 +53,10 @@ class App extends React.Component<Props, State> {
' from:\n' +
' uri: kamelet:timer-source\n' +
' steps:\n' +
+ ' - step:\n' +
+ ' steps:\n' +
+ ' - choice: {}\n' +
+ ' - log: {}\n' +
' - log:\n' +
' message: ${body}\n' +
' - aggregate: {}\n' +
diff --git a/karavan-designer/src/designer/karavan.css
b/karavan-designer/src/designer/karavan.css
index f831c3b..2e386bf 100644
--- a/karavan-designer/src/designer/karavan.css
+++ b/karavan-designer/src/designer/karavan.css
@@ -771,6 +771,10 @@
z-index: 100;
}
+.karavan .dsl-page .flows .hidden-step {
+ display: none;
+}
+
.element-builder .add-button {
top: 0;
right: 5px;
diff --git a/karavan-designer/src/designer/route/DslConnections.tsx
b/karavan-designer/src/designer/route/DslConnections.tsx
index 25d3a2f..0806761 100644
--- a/karavan-designer/src/designer/route/DslConnections.tsx
+++ b/karavan-designer/src/designer/route/DslConnections.tsx
@@ -59,8 +59,8 @@ export class DslConnections extends React.Component<Props,
State> {
setPosition(evt: DslPosition) {
if (evt.command === "add") this.setState(prevState => ({steps:
prevState.steps.set(evt.step.uuid, evt)}));
else if (evt.command === "delete") this.setState(prevState => {
- prevState.steps.clear();
- // prevState.steps.delete(evt.step.uuid);
+ // prevState.steps.clear();
+ prevState.steps.delete(evt.step.uuid);
return {steps: prevState.steps};
});
}
@@ -371,7 +371,7 @@ export class DslConnections extends React.Component<Props,
State> {
const startY = parent.headerRect.y + parent.headerRect.height
- this.props.top;
if ((!pos.inSteps || (pos.inSteps && pos.position === 0)) &&
parent.step.dslName !== 'MulticastDefinition') {
return (
- <path d={`M ${startX},${startY} C ${startX},${endY}
${endX},${startY} ${endX},${endY}`}
+ <path name={pos.step.dslName} d={`M
${startX},${startY} C ${startX},${endY} ${endX},${startY} ${endX},${endY}`}
className="path" key={pos.step.uuid}
markerEnd="url(#arrowhead)"/>
)
} else if (parent.step.dslName === 'MulticastDefinition' &&
pos.inSteps) {
diff --git a/karavan-designer/src/designer/route/DslElement.tsx
b/karavan-designer/src/designer/route/DslElement.tsx
index 9176a31..755ea8f 100644
--- a/karavan-designer/src/designer/route/DslElement.tsx
+++ b/karavan-designer/src/designer/route/DslElement.tsx
@@ -22,14 +22,16 @@ import '../karavan.css';
import AddIcon from "@patternfly/react-icons/dist/js/icons/plus-circle-icon";
import DeleteIcon from
"@patternfly/react-icons/dist/js/icons/times-circle-icon";
import InsertIcon from
"@patternfly/react-icons/dist/js/icons/arrow-alt-circle-right-icon";
-import {CamelElement} from "karavan-core/lib/model/IntegrationDefinition";
+import {CamelElement, Integration} from
"karavan-core/lib/model/IntegrationDefinition";
import {CamelUi} from "../utils/CamelUi";
import {EventBus} from "../utils/EventBus";
import {ChildElement, CamelDefinitionApiExt} from
"karavan-core/lib/api/CamelDefinitionApiExt";
import ReactDOM from "react-dom";
import {CamelUtil} from "karavan-core/lib/api/CamelUtil";
+import {CamelDisplayUtil} from "karavan-core/lib/api/CamelDisplayUtil";
interface Props {
+ integration: Integration,
step: CamelElement,
parent: CamelElement | undefined,
deleteElement: any
@@ -43,7 +45,6 @@ interface Props {
}
interface State {
- step: CamelElement,
showSelector: boolean
tabIndex: string | number
selectedUuid: string
@@ -54,7 +55,6 @@ interface State {
export class DslElement extends React.Component<Props, State> {
public state: State = {
- step: this.props.step,
showSelector: false,
tabIndex: 0,
selectedUuid: this.props.selectedUuid,
@@ -73,7 +73,7 @@ export class DslElement extends React.Component<Props, State>
{
if (isInsert && this.props.parent) {
this.props.openSelector.call(this, this.props.parent.uuid,
this.props.parent.dslName, showSteps, this.props.position);
} else {
- this.props.openSelector.call(this, this.state.step.uuid,
this.state.step.dslName, showSteps);
+ this.props.openSelector.call(this, this.props.step.uuid,
this.props.step.dslName, showSteps);
}
}
@@ -83,47 +83,47 @@ export class DslElement extends React.Component<Props,
State> {
delete = (evt: React.MouseEvent) => {
evt.stopPropagation();
- this.props.deleteElement.call(this, this.state.step.uuid);
+ this.props.deleteElement.call(this, this.props.step.uuid);
}
selectElement = (evt: React.MouseEvent) => {
evt.stopPropagation();
- this.props.selectElement.call(this, this.state.step);
+ this.props.selectElement.call(this, this.props.step);
}
isSelected = (): boolean => {
- return this.state.selectedUuid === this.state.step.uuid
+ return this.state.selectedUuid === this.props.step.uuid
}
hasBorder = (): boolean => {
- return (this.state?.step?.hasSteps() &&
!['FromDefinition'].includes(this.state.step.dslName))
- || ['RouteDefinition', 'TryDefinition', 'ChoiceDefinition',
'SwitchDefinition'].includes(this.state.step.dslName);
+ return (this.props.step?.hasSteps() &&
!['FromDefinition'].includes(this.props.step.dslName))
+ || ['RouteDefinition', 'TryDefinition', 'ChoiceDefinition',
'SwitchDefinition'].includes(this.props.step.dslName);
}
isNotDraggable = (): boolean => {
- return ['FromDefinition', 'RouteDefinition', 'WhenDefinition',
'OtherwiseDefinition'].includes(this.state.step.dslName);
+ return ['FromDefinition', 'RouteDefinition', 'WhenDefinition',
'OtherwiseDefinition'].includes(this.props.step.dslName);
}
isWide = (): boolean => {
return ['RouteDefinition', 'ChoiceDefinition', 'SwitchDefinition',
'MulticastDefinition', 'TryDefinition', 'CircuitBreakerDefinition']
- .includes(this.state.step.dslName);
+ .includes(this.props.step.dslName);
}
isAddStepButtonLeft = (): boolean => {
return ['MulticastDefinition']
- .includes(this.state.step.dslName);
+ .includes(this.props.step.dslName);
}
isHorizontal = (): boolean => {
- return ['MulticastDefinition'].includes(this.state.step.dslName);
+ return ['MulticastDefinition'].includes(this.props.step.dslName);
}
isRoot = (): boolean => {
- return this.state.step?.dslName?.startsWith("RouteDefinition");
+ return this.props.step?.dslName?.startsWith("RouteDefinition");
}
isInStepWithChildren = () => {
- const step: CamelElement = this.state.step;
+ const step: CamelElement = this.props.step;
const children =
CamelDefinitionApiExt.getElementChildrenDefinition(step.dslName);
return children.filter((c: ChildElement) => c.name === 'steps' ||
c.multiple).length > 0 && this.props.inSteps;
}
@@ -149,7 +149,7 @@ export class DslElement extends React.Component<Props,
State> {
}
hasWideChildrenElement = () => {
- const [hasStepsField, stepsChildrenCount, hasNonStepsFields,
nonStepChildrenCount, childrenCount] = this.getChildrenInfo(this.state.step);
+ const [hasStepsField, stepsChildrenCount, hasNonStepsFields,
nonStepChildrenCount, childrenCount] = this.getChildrenInfo(this.props.step);
if (this.isHorizontal() && stepsChildrenCount > 1) return true;
else if (hasStepsField && stepsChildrenCount > 0 && hasNonStepsFields
&& nonStepChildrenCount > 0) return true;
else if (!hasStepsField && hasNonStepsFields && childrenCount > 1)
return true;
@@ -179,13 +179,17 @@ export class DslElement extends React.Component<Props,
State> {
const headerIcon: any =
Array.from(header.childNodes.values()).filter((n: any) =>
n.classList.contains("header-icon"))[0];
const headerRect = headerIcon.getBoundingClientRect();
const rect = el.getBoundingClientRect();
- EventBus.sendPosition("add", this.state.step,
this.props.parent, rect, headerRect, this.props.position, this.props.inSteps,
isSelected);
+ if (this.props.step.show){
+ EventBus.sendPosition("add", this.props.step,
this.props.parent, rect, headerRect, this.props.position, this.props.inSteps,
isSelected);
+ } else {
+ EventBus.sendPosition("delete", this.props.step,
this.props.parent, new DOMRect(), new DOMRect(), 0);
+ }
}
}
}
getHeader = () => {
- const step: CamelElement = this.state.step;
+ const step: CamelElement = this.props.step;
const availableModels =
CamelUi.getSelectorModelsForParent(step.dslName, false);
const showAddButton = !['CatchDefinition',
'RouteDefinition'].includes(step.dslName) && availableModels.length > 0;
const showInsertButton = !['FromDefinition', 'RouteDefinition',
'CatchDefinition', 'FinallyDefinition', 'ChoiceDefinition', 'WhenDefinition',
'OtherwiseDefinition'].includes(step.dslName);
@@ -193,7 +197,7 @@ export class DslElement extends React.Component<Props,
State> {
const headerClasses = this.isSelected() ? headerClass + " selected" :
headerClass;
return (
<div className={headerClasses} style={this.getHeaderStyle()}
data-tour={step.dslName}>
- {this.state.step.dslName !== 'RouteDefinition' &&
+ {this.props.step.dslName !== 'RouteDefinition' &&
<div ref={el => this.sendPosition(el, this.isSelected())}
data-tour={step.dslName + "-icon"}
className={"header-icon"}
@@ -214,7 +218,7 @@ export class DslElement extends React.Component<Props,
State> {
getHeaderTextWithTooltip = (step: CamelElement) => {
const checkRequired = CamelUtil.checkRequired(step);
- const title = (step as any).description ? (step as any).description :
CamelUi.getElementTitle(this.state.step);
+ const title = (step as any).description ? (step as any).description :
CamelUi.getElementTitle(this.props.step);
let className = this.hasWideChildrenElement() ? "text text-right" :
"text text-bottom";
if (!checkRequired[0]) className = className + " header-text-required";
if (checkRequired[0]) return <Text className={className}>{title}</Text>
@@ -236,8 +240,8 @@ export class DslElement extends React.Component<Props,
State> {
}
getHeaderTooltip = (): string | undefined => {
- if (CamelUi.isShowExpressionTooltip(this.state.step)) return
CamelUi.getExpressionTooltip(this.state.step);
- if (CamelUi.isShowUriTooltip(this.state.step)) return
CamelUi.getUriTooltip(this.state.step);
+ if (CamelUi.isShowExpressionTooltip(this.props.step)) return
CamelUi.getExpressionTooltip(this.props.step);
+ if (CamelUi.isShowUriTooltip(this.props.step)) return
CamelUi.getUriTooltip(this.props.step);
return undefined;
}
@@ -248,6 +252,7 @@ export class DslElement extends React.Component<Props,
State> {
}
return this.getHeader();
}
+
getChildrenStyle = () => {
const style: CSSProperties = {
display: "flex",
@@ -257,7 +262,7 @@ export class DslElement extends React.Component<Props,
State> {
}
getChildrenElementsStyle = (child: ChildElement, notOnlySteps: boolean) =>
{
- const step = this.state.step;
+ const step = this.props.step;
const isBorder = child.name === 'steps' &&
this.hasBorderOverSteps(step);
const style: CSSProperties = {
borderStyle: isBorder ? "dotted" : "none",
@@ -271,8 +276,8 @@ export class DslElement extends React.Component<Props,
State> {
}
getChildElements = () => {
- const step: CamelElement = this.state.step;
- let children =
CamelDefinitionApiExt.getElementChildrenDefinition(step.dslName);
+ const step: CamelElement = this.props.step;
+ let children: ChildElement[] =
CamelDefinitionApiExt.getElementChildrenDefinition(step.dslName);
const notOnlySteps = children.filter(c => c.name === 'steps').length
=== 1
&& children.filter(c => c.multiple && c.name !== 'steps').length >
0;
@@ -293,7 +298,7 @@ export class DslElement extends React.Component<Props,
State> {
}
getChildDslElements = (child: ChildElement, index: number, notOnlySteps:
boolean) => {
- const step = this.state.step;
+ const step = this.props.step;
const children: CamelElement[] =
CamelDefinitionApiExt.getElementChildren(step, child);
if (children.length > 0) {
return (
@@ -301,6 +306,7 @@ export class DslElement extends React.Component<Props,
State> {
{children.map((element, index) => (
<div key={step.uuid + child.className + index}>
<DslElement
+ integration={this.props.integration}
openSelector={this.props.openSelector}
deleteElement={this.props.deleteElement}
selectElement={this.props.selectElement}
@@ -326,12 +332,15 @@ export class DslElement extends React.Component<Props,
State> {
}
getAddStepButton() {
- return (
+ const {integration, step, showTour, selectedUuid} = this.props;
+ const hideAddButton = step.dslName === 'StepDefinition' &&
!CamelDisplayUtil.isStepDefinitionExpanded(integration, step.uuid,
selectedUuid);
+ if (hideAddButton) return (<></>)
+ else return (
<Tooltip position={"bottom"}
- content={<div>{"Add step to " +
CamelUi.getTitle(this.state.step)}</div>}>
+ content={<div>{"Add step to " +
CamelUi.getTitle(step)}</div>}>
<button data-tour="add-step"
type="button" aria-label="Add" onClick={e =>
this.openSelector(e)}
- style={{visibility: this.props.showTour ? "visible" :
"initial"}}
+ style={{visibility: showTour ? "visible" : "initial"}}
className={this.isAddStepButtonLeft() ? "add-button
add-button-left" : "add-button add-button-bottom"}>
<AddIcon noVerticalAlign/>
</button>
@@ -341,7 +350,7 @@ export class DslElement extends React.Component<Props,
State> {
getAddElementButton() {
return (
- <Tooltip position={"bottom"} content={<div>{"Add DSL element to "
+ CamelUi.getTitle(this.state.step)}</div>}>
+ <Tooltip position={"bottom"} content={<div>{"Add DSL element to "
+ CamelUi.getTitle(this.props.step)}</div>}>
<button
data-tour="add-element"
type="button"
@@ -372,11 +381,13 @@ export class DslElement extends React.Component<Props,
State> {
}
render() {
- const element: CamelElement = this.state.step;
+ const element: CamelElement = this.props.step;
+ const className = "step-element" + (this.isSelected() ? "
step-element-selected" : "")
+ + (!this.props.step.show ? " hidden-step" : "");
return (
<div key={"root" + element.uuid}
data-tour={this.props.parent ? "" : "route-created"}
- className={this.isSelected() ? "step-element
step-element-selected" : "step-element"}
+ className={className}
ref={el => this.sendPosition(el, this.isSelected())}
style={{
borderStyle: this.hasBorder() ? "dotted" : "none",
diff --git a/karavan-designer/src/designer/route/RouteDesigner.tsx
b/karavan-designer/src/designer/route/RouteDesigner.tsx
index 51fa188..af370f7 100644
--- a/karavan-designer/src/designer/route/RouteDesigner.tsx
+++ b/karavan-designer/src/designer/route/RouteDesigner.tsx
@@ -39,6 +39,7 @@ import {EventBus, TourEvent} from "../utils/EventBus";
import {CamelUi, RouteToCreate} from "../utils/CamelUi";
import {findDOMNode} from "react-dom";
import {Subscription} from "rxjs";
+import {CamelDisplayUtil} from "karavan-core/lib/api/CamelDisplayUtil";
interface Props {
onSave?: (integration: Integration, propertyOnly: boolean) => void
@@ -74,7 +75,7 @@ interface State {
export class RouteDesigner extends React.Component<Props, State> {
public state: State = {
- integration: this.props.integration,
+ integration:
CamelDisplayUtil.setIntegrationVisibility(this.props.integration, undefined),
showSelector: false,
showDeleteConfirmation: false,
deleteMessage: '',
@@ -154,13 +155,6 @@ export class RouteDesigner extends React.Component<Props,
State> {
this.setState({clipboardStep: step, key: Math.random().toString()});
}
- unselectElement = (evt: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
- if ((evt.target as any).dataset.click === 'FLOWS') {
- evt.stopPropagation()
- this.setState({selectedStep: undefined, selectedUuid: '',
showSelector: false, selectedPosition: undefined})
- }
- };
-
onPropertyUpdate = (element: CamelElement, newRoute?: RouteToCreate) => {
if (newRoute) {
let i =
CamelDefinitionApiExt.updateIntegrationRouteElement(this.state.integration,
element);
@@ -226,7 +220,16 @@ export class RouteDesigner extends React.Component<Props,
State> {
}
selectElement = (element: CamelElement) => {
- this.setState({selectedStep: element, selectedUuid: element.uuid,
showSelector: false})
+ const i =
CamelDisplayUtil.setIntegrationVisibility(this.state.integration, element.uuid);
+ this.setState({integration: i, selectedStep: element, selectedUuid:
element.uuid, showSelector: false})
+ }
+
+ unselectElement = (evt: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
+ if ((evt.target as any).dataset.click === 'FLOWS') {
+ evt.stopPropagation()
+ const i =
CamelDisplayUtil.setIntegrationVisibility(this.state.integration, undefined);
+ this.setState({integration: i, selectedStep: undefined,
selectedUuid: '', showSelector: false, selectedPosition: undefined})
+ }
}
openSelector = (parentId: string | undefined, parentDsl: string |
undefined, showSteps: boolean = true, position?: number | undefined,
selectorTabIndex?: string | number) => {
@@ -368,6 +371,7 @@ export class RouteDesigner extends React.Component<Props,
State> {
ref={el => this.onResizePage(el)}>
{routes?.map((route: any, index: number) => (
<DslElement key={route.uuid + this.state.key}
+ integration={this.state.integration}
openSelector={this.openSelector}
deleteElement={this.showDeleteConfirmation}
selectElement={this.selectElement}
diff --git a/karavan-designer/src/designer/utils/CamelUi.tsx
b/karavan-designer/src/designer/utils/CamelUi.tsx
index 1a5d5aa..785e831 100644
--- a/karavan-designer/src/designer/utils/CamelUi.tsx
+++ b/karavan-designer/src/designer/utils/CamelUi.tsx
@@ -54,6 +54,7 @@ const StepElements: string[] = [
"SetPropertyDefinition",
"SortDefinition",
"SplitDefinition",
+ "StepDefinition",
"ThreadsDefinition",
"ThrottleDefinition",
"ThrowExceptionDefinition",
@@ -418,6 +419,8 @@ export class CamelUi {
return "data:image/svg+xml,%3Csvg version='1.1' id='icon'
xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'
x='0px' y='0px' width='32px' height='32px' viewBox='0 0 32 32'
style='enable-background:new 0 0 32 32;' xml:space='preserve'%3E%3Cstyle
type='text/css'%3E .st0%7Bfill:none;%7D
.st1%7Bopacity:0;fill-opacity:0;%7D%0A%3C/style%3E%3Crect
id='_Transparent_Rectangle_' class='st0' width='32' height='32'/%3E%3Cpath
d='M16,2C8.3,2,2,8.3,2,16s6.3,1 [...]
case "OnExceptionDefinition":
return "data:image/svg+xml,%3Csvg version='1.1' id='icon'
xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'
x='0px' y='0px' width='32px' height='32px' viewBox='0 0 32 32'
style='enable-background:new 0 0 32 32;' xml:space='preserve'%3E%3Cstyle
type='text/css'%3E
.st0%7Bfill:none;%7D%0A%3C/style%3E%3Ctitle%3Echeckmark%3C/title%3E%3Cpath
d='M16,2C8.2,2,2,8.2,2,16s6.2,14,14,14s14-6.2,14-14S23.8,2,16,2z
M16,28C9.4,28,4,22.6,4,16S9.4,4,16,4s12,5.4,1 [...]
+ case "StepDefinition":
+ return "data:image/svg+xml,%3Csvg
xmlns='http://www.w3.org/2000/svg' width='32px' height='32px' viewBox='0 0 32
32'
id='icon'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:none;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3Ecollapse-all%3C/title%3E%3Cpath
d='M30,15H28V7H13V5H28a2.0023,2.0023,0,0,1,2,2Z'/%3E%3Cpath
d='M25,20H23V12H8V10H23a2.0023,2.0023,0,0,1,2,2Z'/%3E%3Cpath
d='M18,27H4a2.0023,2.0023,0,0,1-2-2V17a2.0023,2.0023,0,0,1,2-2H18a2.0023,2.0023,0,0,1,2,2v8A2.0023,2.0023,0,0,1,18,27Z
[...]
default:
return camelIcon;
}
diff --git
a/karavan-generator/src/main/java/org/apache/camel/karavan/generator/AbstractGenerator.java
b/karavan-generator/src/main/java/org/apache/camel/karavan/generator/AbstractGenerator.java
index 37a855a..3340d3c 100644
---
a/karavan-generator/src/main/java/org/apache/camel/karavan/generator/AbstractGenerator.java
+++
b/karavan-generator/src/main/java/org/apache/camel/karavan/generator/AbstractGenerator.java
@@ -56,17 +56,6 @@ public class AbstractGenerator {
}
}
- protected String getTraitsYaml() {
- try {
- InputStream inputStream =
TraitDefinitionGenerator.class.getResourceAsStream("/traits.yaml");
- String data = new BufferedReader(new
InputStreamReader(inputStream))
-
.lines().collect(Collectors.joining(System.getProperty("line.separator")));
- return data;
- } catch (Exception e) {
- return null;
- }
- }
-
protected String readFileText(String template) {
Buffer templateBuffer = vertx.fileSystem().readFileBlocking(template);
return templateBuffer.toString();
diff --git
a/karavan-generator/src/main/java/org/apache/camel/karavan/generator/KaravanGenerator.java
b/karavan-generator/src/main/java/org/apache/camel/karavan/generator/KaravanGenerator.java
index f12af45..6606d56 100644
---
a/karavan-generator/src/main/java/org/apache/camel/karavan/generator/KaravanGenerator.java
+++
b/karavan-generator/src/main/java/org/apache/camel/karavan/generator/KaravanGenerator.java
@@ -16,8 +16,6 @@
*/
package org.apache.camel.karavan.generator;
-import org.apache.camel.model.RouteDefinition;
-
public final class KaravanGenerator {
public static void main(String[] args) throws Exception {
@@ -27,7 +25,6 @@ public final class KaravanGenerator {
CamelMetadataGenerator.generate();
KameletGenerator.generate();
CamelComponentsGenerator.generate();
- TraitDefinitionGenerator.generate();
System.exit(0);
}
diff --git
a/karavan-generator/src/main/java/org/apache/camel/karavan/generator/TraitDefinitionGenerator.java
b/karavan-generator/src/main/java/org/apache/camel/karavan/generator/TraitDefinitionGenerator.java
deleted file mode 100644
index a9e0c6a..0000000
---
a/karavan-generator/src/main/java/org/apache/camel/karavan/generator/TraitDefinitionGenerator.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.karavan.generator;
-
-import org.yaml.snakeyaml.Yaml;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public final class TraitDefinitionGenerator extends AbstractGenerator {
-
- final static String modelHeader =
"karavan-generator/src/main/resources/TraitDefinition.header.ts";
- final static String targetModel =
"karavan-core/src/core/model/TraitDefinition.ts";
-
- public static void main(String[] args) throws Exception {
- TraitDefinitionGenerator.generate();
- System.exit(0);
- }
-
- public static void generate() throws Exception {
- TraitDefinitionGenerator g = new TraitDefinitionGenerator();
- g.createTraitDefinitions();
- }
-
- private void createTraitDefinitions() throws Exception {
- StringBuilder camelModel = new StringBuilder();
- camelModel.append(readFileText(modelHeader));
-
- camelModel.append("export class Trait extends CamelElement {\n");
- getTraits().forEach(trait -> {
- camelModel.append(String.format(" %s?: %s;\n",
getFieldName(trait.name), getClassName(trait.name)));
- });
- camelModel.append(" public constructor(init?: Partial<Trait>) {\n" +
- " super('Trait')\n" +
- " Object.assign(this, init)\n" +
- " }\n" +
- "}\n");
-
- // Generate Trait classes
- getTraits().forEach(trait -> {
- String className = getClassName(trait.name);
- camelModel.append(String.format("export class %s extends
CamelElement {\n", className));
- trait.properties.forEach(p -> {
- String name = getFieldName(p.name);
- String type = getPropertyType(p.type);
- camelModel.append(String.format(" %s?: %s;\n", name, type));
- });
- camelModel.append(String.format(" public constructor(init?:
Partial<%1$s>) {\n" +
- " super('%1$s')\n" +
- " Object.assign(this, init)\n" +
- " }\n" +
- "}\n\n", className));
- });
-
- // Generate readTrait
- camelModel.append("export class TraitApi {\n\n" +
- " static traitsFromYaml(yaml: any) {\n" +
- " const traits: Trait = new Trait();\n" +
- " Object.keys(yaml).forEach(key => {\n");
- getTraits().forEach(trait -> {
- String className = getClassName(trait.name);
- String fieldName = getFieldName(trait.name);
- String key = trait.name.equals("3scale") ? "3scale" : fieldName;
- String yamlKey = trait.name.equals("3scale") ? "[\"3scale\"]" :
"." + fieldName;
- camelModel.append(String.format(" if (key === '%1$s')
traits.%2$s = new %3$s(yaml%4$s.configuration);\n", key, fieldName, className,
yamlKey));
- });
- camelModel.append(" });\n" +
- " return traits;\n" +
- " }\n\n" +
- " static cloneTrait(t: Trait) {\n" +
- " const clone = JSON.parse(JSON.stringify(t));\n" +
- " const traits: Trait = new Trait();\n" +
- " Object.keys(clone).forEach(key => {");
- getTraits().forEach(trait -> {
- String className = getClassName(trait.name);
- String fieldName = getFieldName(trait.name);
- camelModel.append(String.format(" if (key === '%1$s')
traits.%1$s = new %2$s(clone.%1$s);\n", fieldName, className));
- });
- camelModel.append(" });\n" +
- " return traits;\n" +
- " }\n" +
- "}\n\n");
-
- // Generate Metadata
- camelModel.append("export const CamelTraitMetadata: TraitMeta[] = [");
- getTraits().forEach(trait -> {
-
- camelModel.append(String.format(" new TraitMeta(\"%s\", %s,
\"%s\", \"%s\", [\n", trait.name, trait.platform, trait.profiles,
trait.description.replace("\"", "\\\"")));
- camelModel.append(String.format(" ]),\n"));
- });
- camelModel.append("] \n\n");
-
- writeFileText(targetModel, camelModel.toString());
- }
-
- String getFieldName(String name) {
- name = name.equals("3scale") ? "ThreeScale" : name; // Exception for
3scaleTrait
- return deCapitalize(camelize(name, "-"));
- }
-
- String getClassName(String name) {
- name = name.equals("3scale") ? "ThreeScale" : name; // Exception for
3scaleTrait
- return capitalize(camelize(name, "-")) + "Trait";
- }
-
- String getPropertyType(String type) {
- switch (type) {
- case "bool":
- return "boolean";
- case "[]string":
- return "string[]";
- case "int64":
- case "int32":
- return "number";
- default:
- return "string";
- }
- }
-
- List<Trait> getTraits() {
- List<Trait> result = new ArrayList<>();
- Yaml yaml = new Yaml();
- String text = getTraitsYaml();
- HashMap<String, List> fromYaml = yaml.load(text);
- List<HashMap<String, Object>> traits = fromYaml.get("traits");
- traits.forEach((t) -> {
- String name = t.get("name").toString();
- boolean platform = Boolean.parseBoolean(t.get("name").toString());
- String profiles = t.get("profiles").toString().replace("[",
"").replace("]", "");
- String description = t.get("description").toString();
- List<HashMap<String, String>> properties = (List)
t.get("properties");
- Trait trait = new Trait(name, platform, profiles, description,
- properties.stream().map(m -> new
TraitProperty(m.get("name"), m.get("type"),
m.get("description"))).collect(Collectors.toList()));
- result.add(trait);
- });
- return result;
- }
-
- private class Trait {
- String name;
- boolean platform;
- String profiles;
- String description;
- List<TraitProperty> properties;
-
- public Trait(String name, boolean platform, String profiles, String
description, List<TraitProperty> properties) {
- this.name = name;
- this.platform = platform;
- this.profiles = profiles;
- this.description = description;
- this.properties = properties;
- }
- }
-
-
- private class TraitProperty {
- String name;
- String type;
- String description;
-
-
- public TraitProperty(String name, String type, String description) {
- this.name = name;
- this.type = type;
- this.description = description;
- }
- }
-}
diff --git a/karavan-generator/src/main/resources/traits.yaml
b/karavan-generator/src/main/resources/traits.yaml
deleted file mode 100644
index df8b1e1..0000000
--- a/karavan-generator/src/main/resources/traits.yaml
+++ /dev/null
@@ -1,1221 +0,0 @@
-traits:
- - name: affinity
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: Allows constraining which nodes the integration pod(s) are
eligible
- to be scheduled on, based on labels on the node, or with inter-pod
affinity and
- anti-affinity, based on labels on pods that are already running on the
nodes.
- It's disabled by default.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: pod-affinity
- type: bool
- description: Always co-locates multiple replicas of the integration in
the same
- node (default *false*).
- - name: pod-anti-affinity
- type: bool
- description: Never co-locates multiple replicas of the integration in
the same
- node (default *false*).
- - name: node-affinity-labels
- type: '[]string'
- description: Defines a set of nodes the integration pod(s) are
eligible to be
- scheduled on, based on labels on the node.
- - name: pod-affinity-labels
- type: '[]string'
- description: Defines a set of pods (namely those matching the label
selector,
- relative to the given namespace) that theintegration pod(s) should
be co-located
- with.
- - name: pod-anti-affinity-labels
- type: '[]string'
- description: Defines a set of pods (namely those matching the label
selector,
- relative to the given namespace) that theintegration pod(s) should
not be co-located
- with.
- - name: builder
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The builder trait is internally used to determine the best
strategy
- to build and configure IntegrationKits.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: verbose
- type: bool
- description: Enable verbose logging on build components that support
it (e.g.
- Kaniko build pod).
- - name: properties
- type: '[]string'
- description: A list of properties to be provided to the build task
- - name: camel
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The Camel trait can be used to configure versions of Apache
Camel K
- runtime and related libraries, it cannot be disabled.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: runtime-version
- type: string
- description: The camel-k-runtime version to use for the integration.
It overrides
- the default version set in the Integration Platform.
- - name: properties
- type: '[]string'
- description: A list of properties to be provided to the Integration
runtime
- - name: container
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The Container trait can be used to configure properties of
the container
- where the integration will run. It also provides configuration for
Services associated
- to the container.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: auto
- type: bool
- description: ""
- - name: request-cpu
- type: string
- description: The minimum amount of CPU required.
- - name: request-memory
- type: string
- description: The minimum amount of memory required.
- - name: limit-cpu
- type: string
- description: The maximum amount of CPU required.
- - name: limit-memory
- type: string
- description: The maximum amount of memory required.
- - name: expose
- type: bool
- description: Can be used to enable/disable exposure via kubernetes
Service.
- - name: port
- type: int
- description: To configure a different port exposed by the container
(default `8080`).
- - name: port-name
- type: string
- description: To configure a different port name for the port exposed
by the container.
- It defaults to `http` only when the `expose` parameter is true.
- - name: service-port
- type: int
- description: To configure under which service port the container port
is to be
- exposed (default `80`).
- - name: service-port-name
- type: string
- description: To configure under which service port name the container
port is
- to be exposed (default `http`).
- - name: name
- type: string
- description: The main container name. It's named `integration` by
default.
- - name: image
- type: string
- description: The main container image
- - name: image-pull-policy
- type: PullPolicy
- description: 'The pull policy: Always|Never|IfNotPresent'
- - name: probes-enabled
- type: bool
- description: 'DeprecatedProbesEnabled enable/disable probes on the
container (default
- `false`)Deprecated: replaced by the health trait.'
- - name: liveness-scheme
- type: string
- description: 'Scheme to use when connecting. Defaults to HTTP. Applies
to the
- liveness probe.Deprecated: replaced by the health trait.'
- - name: liveness-initial-delay
- type: int32
- description: 'Number of seconds after the container has started before
liveness
- probes are initiated.Deprecated: replaced by the health trait.'
- - name: liveness-timeout
- type: int32
- description: 'Number of seconds after which the probe times out.
Applies to the
- liveness probe.Deprecated: replaced by the health trait.'
- - name: liveness-period
- type: int32
- description: 'How often to perform the probe. Applies to the liveness
probe.Deprecated:
- replaced by the health trait.'
- - name: liveness-success-threshold
- type: int32
- description: 'Minimum consecutive successes for the probe to be
considered successful
- after having failed.Applies to the liveness probe.Deprecated: replaced
by the
- health trait.'
- - name: liveness-failure-threshold
- type: int32
- description: 'Minimum consecutive failures for the probe to be
considered failed
- after having succeeded.Applies to the liveness probe.Deprecated:
replaced by
- the health trait.'
- - name: readiness-scheme
- type: string
- description: 'Scheme to use when connecting. Defaults to HTTP. Applies
to the
- readiness probe.Deprecated: replaced by the health trait.'
- - name: readiness-initial-delay
- type: int32
- description: 'Number of seconds after the container has started before
readiness
- probes are initiated.Deprecated: replaced by the health trait.'
- - name: readiness-timeout
- type: int32
- description: 'Number of seconds after which the probe times out.
Applies to the
- readiness probe.Deprecated: replaced by the health trait.'
- - name: readiness-period
- type: int32
- description: 'How often to perform the probe. Applies to the readiness
probe.Deprecated:
- replaced by the health trait.'
- - name: readiness-success-threshold
- type: int32
- description: 'Minimum consecutive successes for the probe to be
considered successful
- after having failed.Applies to the readiness probe.Deprecated: replaced
by the
- health trait.'
- - name: readiness-failure-threshold
- type: int32
- description: 'Minimum consecutive failures for the probe to be
considered failed
- after having succeeded.Applies to the readiness probe.Deprecated:
replaced by
- the health trait.'
- - name: cron
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: 'The Cron trait can be used to customize the behaviour of
periodic
- timer/cron based integrations. While normally an integration requires a
pod to
- be always up and running, some periodic tasks, such as batch jobs, require
to
- be activated at specific hours of the day or with a periodic delay of
minutes.
- For such tasks, the cron trait can materialize the integration as a
Kubernetes
- CronJob instead of a standard deployment, in order to save resources when
the
- integration does not need to be executed. Integrations that start from the
following
- components are evaluated by the cron trait: `timer`, `cron`, `quartz`. The
rules
- for using a Kubernetes CronJob are the following: - `timer`: when periods
can
- be written as cron expressions. E.g. `timer:tick?period=60000`. - `cron`,
`quartz`:
- when the cron expression does not contain seconds (or the "seconds" part
is set
- to 0). E.g. `cron:tab?schedule=0/2${plus}*{plus}*{plus}*{plus}?` or
`quartz:trigger?cron=0{plus}0/2{plus}*{plus}*{plus}*{plus}?`.'
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: schedule
- type: string
- description: The CronJob schedule for the whole integration. If
multiple routes
- are declared, they must have the same schedule for thismechanism to
work correctly.
- - name: components
- type: string
- description: 'A comma separated list of the Camel components that need
to be customized
- in order for them to work when the schedule is triggered externally by
Kubernetes.A
- specific customizer is activated for each specified component. E.g. for
the
- `timer` component, the `cron-timer` customizer isactivated (it''s
present in
- the `org.apache.camel.k:camel-k-cron` library).Supported components are
currently:
- `cron`, `timer` and `quartz`.'
- - name: fallback
- type: bool
- description: Use the default Camel implementation of the `cron`
endpoint (`quartz`)
- instead of trying to materialize the integrationas Kubernetes
CronJob.
- - name: concurrency-policy
- type: string
- description: 'Specifies how to treat concurrent executions of a
Job.Valid values
- are:- "Allow": allows CronJobs to run concurrently;- "Forbid" (default):
forbids
- concurrent runs, skipping next run if previous run hasn''t finished
yet;- "Replace":
- cancels currently running job and replaces it with a new one'
- - name: auto
- type: bool
- description: Automatically deploy the integration as CronJob when all
routes areeither
- starting from a periodic consumer (only `cron`, `timer` and `quartz`
are supported)
- or a passive consumer (e.g. `direct` is a passive consumer).It's
required that
- all periodic consumers have the same period and it can be expressed
as cron
- schedule (e.g. `1m` can be expressed as `0/1 * * * *`,while `35m` or
`50s` cannot).
- - name: starting-deadline-seconds
- type: int64
- description: Optional deadline in seconds for starting the job if it
misses scheduledtime
- for any reason. Missed jobs executions will be counted as failed
ones.
- - name: active-deadline-seconds
- type: int64
- description: Specifies the duration in seconds, relative to the start
time, that
- the jobmay be continuously active before it is considered to be
failed.It defaults
- to 60s.
- - name: backoff-limit
- type: int32
- description: Specifies the number of retries before marking the job
failed.It
- defaults to 2.
- - name: dependencies
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The Dependencies trait is internally used to automatically
add runtime
- dependencies based on the integration that the user wants to run.
- properties: []
- - name: deployer
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The deployer trait is responsible for deploying the resources
owned
- by the integration, and can be used to explicitly select the underlying
controller
- that will manage the integration pods.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: kind
- type: string
- description: Allows to explicitly select the desired deployment kind
between `deployment`,
- `cron-job` or `knative-service` when creating the resources for
running the
- integration.
- - name: deployment
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The Deployment trait is responsible for generating the
Kubernetes deployment
- that will make sure the integration will run in the cluster.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: progress-deadline-seconds
- type: int32
- description: The maximum time in seconds for the deployment to make
progress before
- itis considered to be failed. It defaults to 60s.
- - name: environment
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The environment trait is used internally to inject standard
environment
- variables in the integration container, such as `NAMESPACE`, `POD_NAME`
and others.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: container-meta
- type: bool
- description: Enables injection of `NAMESPACE` and `POD_NAME`
environment variables
- (default `true`)
- - name: http-proxy
- type: bool
- description: Propagates the `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY`
environment
- variables (default `true`)
- - name: vars
- type: '[]string'
- description: A list of environment variables to be added to the
integration container.The
- syntax is KEY=VALUE, e.g., `MY_VAR="my value"`.These take precedence
over the
- previously defined environment variables.
- - name: error-handler
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The error-handler is a platform trait used to inject Error
Handler
- source into the integration runtime.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: ref
- type: string
- description: The error handler ref name provided or found in
application properties
- - name: gc
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The GC Trait garbage-collects all resources that are no
longer necessary
- upon integration updates.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: discovery-cache
- type: github.com/apache/camel-k/pkg/trait.discoveryCacheType
- description: Discovery client cache to be used, either `disabled`,
`disk` or `memory`
- (default `memory`)
- - name: health
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The health trait is responsible for configuring the health
probes on
- the integration container. It's disabled by default.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: liveness-probe-enabled
- type: bool
- description: Configures the liveness probe for the integration
container (default
- `false`).
- - name: liveness-scheme
- type: string
- description: Scheme to use when connecting to the liveness probe
(default `HTTP`).
- - name: liveness-initial-delay
- type: int32
- description: Number of seconds after the container has started before
the liveness
- probe is initiated.
- - name: liveness-timeout
- type: int32
- description: Number of seconds after which the liveness probe times
out.
- - name: liveness-period
- type: int32
- description: How often to perform the liveness probe.
- - name: liveness-success-threshold
- type: int32
- description: Minimum consecutive successes for the liveness probe to
be considered
- successful after having failed.
- - name: liveness-failure-threshold
- type: int32
- description: Minimum consecutive failures for the liveness probe to be
considered
- failed after having succeeded.
- - name: readiness-probe-enabled
- type: bool
- description: Configures the readiness probe for the integration
container (default
- `true`).
- - name: readiness-scheme
- type: string
- description: Scheme to use when connecting to the readiness probe
(default `HTTP`).
- - name: readiness-initial-delay
- type: int32
- description: Number of seconds after the container has started before
the readiness
- probe is initiated.
- - name: readiness-timeout
- type: int32
- description: Number of seconds after which the readiness probe times
out.
- - name: readiness-period
- type: int32
- description: How often to perform the readiness probe.
- - name: readiness-success-threshold
- type: int32
- description: Minimum consecutive successes for the readiness probe to
be considered
- successful after having failed.
- - name: readiness-failure-threshold
- type: int32
- description: Minimum consecutive failures for the readiness probe to
be considered
- failed after having succeeded.
- - name: ingress
- platform: false
- profiles:
- - Kubernetes
- description: The Ingress trait can be used to expose the service
associated with
- the integration to the outside world with a Kubernetes Ingress. It's
enabled by
- default whenever a Service is added to the integration (through the
`service`
- trait).
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: host
- type: string
- description: '**Required**. To configure the host exposed by the
ingress.'
- - name: auto
- type: bool
- description: To automatically add an ingress whenever the integration
uses a HTTP
- endpoint consumer.
- - name: istio
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The Istio trait allows configuring properties related to the
Istio
- service mesh, such as sidecar injection and outbound IP ranges.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: allow
- type: string
- description: Configures a (comma-separated) list of CIDR subnets that
should not
- be intercepted by the Istio proxy
(`10.0.0.0/8,172.16.0.0/12,192.168.0.0/16`
- by default).
- - name: inject
- type: bool
- description: Forces the value for labels `sidecar.istio.io/inject`. By
default
- the label is set to `true` on deployment and not set on Knative
Service.
- - name: jolokia
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The Jolokia trait activates and configures the Jolokia Java
agent.
- See https://jolokia.org/reference/html/agents.html
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: ca-cert
- type: string
- description: The PEM encoded CA certification file path, used to
verify client
- certificates,applicable when `protocol` is `https` and
`use-ssl-client-authentication`
- is `true`(default
`/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt`
- for OpenShift).
- - name: client-principal
- type: '[]string'
- description: The principal(s) which must be given in a client
certificate to allow
- access to the Jolokia endpoint,applicable when `protocol` is `https`
and `use-ssl-client-authentication`
- is `true`(default `clientPrincipal=cn=system:master-proxy`,
`cn=hawtio-online.hawtio.svc`
- and `cn=fuse-console.fuse.svc` for OpenShift).
- - name: discovery-enabled
- type: bool
- description: Listen for multicast requests (default `false`)
- - name: extended-client-check
- type: bool
- description: Mandate the client certificate contains a client flag in
the extended
- key usage section,applicable when `protocol` is `https` and
`use-ssl-client-authentication`
- is `true`(default `true` for OpenShift).
- - name: host
- type: string
- description: The Host address to which the Jolokia agent should bind
to. If `"\*"`
- or `"0.0.0.0"` is given,the servers binds to every network interface
(default
- `"*"`).
- - name: password
- type: string
- description: The password used for authentication, applicable when the
`user`
- option is set.
- - name: port
- type: int
- description: The Jolokia endpoint port (default `8778`).
- - name: protocol
- type: string
- description: The protocol to use, either `http` or `https` (default
`https` for
- OpenShift)
- - name: user
- type: string
- description: The user to be used for authentication
- - name: use-ssl-client-authentication
- type: bool
- description: Whether client certificates should be used for
authentication (default
- `true` for OpenShift).
- - name: options
- type: '[]string'
- description: A list of additional Jolokia options as definedin
https://jolokia.org/reference/html/agents.html#agent-jvm-config[JVM
- agent configuration options]
- - name: jvm
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The JVM trait is used to configure the JVM that runs the
integration.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: debug
- type: bool
- description: Activates remote debugging, so that a debugger can be
attached to
- the JVM, e.g., using port-forwarding
- - name: debug-suspend
- type: bool
- description: Suspends the target JVM immediately before the main class
is loaded
- - name: print-command
- type: bool
- description: Prints the command used the start the JVM in the
container logs (default
- `true`)
- - name: debug-address
- type: string
- description: Transport address at which to listen for the newly
launched JVM (default
- `*:5005`)
- - name: options
- type: '[]string'
- description: A list of JVM options
- - name: classpath
- type: string
- description: Additional JVM classpath (use `Linux` classpath separator)
- - name: kamelets
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The kamelets trait is a platform trait used to inject
Kamelets into
- the integration runtime.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: auto
- type: bool
- description: Automatically inject all referenced Kamelets and their
default configuration
- (enabled by default)
- - name: list
- type: string
- description: Comma separated list of Kamelet names to load into the
current integration
- - name: keda
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The KEDA trait can be used for automatic integration with
KEDA autoscalers.
- The trait can be either manually configured using the `triggers` option
or automatically
- configured via markers in the Kamelets. For information on how to use
KEDA enabled
- Kamelets with the KEDA trait, refer to
xref:ROOT:kamelets/kamelets-user.adoc#kamelet-keda-user[the
- KEDA section in the Kamelets user guide]. If you want to create Kamelets
that
- contain KEDA metadata, refer to
xref:ROOT:kamelets/kamelets-dev.adoc#kamelet-keda-dev[the
- KEDA section in the Kamelets development guide]. The KEDA trait is
disabled by
- default.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: auto
- type: bool
- description: Enables automatic configuration of the trait. Allows the
trait to
- infer KEDA triggers from the Kamelets.
- - name: hack-controller-replicas
- type: bool
- description: Set the spec->replicas field on the top level controller
to an explicit
- value if missing, to allow KEDA to recognize it as a scalable
resource.
- - name: polling-interval
- type: int32
- description: Interval (seconds) to check each trigger on.
- - name: cooldown-period
- type: int32
- description: The wait period between the last active trigger reported
and scaling
- the resource back to 0.
- - name: idle-replica-count
- type: int32
- description: Enabling this property allows KEDA to scale the resource
down to
- the specified number of replicas.
- - name: min-replica-count
- type: int32
- description: Minimum number of replicas.
- - name: max-replica-count
- type: int32
- description: Maximum number of replicas.
- - name: triggers
- type: '[]github.com/apache/camel-k/addons/keda.kedaTrigger'
- description: Definition of triggers according to the KEDA format. Each
trigger
- must contain `type` field correspondingto the name of a KEDA
autoscaler and
- a key/value map named `metadata` containing specific trigger
options.An optional
- `authentication-secret` can be declared per trigger and the operator
will link
- each entry ofthe secret to a KEDA authentication parameter.
- - name: knative-service
- platform: false
- profiles:
- - Knative
- description: The Knative Service trait allows configuring options when
running the
- Integration as a Knative service, instead of a standard Kubernetes
Deployment.
- Running an Integration as a Knative Service enables auto-scaling (and
scaling-to-zero),
- but those features are only relevant when the Camel route(s) use(s) an
HTTP endpoint
- consumer.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: autoscaling-class
- type: string
- description: Configures the Knative autoscaling class property (e.g.
to set `hpa.autoscaling.knative.dev`
- or `kpa.autoscaling.knative.dev` autoscaling).Refer to the Knative
documentation
- for more information.
- - name: autoscaling-metric
- type: string
- description: Configures the Knative autoscaling metric property (e.g.
to set `concurrency`
- based or `cpu` based autoscaling).Refer to the Knative documentation
for more
- information.
- - name: autoscaling-target
- type: int
- description: Sets the allowed concurrency level or CPU percentage
(depending on
- the autoscaling metric) for each Pod.Refer to the Knative
documentation for
- more information.
- - name: min-scale
- type: int
- description: The minimum number of Pods that should be running at any
time for
- the integration. It's **zero** by default, meaning thatthe
integration is scaled
- down to zero when not used for a configured amount of time.Refer to
the Knative
- documentation for more information.
- - name: max-scale
- type: int
- description: An upper bound for the number of Pods that can be running
in parallel
- for the integration.Knative has its own cap value that depends on
the installation.Refer
- to the Knative documentation for more information.
- - name: rollout-duration
- type: string
- description: Enables to gradually shift traffic to the latest Revision
and sets
- the rollout duration.It's disabled by default and must be expressed
as a Golang
- `time.Duration` string representation,rounded to a second precision.
- - name: auto
- type: bool
- description: Automatically deploy the integration as Knative service
when all
- conditions hold:* Integration is using the Knative profile* All
routes are either
- starting from a HTTP based consumer or a passive consumer (e.g.
`direct` is
- a passive consumer)
- - name: knative
- platform: false
- profiles:
- - Knative
- description: The Knative trait automatically discovers addresses of
Knative resources
- and inject them into the running integration. The full Knative
configuration is
- injected in the CAMEL_KNATIVE_CONFIGURATION in JSON format. The Camel
Knative
- component will then use the full configuration to configure the routes.
The trait
- is enabled by default when the Knative profile is active.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: configuration
- type: string
- description: Can be used to inject a Knative complete configuration in
JSON format.
- - name: channel-sources
- type: '[]string'
- description: List of channels used as source of integration routes.Can
contain
- simple channel names or full Camel URIs.
- - name: channel-sinks
- type: '[]string'
- description: List of channels used as destination of integration
routes.Can contain
- simple channel names or full Camel URIs.
- - name: endpoint-sources
- type: '[]string'
- description: List of channels used as source of integration routes.
- - name: endpoint-sinks
- type: '[]string'
- description: List of endpoints used as destination of integration
routes.Can contain
- simple endpoint names or full Camel URIs.
- - name: event-sources
- type: '[]string'
- description: List of event types that the integration will be
subscribed to.Can
- contain simple event types or full Camel URIs (to use a specific
broker different
- from "default").
- - name: event-sinks
- type: '[]string'
- description: List of event types that the integration will produce.Can
contain
- simple event types or full Camel URIs (to use a specific broker).
- - name: filter-source-channels
- type: bool
- description: Enables filtering on events based on the header
"ce-knativehistory".
- Since this header has been removed in newer versions ofKnative,
filtering is
- disabled by default.
- - name: sink-binding
- type: bool
- description: Allows binding the integration to a sink via a Knative
SinkBinding
- resource.This can be used when the integration targets a single
sink.It's enabled
- by default when the integration targets a single sink(except when
the integration
- is owned by a Knative source).
- - name: auto
- type: bool
- description: Enable automatic discovery of all trait properties.
- - name: logging
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The Logging trait is used to configure Integration runtime
logging
- options (such as color and format). The logging backend is provided by
Quarkus,
- whose configuration is documented at https://quarkus.io/guides/logging.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: color
- type: bool
- description: Colorize the log output
- - name: format
- type: string
- description: Logs message format
- - name: level
- type: string
- description: Adjust the logging level (defaults to INFO)
- - name: json
- type: bool
- description: Output the logs in JSON
- - name: json-pretty-print
- type: bool
- description: Enable "pretty printing" of the JSON logs
- - name: master
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: 'The Master trait allows to configure the integration to
automatically
- leverage Kubernetes resources for doing leader election and starting
*master*
- routes only on certain instances. It''s activated automatically when using
the
- master endpoint in a route, e.g.
`from("master:lockname:telegram:bots")...`. NOTE:
- this trait adds special permissions to the integration service account in
order
- to read/write configmaps and read pods. It''s recommended to use a
different service
- account than "default" when running the integration.'
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: auto
- type: bool
- description: Enables automatic configuration of the trait.
- - name: include-delegate-dependencies
- type: bool
- description: When this flag is active, the operator analyzes the
source code to
- add dependencies required by delegate endpoints.E.g. when using
`master:lockname:timer`,
- then `camel:timer` is automatically added to the set of
dependencies.It's enabled
- by default.
- - name: resource-name
- type: string
- description: Name of the configmap that will be used to store the
lock. Defaults
- to "<integration-name>-lock".Name of the configmap/lease resource
that will
- be used to store the lock. Defaults to "<integration-name>-lock".
- - name: resource-type
- type: string
- description: Type of Kubernetes resource to use for locking
("ConfigMap" or "Lease").
- Defaults to "Lease".
- - name: label-key
- type: string
- description: Label that will be used to identify all pods contending
the lock.
- Defaults to "camel.apache.org/integration".
- - name: label-value
- type: string
- description: Label value that will be used to identify all pods
contending the
- lock. Defaults to the integration name.
- - name: mount
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The Mount trait can be used to configure volumes mounted on
the Integration
- Pods.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: configs
- type: '[]string'
- description: 'A list of configuration pointing to configmap/secret.The
configuration
- are expected to be UTF-8 resources as they are processed by runtime
Camel Context
- and tried to be parsed as property files.They are also made available on
the
- classpath in order to ease their usage directly from the Route.Syntax:
[configmap|secret]:name[key],
- where name represents the resource name and key optionally represents
the resource
- key to be filtered'
- - name: resources
- type: '[]string'
- description: 'A list of resources (text or binary content) pointing to
configmap/secret.The
- resources are expected to be any resource type (text or binary
content).The
- destination path can be either a default location or any path specified
by the
- user.Syntax: [configmap|secret]:name[/key][@path], where name represents
the
- resource name, key optionally represents the resource key to be filtered
and
- path represents the destination path'
- - name: volumes
- type: '[]string'
- description: 'A list of Persistent Volume Claims to be mounted.
Syntax: [pvcname:/container/path]'
- - name: openapi
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The OpenAPI DSL trait is internally used to allow creating
integrations
- from a OpenAPI specs.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: configmaps
- type: '[]string'
- description: The configmaps holding the spec of the OpenAPI
- - name: owner
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The Owner trait ensures that all created resources belong to
the integration
- being created and transfers annotations and labels on the integration
onto these
- owned resources.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: target-annotations
- type: '[]string'
- description: The set of annotations to be transferred
- - name: target-labels
- type: '[]string'
- description: The set of labels to be transferred
- - name: pdb
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The PDB trait allows to configure the PodDisruptionBudget
resource
- for the Integration pods.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: min-available
- type: string
- description: The number of pods for the Integration that must still be
available
- after an eviction.It can be either an absolute number or a
percentage.Only one
- of `min-available` and `max-unavailable` can be specified.
- - name: max-unavailable
- type: string
- description: The number of pods for the Integration that can be
unavailable after
- an eviction.It can be either an absolute number or a percentage
(default `1`
- if `min-available` is also not set).Only one of `max-unavailable`
and `min-available`
- can be specified.
- - name: platform
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The platform trait is a base trait that is used to assign an
integration
- platform to an integration. In case the platform is missing, the trait
is allowed
- to create a default platform. This feature is especially useful in
contexts where
- there's no need to provide a custom configuration for the platform (e.g.
on OpenShift
- the default settings work, since there's an embedded container image
registry).
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: create-default
- type: bool
- description: To create a default (empty) platform when the platform is
missing.
- - name: global
- type: bool
- description: Indicates if the platform should be created globally in
the case
- of global operator (default true).
- - name: auto
- type: bool
- description: To automatically detect from the environment if a default
platform
- can be created (it will be created on OpenShift only).
- - name: pod
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The pod trait allows the customization of the Integration
pods. It
- applies the `PodSpecTemplate` struct contained in the Integration
`.spec.podTemplate`
- field, into the Integration deployment Pods template, using strategic
merge patch.
- This can be used to customize the container where Camel routes execute,
by using
- the `integration` container name.
- properties: []
- - name: prometheus
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: 'The Prometheus trait configures a Prometheus-compatible
endpoint.
- It also creates a `PodMonitor` resource, so that the endpoint can be
scraped automatically,
- when using the Prometheus operator. The metrics are exposed using
MicroProfile
- Metrics. WARNING: The creation of the `PodMonitor` resource requires the
https://github.com/coreos/prometheus-operator[Prometheus
- Operator] custom resource definition to be installed. You can set
`pod-monitor`
- to `false` for the Prometheus trait to work without the Prometheus
Operator. The
- Prometheus trait is disabled by default.'
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: pod-monitor
- type: bool
- description: Whether a `PodMonitor` resource is created (default
`true`).
- - name: pod-monitor-labels
- type: '[]string'
- description: The `PodMonitor` resource labels, applicable when
`pod-monitor` is
- `true`.
- - name: pull-secret
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The Pull Secret trait sets a pull secret on the pod, to allow
Kubernetes
- to retrieve the container image from an external registry. The pull
secret can
- be specified manually or, in case you've configured authentication for
an external
- container registry on the `IntegrationPlatform`, the same secret is used
to pull
- images. It's enabled by default whenever you configure authentication
for an external
- container registry, so it assumes that external registries are private.
If your
- registry does not need authentication for pulling images, you can
disable this
- trait.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: secret-name
- type: string
- description: The pull secret name to set on the Pod. If left empty
this is automatically
- taken from the `IntegrationPlatform` registry configuration.
- - name: image-puller-delegation
- type: bool
- description: When using a global operator with a shared platform, this
enables
- delegation of the `system:image-puller` cluster role on the operator
namespace
- to the integration service account.
- - name: auto
- type: bool
- description: Automatically configures the platform registry secret on
the pod
- if it is of type `kubernetes.io/dockerconfigjson`.
- - name: quarkus
- platform: true
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: 'The Quarkus trait configures the Quarkus runtime. It''s
enabled by
- default. NOTE: Compiling to a native executable, i.e. when using
`package-type=native`,
- is only supported for kamelets, as well as YAML and XML integrations. It
also
- requires at least 4GiB of memory, so the Pod running the native build,
that is
- either the operator Pod, or the build Pod (depending on the build strategy
configured
- for the platform), must have enough memory available.'
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: package-type
- type: '[]github.com/apache/camel-k/pkg/trait.quarkusPackageType'
- description: The Quarkus package types, either `fast-jar` or `native`
(default
- `fast-jar`).In case both `fast-jar` and `native` are specified, two
`IntegrationKit`
- resources are created,with the `native` kit having precedence over
the `fast-jar`
- one once ready.The order influences the resolution of the current
kit for the
- integration.The kit corresponding to the first package type will be
assigned
- to theintegration in case no existing kit that matches the
integration exists.
- - name: route
- platform: false
- profiles:
- - OpenShift
- description: 'The Route trait can be used to configure the creation of
OpenShift
- routes for the integration. The certificate and key contents may be
sourced either
- from the local filesystem or in a Openshift `secret` object. The user may
use
- the parameters ending in `-secret` (example: `tls-certificate-secret`) to
reference
- a certificate stored in a `secret`. Parameters ending in `-secret` have
higher
- priorities and in case the same route parameter is set, for example:
`tls-key-secret`
- and `tls-key`, then `tls-key-secret` is used. The recommended approach to
set
- the key and certificates is to use `secrets` to store their contents and
use the
- following parameters to reference them: `tls-certificate-secret`,
`tls-key-secret`,
- `tls-ca-certificate-secret`, `tls-destination-ca-certificate-secret` See
the examples
- section at the end of this page to see the setup options.'
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: host
- type: string
- description: To configure the host exposed by the route.
- - name: tls-termination
- type: string
- description: The TLS termination type, like `edge`, `passthrough` or
`reencrypt`.Refer
- to the OpenShift route documentation for additional information.
- - name: tls-certificate
- type: string
- description: The TLS certificate contents.Refer to the OpenShift route
documentation
- for additional information.
- - name: tls-certificate-secret
- type: string
- description: The secret name and key reference to the TLS certificate.
The format
- is "secret-name[/key-name]", the value represents the secret name,
if there
- is only one key in the secret it will be read, otherwise you can set
a key name
- separated with a "/".Refer to the OpenShift route documentation for
additional
- information.
- - name: tls-key
- type: string
- description: The TLS certificate key contents.Refer to the OpenShift
route documentation
- for additional information.
- - name: tls-key-secret
- type: string
- description: The secret name and key reference to the TLS certificate
key. The
- format is "secret-name[/key-name]", the value represents the secret
name, if
- there is only one key in the secret it will be read, otherwise you
can set a
- key name separated with a "/".Refer to the OpenShift route
documentation for
- additional information.
- - name: tls-ca-certificate
- type: string
- description: The TLS CA certificate contents.Refer to the OpenShift
route documentation
- for additional information.
- - name: tls-ca-certificate-secret
- type: string
- description: The secret name and key reference to the TLS CA
certificate. The
- format is "secret-name[/key-name]", the value represents the secret
name, if
- there is only one key in the secret it will be read, otherwise you
can set a
- key name separated with a "/".Refer to the OpenShift route
documentation for
- additional information.
- - name: tls-destination-ca-certificate
- type: string
- description: The destination CA certificate provides the contents of
the ca certificate
- of the final destination. When using reencrypttermination this file
should
- be provided in order to have routers use it for health checks on the
secure
- connection.If this field is not specified, the router may provide
its own destination
- CA and perform hostname validation usingthe short service name
(service.namespace.svc),
- which allows infrastructure generated certificates to
automaticallyverify.Refer
- to the OpenShift route documentation for additional information.
- - name: tls-destination-ca-certificate-secret
- type: string
- description: The secret name and key reference to the destination CA
certificate.
- The format is "secret-name[/key-name]", the value represents the
secret name,
- if there is only one key in the secret it will be read, otherwise
you can set
- a key name separated with a "/".Refer to the OpenShift route
documentation for
- additional information.
- - name: tls-insecure-edge-termination-policy
- type: string
- description: To configure how to deal with insecure traffic, e.g.
`Allow`, `Disable`
- or `Redirect` traffic.Refer to the OpenShift route documentation for
additional
- information.
- - name: service-binding
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: 'The Service Binding trait allows users to connect to
Services in Kubernetes:
- https://github.com/k8s-service-bindings/spec#service-binding As the
specification
- is still evolving this is subject to change'
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: services
- type: '[]string'
- description: List of Services in the form
[[apigroup/]version:]kind:[namespace/]name
- - name: service
- platform: false
- profiles:
- - Kubernetes
- - OpenShift
- description: The Service trait exposes the integration with a Service
resource so
- that it can be accessed by other applications (or integrations) in the
same namespace.
- It's enabled by default if the integration depends on a Camel component
that can
- expose a HTTP endpoint.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: auto
- type: bool
- description: To automatically detect from the code if a Service needs
to be created.
- - name: node-port
- type: bool
- description: Enable Service to be exposed as NodePort
- - name: 3scale
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The 3scale trait can be used to automatically create
annotations that
- allow 3scale to discover the generated service and make it available for
API management.
- The 3scale trait is disabled by default.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: auto
- type: bool
- description: Enables automatic configuration of the trait.
- - name: scheme
- type: string
- description: The scheme to use to contact the service (default `http`)
- - name: path
- type: string
- description: The path where the API is published (default `/`)
- - name: port
- type: int
- description: The port where the service is exposed (default `80`)
- - name: description-path
- type: string
- description: The path where the Open-API specification is published
(default `/openapi.json`)
- - name: toleration
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: 'This trait sets Tolerations over Integration pods.
Tolerations allow
- (but do not require) the pods to schedule onto nodes with matching taints.
See
-
https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/
- for more details. The toleration should be expressed in a similar manner
that
- of taints, i.e., `Key[=Value]:Effect[:Seconds]`, where values in square
brackets
- are optional. For examples: - `node-role.kubernetes.io/master:NoSchedule`
- `node.kubernetes.io/network-unavailable:NoExecute:3000`
- - `disktype=ssd:PreferNoSchedule` It''s disabled by default.'
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: taints
- type: '[]string'
- description: The list of taints to tolerate, in the form
`Key[=Value]:Effect[:Seconds]`
- - name: tracing
- platform: false
- profiles:
- - Kubernetes
- - Knative
- - OpenShift
- description: The Tracing trait can be used to automatically publish
tracing information
- to an OpenTracing compatible collector. The trait is able to
automatically discover
- the tracing endpoint available in the namespace (supports **Jaeger**).
The Tracing
- trait is disabled by default.
- properties:
- - name: enabled
- type: bool
- description: Can be used to enable or disable a trait. All traits
share this common
- property.
- - name: auto
- type: bool
- description: Enables automatic configuration of the trait, including
automatic
- discovery of the tracing endpoint.
- - name: service-name
- type: string
- description: The name of the service that publishes tracing data
(defaults to
- the integration name)
- - name: endpoint
- type: string
- description: The target endpoint of the OpenTracing service
(automatically discovered
- by default)
- - name: sampler-type
- type: string
- description: The sampler type (default "const")
- - name: sampler-param
- type: string
- description: The sampler specific param (default "1")
\ No newline at end of file