I'm from Fabric8 team. Fabric8 Maven Plugin has an option fabric8.targetDir
with which you can override default target directory. Here is how it should work for your use case:
~/work/repos/fmp-demo-project : $ mkdir fabric8
~/work/repos/fmp-demo-project : $ mvn fabric8:resource -Dfabric8.targetDir="./fabric8"
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< meetup:random-generator >-----------------------
[INFO] Building random-generator 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- fabric8-maven-plugin:4.3.1:resource (default-cli) @ random-generator ---
[INFO] F8: Using Container image name of namespace: rokumar
[INFO] F8: Running generator spring-boot
[INFO] F8: spring-boot: Using Container image fabric8/s2i-java:2.3 as base / builder
[INFO] F8: fmp-controller: Adding a default Deployment
[INFO] F8: fmp-service: Adding a default service 'random-generator' with ports [8080]
[INFO] F8: f8-healthcheck-spring-boot: Adding readiness probe on port 8080, path='//health', scheme='HTTP', with initial delay 10 seconds
[INFO] F8: f8-healthcheck-spring-boot: Adding liveness probe on port 8080, path='//health', scheme='HTTP', with initial delay 180 seconds
[INFO] F8: fmp-revision-history: Adding revision history limit to 2
[INFO] F8: validating /home/rohaan/work/repos/fmp-demo-project/fabric8/kubernetes/random-generator-service.yml resource
[INFO] F8: validating /home/rohaan/work/repos/fmp-demo-project/fabric8/kubernetes/random-generator-deployment.yml resource
[INFO] F8: fmp-controller: Adding a default DeploymentConfig
[INFO] F8: fmp-service: Adding a default service 'random-generator' with ports [8080]
[INFO] F8: f8-healthcheck-spring-boot: Adding readiness probe on port 8080, path='//health', scheme='HTTP', with initial delay 10 seconds
[INFO] F8: f8-healthcheck-spring-boot: Adding liveness probe on port 8080, path='//health', scheme='HTTP', with initial delay 180 seconds
[INFO] F8: fmp-revision-history: Adding revision history limit to 2
[INFO] F8: validating /home/rohaan/work/repos/fmp-demo-project/fabric8/openshift/random-generator-deploymentconfig.yml resource
[INFO] F8: validating /home/rohaan/work/repos/fmp-demo-project/fabric8/openshift/random-generator-service.yml resource
[INFO] F8: validating /home/rohaan/work/repos/fmp-demo-project/fabric8/openshift/random-generator-route.yml resource
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.127 s
[INFO] Finished at: 2020-01-08T12:37:50+05:30
[INFO] ------------------------------------------------------------------------
~/work/repos/fmp-demo-project : $ ls fabric8/
kubernetes kubernetes.yml openshift openshift.yml
~/work/repos/fmp-demo-project : $ ls fabric8/kubernetes
random-generator-deployment.yml random-generator-service.yml
Unfortunately, Fabric8 Maven Plugin generates resource descriptors for both Kubernetes and Openshift. In case of Kubernetes also, it generates a default Service
, if you want to disable it, you can configure plugin like this to disable Service Enricher:
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>4.3.1</version>
<configuration>
<enricher>
<excludes>
<exclude>fmp-service</exclude>
</excludes>
</enricher>
</configuration>
</plugin>
This way Service
won't be generated during the resource generation phase and you would be left with Deployment
only. Here is a run after the plugin configuration:
"/work/repos/fmp-demo-project : $ mvn fabric8:resource -Dfabric8.targetDir="./fabric8
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< meetup:random-generator >-----------------------
[INFO] Building random-generator 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- fabric8-maven-plugin:4.3.1:resource (default-cli) @ random-generator ---
[INFO] F8: Using Container image name of namespace: rokumar
[INFO] F8: Running generator spring-boot
[INFO] F8: spring-boot: Using Container image fabric8/s2i-java:2.3 as base / builder
[INFO] F8: fmp-controller: Adding a default Deployment
[INFO] F8: f8-healthcheck-spring-boot: Adding readiness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 10 seconds
[INFO] F8: f8-healthcheck-spring-boot: Adding liveness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 180 seconds
[INFO] F8: fmp-revision-history: Adding revision history limit to 2
[INFO] F8: validating /home/rohaan/work/repos/fmp-demo-project/fabric8/kubernetes/random-generator-deployment.yml resource
[INFO] F8: fmp-controller: Adding a default DeploymentConfig
[INFO] F8: f8-healthcheck-spring-boot: Adding readiness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 10 seconds
[INFO] F8: f8-healthcheck-spring-boot: Adding liveness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 180 seconds
[INFO] F8: fmp-revision-history: Adding revision history limit to 2
[INFO] F8: validating /home/rohaan/work/repos/fmp-demo-project/fabric8/openshift/random-generator-deploymentconfig.yml resource
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.598 s
[INFO] Finished at: 2020-01-08T14:20:52+05:30
[INFO] ------------------------------------------------------------------------
~/work/repos/fmp-demo-project : $ ls fabric8/
kubernetes kubernetes.yml openshift openshift.yml
~/work/repos/fmp-demo-project : $ ls fabric8/kubernetes
random-generator-deployment.yml
We have been refactoring/rebranding FMP into two different plugins, you can find it here: Eclipse Jkube, it has two plugins - Kubernetes Maven Plugin and Openshift Maven Plugin. They only generate Kubernetes or Openshift manifests respectively. That way you can only generate Kubernetes resources which seem to be fitting your current use case.
Hope that helps.