coherence-operator

Developer Guide

The Developer Guide provides information for developers who want to build, install, and test the operator.

After successfully completing the steps in this guide, you can execute the instructions in the Quick Start Guide and User Guide.

Prerequisites

See Before You Begin section in the Quick Start guide. In addition, you require the following software versions for the build environment:

Note: If you are using other operating systems or Docker versions, you need to make the necessary adjustments to execute the steps in this guide.

Verify System Environment

Check whether your environment is configured with the following software for building and installing the operator:

Software Verify Expected Output
Docker $ docker run hello world Hello from Docker!
Kubernetes $ kubectl version Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.3", GitCommit:"721bfa751924da8d1680787490c54b9179b1fed0", GitTreeState:"clean", BuildDate:"2019-02-04T04:49:22Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"darwin/amd64"}<br>Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:25:46Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Helm $ helm version Client: &version.Version{SemVer:"v2.12.3", GitCommit:"eecf22f77df5f65c823aacd2dbd30ae6c65f186e", GitTreeState:"clean"}<br>Server: &version.Version{SemVer:"v2.12.3", GitCommit:"eecf22f77df5f65c823aacd2dbd30ae6c65f186e", GitTreeState:"clean"}
Java java version java version "11.0.1" 2018-10-16 LTS
Maven mvn version Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T14:33:14-04:00) <br> Maven home: /Users/username/Downloads/apache-maven-3.5.4 <br> Java version: 11.0.1, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home

Build the Operator

The operator is built using Apache Maven. To build the operator without running any tests, do the following:

  1. Clone and check out the current version of the operator from the GitHub repository.
  2. Create a Maven settings.xml file. If you already have one, ensure that the following settings are included in your default profile:

    <properties>
        <test.image.prefix>DOCKER_REPO_HOSTNAME/DOCKER_REPO_PREFIX/dev/DEV_USERNAME/</test.image.prefix>
    </properties>
    

    Note: All the Maven commands in this guide use this settings.xml file.

    In the settings.xml file:

    • DOCKER_REPO_HOSTNAME is the hostname of the Docker repository in which you will push your built Docker images.

      Note: You are not required to push any images when executing the steps in this document.

    • DOCKER_REPO_PREFIX is your organization who owns the repository on Docker Hub.

    • DEV_USERNAME is a username unique to your development environment.

    • In this example, YOUR_test.image.prefix_VALUE is the value used for test.image.prefix property in the settings.xml file.
  3. Obtain a Coherence 12.2.1.3.2 Docker image and tag it correctly.
     docker pull container-registry.oracle.com/middleware/coherence:12.2.1.3.2
    
  4. Tag the obtained image in the way it is required to build the operator.

    1. Obtain the image ID for the Coherence 12.2.1.3.2 Docker image:

      $ docker images | grep 12.2.1.3.2
      
    2. Tag the obtained image:

      docker tag some_tag YOUR_test.image.prefix_VALUE/oracle/coherence:12.2.1.3.2
      

      In this example, some_tag is the tag given to identify the pulled image.

    3. Again execute the command to list the image ID for Coherence:

      $ docker images | grep 12.2.1.3.2
      
      YOUR_test.image.prefix_VALUE/oracle/coherence 12.2.1.3.2 7e7feca04384 2 months ago 547MB
      
  5. From the root directory of your cloned repository, build the operator using the following commands:

    $ mvn -DskipTests clean install
    

    This produces output similar to the following:

    ...
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO]
    [INFO] coherence-operator parent VERSION ........... SUCCESS [  2.487 s]
    [INFO] coherence-operator ................................. SUCCESS [ 21.651 s]
    [INFO] coherence-utils .................................... SUCCESS [ 22.868 s]
    [INFO] coherence-operator-tests VERSION ............ SUCCESS [ 11.468 s]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 58.756 s
    [INFO] Finished at: 2019-04-17T18:35:14-04:00
    [INFO] ------------------------------------------------------------------------
    

    Note: The VERSION in the output will be similar to 1.0.0-SNAPSHOT.

    mvn -DskipTests generate-resources

    This produces output similar to the output of the preceding step.

mvn -DskipTests -Pdocker clean install

The output of this command has the following message:    ```bash    ...    Successfully built af61471e4774    Successfully tagged YOUR_test.image.prefix_VALUE/oracle/coherence-operator:VERSION    ...    Successfully built 88495a497a16    Successfully tagged YOUR_test.image.prefix_VALUE/oracle/coherence-utils:VERSION    ```

Note: The VERSION in the output will be similar to 1.0.0-SNAPSHOT.

  1. Verify that the Docker images have been built and are accessible to your local Docker server.

    $ docker images | grep YOUR_test.image.prefix_VALUE
    

    This produces output similar to the following:

    YOUR_test.image.prefix_VALUE/oracle/coherence-utils    VERSION 88495a497a16 14 minutes ago 124MB
    YOUR_test.image.prefix_VALUE/oracle/coherence-operator VERSION af61471e4774 14 minutes ago 537MB
    YOUR_test.image.prefix_VALUE/oracle/coherence          12.2.1.3.2       7e7feca04384 2 months ago 547MB
    

    Note: The VERSION in the output will be similar to 1.0.0-SNAPSHOT.

  2. Verify that the Coherence Helm chart and the Coherence Operator Helm chart have been built and are accessible in your work area.

    $ ls -la operator/target | grep "drw" | grep coherence
    

    This produces output similar to the following:

    drwxr-xr-x   3 username  staff      96 Apr 17 18:38 coherence-VERSION-helm
    drwxr-xr-x   3 username  staff      96 Apr 17 18:38 coherence-operator-VERSION-helm
    

    If you want to use the build image as the source while executing the steps in the Quick Start Guide and User Guide, replace the Helm repository prefix with the full qualified path:

    • coherence/coherence - /Users/username/workareas/coherence-operator/target/coherence-1.0.0-SNAPSHOT-helm/coherence

    • coherence/coherence-operator - /Users/username/workareas/coherence-operator/target/coherence-operator-1.0.0-SNAPSHOT-helm/coherence-operator

    Note: It is assumed that the Coherence Operator is built within /Users/username/workareas/coherence-operator. The VERSION in the output will be similar to 1.0.0-SNAPSHOT.