Skip to content

Commit

Permalink
[Camel-K] Remove camel-k
Browse files Browse the repository at this point in the history
  • Loading branch information
avano committed Jan 6, 2025
1 parent 274a220 commit 5c27a6d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 35 deletions.
19 changes: 8 additions & 11 deletions fuse-products/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ for creating integrations on all products (so there are methods related to every
- it is possible to instantiate it via [IntegrationBuilder](src/main/java/software/tnb/product/integration/builder/IntegrationBuilder.java) class
- AbstractGitIntegrationBuilder
- AbstractMavenGitIntegrationBuilder
- [CamelKIntegrationBuilder](src/main/java/software/tnb/product/ck/integration/builder/CamelKIntegrationBuilder.java)
that extends `AbstractIntegrationBuilder` and adds methods related to camel-k only
- [SpringBootIntegrationBuilder](src/main/java/software/tnb/product/csb/integration/builder/SpringBootIntegrationBuilder.java)
that extends `AbstractIntegrationBuilder` and adds methods related to camel on springboot only

Expand All @@ -37,14 +35,13 @@ Again, there are multiple customizers you can use:
- [ProductsCustomizer](src/main/java/software/tnb/product/customizer/ProductsCustomizer.java) - when you want to do modifications for two
or more products
- [SpringBootCustomizer](src/main/java/software/tnb/product/csb/customizer/SpringbootCustomizer.java),
[QuarkusCustomizer](src/main/java/software/tnb/product/cq/customizer/QuarkusCustomizer.java),
[CamelKCustomizer](src/main/java/software/tnb/product/ck/customizer/CamelKCustomizer.java) to do the change only for specific product
[QuarkusCustomizer](src/main/java/software/tnb/product/cq/customizer/QuarkusCustomizer.java)

Instead of creating `new SpringBoot|Quarkus|CamelK customizers`, you can use
Instead of creating `new SpringBoot|Quarkus customizers`, you can use
[Customizers](src/main/java/software/tnb/product/customizer/Customizers.java) enum, for example:

```java
Customizers.CAMELK.customize(ib -> ...)
Customizers.QUARKUS.customize(ib -> ...)
```

There are also customizer implementations for common modifications needed for a given product. You can check them out in `customizer` sub-package
Expand All @@ -59,8 +56,6 @@ The integrations are created differently for each product:
- `camel quarkus`:
- an application skeleton is generated from the `io.quarkus:quarkus-maven-plugin:<version>:create` maven plugin
- the `integration code` is dumped as a `java file` in the app skeleton
- `camel-k`:
- the `integration code` is dumped as a `String` and the integration is created as the `Integration` object in OpenShift

All products are implementing [JUnit 5 extensions](https://junit.org/junit5/docs/current/user-guide/#extensions) so creating a fuse product in your
test is as simple as adding following piece of code:
Expand All @@ -70,14 +65,16 @@ test is as simple as adding following piece of code:
public static Product product = ProductFactory.create();
```

In this case a correct product instance is determined based on system property `fuse.product` (camelspringboot, camelquarkus, camelk)
In this case a correct product instance is determined based on system property `fuse.product` (camelspringboot, camelquarkus)
and based on `openshift.url` property presence (determines if the deployment is local or openshift)

If you want a specific instance of a given fuse product, you can use:

```java
import software.tnb.product.cq.LocalCamelQuarkus;

@RegisterExtension
public static CamelK camelk = ProductFactory.create(CamelK.class);
public static LocalCamelQuarkus cq = ProductFactory.create(LocalCamelQuarkus.class);
```

for example to test features specific to Camel-K only.
for example to test features specific to Camel-Quarkus only.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private ConditionEvaluationResult evaluateRunOnAnnotations(ExtensionContext cont
getCurrentElementAnnotation(context, RunOn.class).ifPresent(annotations::add);

// If there are no annotations and the current element isn't a test method (e.g. is a test class), search the annotation in parent classes
// This enables to have @CamelKOnly annotation in CamelKTestSuiteParent and you don't have to add it to every class extending the parent
// This enables to have @SpringBootOnly annotation in test suite parent and you don't have to add it to every class extending the parent
if (annotations.isEmpty() && context.getTestMethod().isEmpty()) {
try {
Field f = Class.forName("org.junit.jupiter.engine.descriptor.AbstractExtensionContext").getDeclaredField("testDescriptor");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,6 @@ public List<InstantValue> executeQuery(NodeMetric metric, String nodeName, long
return executeQueryRangeSingleMetricWithVector(metric.query, start, end, step, nodeName);
}

public List<InstantValue> executeQuery(CamelKMetric metric, String podName) {
return executeQueryToGetVector(metric.query, targetNamespace, podName);
}

/**
* Executes a generic query using <i>query_range</i> request and returning a vector
*
Expand Down Expand Up @@ -286,25 +282,6 @@ public enum PodMetric {
}
}

public enum CamelKMetric {
BUILD_DURATION_SEC_COUNT("camel_k_build_duration_seconds_count{namespace=\"%s\",pod=\"%s\"}"),
BUILD_DURATION_SEC_SUM("camel_k_build_duration_seconds_sum{namespace=\"%s\",pod=\"%s\"}"),
BUILD_QUEUE_DURATION_SEC_COUNT("camel_k_build_queue_duration_seconds_count{namespace=\"%s\",pod=\"%s\"}"),
BUILD_QUEUE_DURATION_SEC_SUM("camel_k_build_queue_duration_seconds_sum{namespace=\"%s\",pod=\"%s\"}"),
BUILD_RECOVERY_ATTEMPTS_COUNT("camel_k_build_recovery_attempts_count{namespace=\"%s\",pod=\"%s\"}"),
BUILD_RECOVERY_ATTEMPTS_SUM("camel_k_build_recovery_attempts_sum{namespace=\"%s\",pod=\"%s\"}"),
INTEGRATION_FIRST_READINESS_SEC_COUNT("camel_k_integration_first_readiness_seconds_count{namespace=\"%s\",pod=\"%s\"}"),
INTEGRATION_FIRST_READINESS_SEC_SUM("camel_k_integration_first_readiness_seconds_sum{namespace=\"%s\",pod=\"%s\"}"),
RECONCILIATION_DURATION_SEC_COUNT("camel_k_reconciliation_duration_seconds_count{namespace=\"%s\",pod=\"%s\"}"),
RECONCILIATION_DURATION_SEC_SUM("camel_k_reconciliation_duration_seconds_sum{namespace=\"%s\",pod=\"%s\"}");

String query;

CamelKMetric(String query) {
this.query = query;
}
}

public enum OtherPodMetric {
POD_INFO("node_namespace_pod:kube_pod_info:{namespace=\"%s\",pod=~\"%s\"}[%ss]");

Expand Down

0 comments on commit 5c27a6d

Please sign in to comment.