Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
README.md 5.28 KiB

Partition Service

os-partition-gcp is a Spring Boot service that is responsible for creating and retrieving partition specific properties on behalf of other services whether they are secret values or not.

Features of implementation

This is a universal solution created using EPAM OSM mapper technology. It allows you to work with various implementations of KV stores.

Limitations of the current version

In the current version, the mappers have been equipped with several drivers to the stores:

OSM (mapper for KV-data): Google Datastore; Postgres

Extensibility

To use any other store or message broker, implement a driver for it. With an extensible set of drivers, the solution is unrestrictedly universal and portable without modification to the main code. Mappers support "multitenancy" with flexibility in how it is implemented. They switch between datasources of different tenants due to the work of a bunch of classes that implement the following interfaces:

  • Destination - takes a description of the current context, e.g., "data-partition-id = opendes";
  • DestinationResolver – accepts Destination, finds the resource, connects, and returns Resolution;
  • DestinationResolution – contains a ready-made connection, the mapper uses it to get the data.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Pre-requisites

  • GCloud SDK with java (latest version)
  • JDK 8
  • Lombok 1.16 or later
  • Maven

Anthos Service Configuration:

Anthos service configuration

Google Cloud Service Configuration:

Google Cloud service configuration

Run Locally

Check that maven is installed:

$ mvn --version
Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 1.8.0_212, vendor: AdoptOpenJDK, runtime: /usr/lib/jvm/jdk8u212-b04/jre
...

You may need to configure access to the remote maven repository that holds the OSDU dependencies. This file should live within ~/.mvn/community-maven.settings.xml:

$ cat ~/.m2/settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <servers>
        <server>
            <id>community-maven-via-private-token</id>
            <!-- Treat this auth token like a password. Do not share it with anyone, including Microsoft support. -->
            <!-- The generated token expires on or before 11/14/2019 -->
             <configuration>
              <httpHeaders>
                  <property>
                      <name>Private-Token</name>
                      <value>${env.COMMUNITY_MAVEN_TOKEN}</value>
                  </property>
              </httpHeaders>
             </configuration>
        </server>
    </servers>
</settings>
  • Update the Google cloud SDK to the latest version:
gcloud components update
  • Set Google Project Id:
gcloud config set project <YOUR-PROJECT-ID>
  • Perform a basic authentication in the selected project:
gcloud auth application-default login