== Fabric8

The Fabric8 extension can be used along with the Kubernetes extension to provide a tighter integration with the link:https://github.com/fabric8io/kubernetes-client[Fabric8 Kubernetes Client]

=== Additional Features
- Integration with link:https://eclipse.dev/jkube/docs/kubernetes-maven-plugin/[JKube Kubernetes Maven Plugin]
- Integration with link:https://eclipse.dev/jkube/docs/openshift-maven-plugin/[JKube OpenShift Maven Plugin]

=== JKube Kubernetes & OpenShift Maven Plugin Integration With Cube

If you are using link:https://eclipse.dev/jkube/docs/kubernetes-maven-plugin/[JKube Kubernetes Maven Plugin] or
link:https://eclipse.dev/jkube/docs/openshift-maven-plugin/[JKube OpenShift Maven Plugin] to build images, generate
resources and deploy your application to cluster, then you should use the same approach for integration testing using Cube.

However, there is way to build images and generate resources using the JKube `kubernetes-maven-plugin` or
`openshift-maven-plugin` as a part of test execution.
If you enable `cube.fmp.build` property, cube will build image and generate resources for you by running embedded maven
build as per options provided in `arquillian.xml` using either:
- `mvn package k8s:build k8s:resource -Dfabric8.namespace=$+{namespace_configured_for_cube}+`, or
- `mvn package oc:build oc:resource -Dfabric8.namespace=$+{namespace_configured_for_cube}+`

You can use the following configuration options with Kubernetes and OpenShift extension to enable
link:https://eclipse.dev/jkube/docs/kubernetes-maven-plugin/[JKube Kubernetes Maven Plugin] or
link:https://eclipse.dev/jkube/docs/openshift-maven-plugin/[JKube OpenShift Maven Plugin] build in test execution.

*Configuration Options*
[cols="2,1,1,3", options="header"]
|===
| Options                             | Type           | Env | Description
| cube.fmp.build | Bool (false) | Any | Whether to generate resources using fmp when running test from Maven or IDE
| cube.fmp.build.disable.for.mvn | Bool (false) | Any | Whether to generate resources using fmp only when running test from IDE, not from maven
| cube.fmp.pom.path  | String | Any | Path to pom.xml where fmp plugin configuration is present. Defaults to `pom.xml`
| cube.fmp.build.options  | String | Any | Parameters used to start up the JVM running Embedded Maven and can be used to supply additional options to Embedded Maven.
| cube.fmp.debug.output  | Bool (false) | Any | Whether to show debug output(-X) for generating resources using JKube Kubernetes or OpenShift maven plugin
| cube.fmp.logs  | Bool (true) | Any | Whether to show logs for generating resources using JKube Kubernetes or OpenShift maven plugin
| cube.fmp.profiles  | List | Any | Comma-separated list of profiles which you want to activate while generating resources
| cube.fmp.system.properties  | List | Any | Comma-separated key value pair to use for maven build
|===

*IMPORTANT*

- Make sure you have either the JKube `kubernetes-maven-plugin` or `openshift-maven-plugin` dependency in plugin section:
```xml
<build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.jkube</groupId>
        <artifactId>kubernetes-maven-plugin</artifactId>
        <version>${version.jkube}</version>
      </plugin>
    </plugins>
  </build>
```

```xml
<build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.jkube</groupId>
        <artifactId>openshift-maven-plugin</artifactId>
        <version>${version.jkube}</version>
      </plugin>
    </plugins>
  </build>
```

- If you have multiple profiles defined in your pom.xml, you can enable profile in which you have the JKube
`kubernetes-maven-plugin` or the `openshift-maven-plugin` dependency by using `cube.fmp.profiles` in arquillian.xml.

You can see the example using `openshift-maven-plugin` at: https://github.com/arquillian/arquillian-cube/tree/main/openshift/ftest-openshift-jkube-maven-plugin
