Openshift deployment - fabric8 or template

888 Views Asked by At

I am new to openshift and was going through the interactive tutorialat https://learn.openshift.com/middleware/fis-deploy-app/.

This tutorial uses the source code from https://github.com/jbossdemocentral/katacoda-fuse-getting-started.git and builds the docker image and deploys the app to openshift environment.

I tempalte file mentioned in the tutorial defines the "Routes,Services,BuildConfig, etc" thats required for the deployment. However I could see them defined in /src/main/fabric folder too.

It looks like the fabric folder is not used in the build process. The Route,services,etc created/shown in Openshift console matches the template file.

Can someone clarify whats the use of fabric8 folder and the files inside? I am assuming there should be another way to create the app that takes the configurations from fabric8 - is this correct? Should template file refer to the configs in fabric8?

Can you share some good example which deploys the application into openshift using fabric8?

Basically I have springboot application in my local and trying to figure out the best deployment approach.

Thanks.

1

There are 1 best solutions below

2
On

/src/main/fabric8 folder is only used by fabric8. Files in this folder are called "resource fragments", in which you can customize kubernetes resource definiton. For example, this resource fragment enriches default fabric8 deployment with custom volumes, environment variables and service account.

The following configuration in pom.xml is required to deploy application into openshift using fabric8 maven plugin.

<properties>
    <fabric8.mode>openshift</fabric8.mode>
    <!-- Modify this configration as your openshift project name -->
    <fabric8.namespace>THE_OPENSHIFT_PROJECT_TO_DEPLOY</fabric8.namespace>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric8-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

Then, run mvn fabric8:deploy to deploy packaged jar file.

For more details, please refer to fabric8 maven plugin.