syndesisio / syndesis

This project is archived. A flexible, customizable, open source platform that provides core integration capabilities as a service.
https://syndesis.io/
Apache License 2.0
597 stars 204 forks source link

Allow user to set additional maven arguments for integration builds #8674

Closed vrlgohel closed 4 years ago

vrlgohel commented 4 years ago

I am editing syndesis-server-config to configure maven proxy settings in Openshift 4.x The environment is set to be deployed behind a proxy.

I am using syndesis version, https://github.com/syndesisio/fuse-online-install/releases/tag/1.9.15 But i am observing this in 1.8 version also.

I do it the following way, 'oc edit cm syndesis-server-config' and change the mavenOptions to this,

mavenOptions: "-XX:+UseG1GC -XX:+UseStringDeduplication -Xmx310m -Dhttp.proxyHost=<IP> -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=localhost|127.0.0.1"

I have no integrations deployed or running. After 1-2 minutes, i see the changes are not persistent and the values are not maintained.

[quicklab@upi-0 ~]$ date
Mon Jun  8 08:47:15 EDT 2020
[quicklab@upi-0 ~]$  oc get cm syndesis-server-config -o yaml | grep mavenOptions
      mavenOptions: "-XX:+UseG1GC -XX:+UseStringDeduplication -Xmx310m  -Dhttp.proxyHost=<IP> -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=localhost|127.0.0.1"

[quicklab@upi-0 ~]$  oc get cm syndesis-server-config -o yaml | grep mavenOptions
      mavenOptions: "-XX:+UseG1GC -XX:+UseStringDeduplication -Xmx310m"
[quicklab@upi-0 ~]$ date
Mon Jun  8 08:48:02 EDT 2020

I also tried deploying syndesis again on a new project with the same changes in the configMap. But the results are the same.

phantomjinx commented 4 years ago

@vrlgohel The syndesis app and its components are controlled by the syndesis-operator, which tracks and reinstalls components depending the installed syndesis custom resource.

As such, if you change a component that is managed by the operator, it will revert the change since it bases all managed resources on its internal configuration. To change that configuration requires updating the syndesis custom resource (CR). This explains what you are seeing with the reversion of your config-map change.

As to your specific change, the CR does support changing the maven respositories. However, it does not support configuring the maven java options. If this is a priority change then please indicate accordingly and we'll see about including it in the next release.

cc @lgarciaaco

squakez commented 4 years ago

I'm facing the same behavior while trying to use camel-k runtime. According to the installation procedure, we need to change a config map value, but this is reverted by the operator. Temporary workaround is to disable the operator.

Observed on master.

vrlgohel commented 4 years ago

@squakez, how are you disabling the operator ? You mean to say you are setting off the triggers for config changes or making replicas=0 ?

squakez commented 4 years ago

@vrlgohel I scale the pod to 0. Please, consider I am on a test environment, I'd avoid to do that on a production env, even temporarily.

lgarciaaco commented 4 years ago

@squakez, how are you disabling the operator ? You mean to say you are setting off the triggers for config changes or making replicas=0 ?

Right ... but this is not recommended in a production environment.

vrlgohel commented 4 years ago

Here's what i tried, oc edit dc/syndesis-operator Made replicas=0. Then, oc edit cm syndesis-server-config, edit the mavenOptions

Rolled out syndesis-operator with replicas=0, oc rollout latest dc/ syndesis-operator

Deployed and Build a new integration,

Building the integration, the maven still takes the original settings,

Using MAVEN_OPTS '-XX:+UseG1GC -XX:+UseStringDeduplication -Xmx310m'
Found pom.xml ... 
Running 'mvn -Dmaven.repo.local=/tmp/artifacts/m2 -s /tmp/src/configuration/settings.xml package -DskipTests -Dmaven.javadoc.skip=true -Dmaven.site.skip=true -Dmaven.source.skip=true -Djacoco.skip=true -Dcheckstyle.skip=true -Dfindbugs.skip=true -Dpmd.skip=true -Dfabric8.skip=true -e -B --strict-checksums'
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N

This still does not work. Is this the correct way i am doing things here ?

Is there any way we can use a custom configMap like the 'syndesis-server-config' with those maven settings and attach it to the 'syndesis-server' so the configuration can work ?

lgarciaaco commented 4 years ago

Did you make sure the operator pod is not running?

oc get pods | grep operator

vrlgohel commented 4 years ago

Still not able to work,

[quicklab@upi-0 ~]$ oc get pods |grep operator
jaeger-operator-5df679c8ff-7hkvq   2/2     Running             0          6d23h
syndesis-operator-1-deploy         0/1     Completed           0          6d23h
syndesis-operator-2-deploy         0/1     Completed           0          6d20h
syndesis-operator-3-deploy         0/1     Completed           0          6d20h

Then, i modify the configMap and deploy the integration. I still see this,

Starting S2I Java Build .....
S2I source build for Maven detected
Using custom maven settings from /tmp/src/configuration/settings.xml
Using MAVEN_OPTS '-XX:+UseG1GC -XX:+UseStringDeduplication -Xmx310m'
Found pom.xml ... 
Running 'mvn -Dmaven.repo.local=/tmp/artifacts/m2 -s /tmp/src/configuration/settings.xml package -DskipTests -Dmaven.javadoc.skip=true -Dmaven.site.skip=true -Dmaven.source.skip=true -Djacoco.skip=true -Dcheckstyle.skip=true -Dfindbugs.skip=true -Dpmd.skip=true -Dfabric8.skip=true -e -B --strict-checksums'
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Apache Maven 3.5.0 (Red Hat 3.5.0-4.3)
claudio4j commented 4 years ago

Just to expand what phantomjinx said above, the mavenOptions property is not allowed to change. To allow the change, we need to add a mavenOptions property to the custom resource, similar to mavenRepositories property (see definition and property) and then the java builder can pickup the mavenOptions. WDYT @phantomjinx ?

claudio4j commented 4 years ago

I changed this title to better reflect the fact we will allow the user to append values to MAVEN_ARGS_APPEND for the integration build pods.

claudio4j commented 4 years ago

I just merged the change. Once this gets into a official build/release, the user can set additional maven arguments, an example:

oc patch syndesis/app --type=merge  -p '{"spec":{"components":{"server":{"features":{"additionalMavenArguments":"-Dhttp.proxy=my_proxy -DpropA=valueA"}}}}}'

Also, this settings can be set when adding the syndesis CR:

spec:
  components:
    server:
      features:
        additionalMavenArguments: "-Dhttp.proxy=my_proxy -DpropA=valueA"