mrmertozturk commented on issue #3077:
URL: https://github.com/apache/camel-k/issues/3077#issuecomment-1108269011
Thanks for the response. Of course, let me give you some information on what
I'm trying to do.
We have a bunch of camel-k routes whose main function is to sync data from
our Salesforce account to Postgresql database. Probably not important but camel
components we have in these routes are: setHeader, setBody, setProperty, log,
filter, removeHeader, convertBody, validate, split, process, bean, atlasmap and
sql. (As I said, probably not necessary to mention for this issue but I add it
here just in case it is related.)
The command I use to run the integration is:
```
kamel run \
-d mvn:org.apache.commons:commons-dbcp2:2.9.0 \
-d mvn:org.postgresql:postgresql:42.2.23 \
-d mvn:org.postgresql:postgresql:42.3.0 \
-d mvn:xalan:xalan:2.7.2 \
--source ./sources/postgres_db.groovy \
--source ./sources/dynamic.java \
--source ./sources/ContactPreMapHandler.java \
--config configmap:elb-svc-names-cm \
--config configmap:other-configs-cm \
--config secret:dynamic-salesforce-credentials-secret \
--config secret:postgres-credentials-secret \
--config secret:sf-jwt-token \
--open-api file:./resources/contact-openapi.yaml \
--resource file:./resources/get-salesforce-contacts.vm \
--resource file:./resources/upsert-contact.vm \
--resource file:./resources/contact-mapping.adm \
-t container.limit-memory="512Mi" \
-t ingress.enabled=false \
-t jolokia.enabled=true \
-t logging.enabled=true \
-t logging.color=true \
-t logging.level="DEBUG" \
-t service.enabled=true \
-t service.node-port=false \
-t service.auto=true \
-t health.enabled=true \
-t health.liveness-probe-enabled=true \
-t health.liveness-scheme="HTTP" \
-t health.liveness-initial-delay=30 \
-t health.liveness-timeout=30 \
-t health.liveness-period=300 \
-t health.liveness-success-threshold=1 \
-t health.liveness-failure-threshold=3 \
-t health.readiness-probe-enabled=true \
-t health.readiness-scheme="HTTP" \
-t health.readiness-initial-delay=30 \
-t health.readiness-timeout=30 \
-t health.readiness-period=300 \
-t health.readiness-success-threshold=1 \
-t health.readiness-failure-threshold=3 \
ContactSync.java \
-n $1
```
- We have the last line `-n $1` so that we can reference a namespace in our
Github Actions.
- All our camel-k integrations share the following resources:
1. `postgres_db.groovy`
2. `dynamic.java`
3. All 5 resources with the `--config` type.
4. All the traits.
The `postgres_db.groovy` file:
```
import org.apache.commons.dbcp2.BasicDataSource
beans {
String postgresUsername =
context.resolvePropertyPlaceholders("{{postgres.username}}")
String postgresPassword =
context.resolvePropertyPlaceholders("{{postgres.password}}")
String postgresHost =
context.resolvePropertyPlaceholders("{{postgres.host}}")
String postgresDatabase =
context.resolvePropertyPlaceholders("{{local.parameters.postgres.database}}")
dataSource(BasicDataSource) {
driverClassName = 'org.postgresql.Driver'
url = 'jdbc:postgresql://' + postgresHost + '/' + postgresDatabase
username = postgresUsername
password = postgresPassword
maxTotal = 8
maxIdle = 8
minIdle = 0
initialSize = 0
}
}
```
The `dynamic.java` file:
```
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.salesforce.AuthenticationType;
import org.apache.camel.component.salesforce.SalesforceComponent;
import org.apache.camel.component.salesforce.SalesforceLoginConfig;
import org.apache.camel.support.jsse.KeyStoreParameters;
public class dynamic extends RouteBuilder {
@Override
public void configure() throws Exception {
SalesforceLoginConfig salesforceLoginConfig = new
SalesforceLoginConfig();
salesforceLoginConfig.setType(AuthenticationType.JWT);
salesforceLoginConfig.setClientId(getContext().resolvePropertyPlaceholders("{{dynamicsfconfig.sf-login-config-clientId}}"));
salesforceLoginConfig.setClientSecret(getContext().resolvePropertyPlaceholders("{{dynamicsfconfig.sf-login-config-clientSecret}}"));
salesforceLoginConfig.setLoginUrl(getContext().resolvePropertyPlaceholders("{{dynamicsfconfig.sf-login-config-loginURL}}"));
salesforceLoginConfig.setUserName(getContext().resolvePropertyPlaceholders("{{dynamicsfconfig.sf-login-config-username}}"));
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setPassword(getContext().resolvePropertyPlaceholders("{{dynamicsfconfig.keystore-password}}"));
keyStoreParameters.setResource(getContext().resolvePropertyPlaceholders("{{dynamicsfconfig.keystore-resource}}"));
salesforceLoginConfig.setKeystore(keyStoreParameters);
SalesforceComponent salesforceComponent = new SalesforceComponent();
salesforceComponent.setLoginConfig(salesforceLoginConfig);
getContext().addComponent("salesforce", salesforceComponent);
}
}
```
A bit more insight on when&how we encountered this issue: We had one camel-k
route deployed using the command I posted above. It was running smoothly,
without any problems. All the ConfigMaps, Secrets, mappings and resources were
available and used within the route.
The problem started when I deployed a very similar but a different route to
the same namespace. Now, these two routes were sharing the aforementioned
resources and it is when I first encountered with the issue:
```
Events:
Type Reason Age From
Message
---- ------ ---- ----
-------
Normal IntegrationConditionChanged 7m25s
camel-k-integration-controller Condition "IntegrationPlatformAvailable" is
"True" for Integration s-contact-v2: development/camel-k
Normal IntegrationConditionChanged 7m25s
camel-k-integration-controller Condition "ExposureAvailable" is "False" for
Integration s-contact-v2: explicitly disabled
Normal IntegrationPhaseUpdated 7m25s
camel-k-integration-controller Integration "s-contact-v2" in phase
"Initialization"
Normal IntegrationPhaseUpdated 7m25s
camel-k-integration-controller Integration "s-contact-v2" in phase "Building
Kit"
Normal IntegrationConditionChanged 7m25s
camel-k-integration-controller Condition "IntegrationKitAvailable" is "True"
for Integration s-contact-v2: kit-c9hgufi5a6h9ag5a4s4g
Normal IntegrationPhaseUpdated 7m25s
camel-k-integration-controller Integration "s-contact-v2" in phase "Deploying"
Warning IntegrationError 115s (x17 over 7m25s)
camel-k-integration-controller Cannot reconcile Integration s-contact-v2:
error executing post actions: error during apply resource:
development/s-contact-v2: failed to create typed patch object: errors:
.spec.template.spec.containers[name="integration"].volumeMounts: duplicate
entries for key [mountPath="/etc/camel/resources"]
.spec.template.spec.containers[name="integration"].volumeMounts: duplicate
entries for key [mountPath="/etc/camel/resources"]
```
Since then, I removed the `camel-k-operator` and cleaned all camel-k
resources in the said namespace by running `kamel uninstall --all -n
development` and then tried again with the following kamel versions: `1.7.0`,
`1.8.0`, `1.8.1`, `1.8.2` and lastly `1.9.0-nightly`. Unfortunately, none of
them worked. I kept getting the same error.
I hope I've provided you with enough details regarding the issue. Please
feel free to let me know if you need any further details. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]