For building the Virtual databases, the Operator based on Custom Resource provided starts Maven based build that converts a DDL into container image that can be deployed on Kubernetes/OpenShift. The default Operator configuration comes with settings to go use Maven Central repository to download any dependencies that are required for the build process like JDBC drivers, depency client libraries for connecting to MongoDB or simply a Teiid dependency library.
However in many organizations, it is prohibited to directly access internet and download files as this is considered harmful as those libraries are fully scanned for any authenticity of that organization. So, in these cases the option is to use a local maven repository for organization that has been setup by the developers of that Organization.
For Teiid Operator to use this private maven repository, the user can define this couple different ways. The options vary on customization requirement on apart of the user, however they provide full flexibility to the user.
To configure the common settings.xml
file for all the Teiid specific Virtual Databases, you can create a ConfigMap or Secret with name teiid-maven-settings
with a key name settings.xml
where under the key define the contents of the maven settings file. When Operator is building a image for your Virtual database, it will look for this ConfigMap with specified name, if it finds it it will use it as the default settings.xml
file in the build. Providing a full settings.xml file is useful when your repository requires authentication, or you have many different repositories and would like to configure in single place.
. Sample Config Map
----
apiVersion: v1
kind: ConfigMap
metadata:
name: teiid-maven-settings
namespace: myproject
data:
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">
<localRepository />
<profiles>
<profile>
<id>maven-settings</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>private</id>
<url>https://myprivate.host.com/maven2</url>
<snapshots>
<enabled>false</enabled>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<releases>
<enabled>false</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>maven-settings</activeProfile>
</activeProfiles>
</settings>
----
Note
|
Above snippet is just an example not a working settings.xml file, however you can copy and modify with your maven repository details and create on the Kubernetes/OpenShift cluster |
Note
|
See example of ConfigMap here. Which can be created using oc create -f maven-settings.yaml command.
|
If you do not want to create a settings.xml
file that applies to all virtual database builds in the namespace, you can configure a ConfigMap or secret with the name {vdb-name}-maven-settings
.
The key name semantics are the same as with configuring a global settings.xml
.
The configuration that you add for a specific virtual database build takes precedence over any global configuration that you set for the namespace.
If you do not want deal with settings.xml
file at all and your private Maven repository is not secured and can be accessed with out any authentication, you can also define the Maven repository directly on custom resource and Operator will adjust the build per your settings. An example of that can look like
apiVersion: teiid.io/v1alpha1
kind: VirtualDatabase
metadata:
name: dv-customer
spec:
replicas: 1
build:
source:
ddl: |
CREATE DATABASE customer OPTIONS (ANNOTATION 'Customer VDB');
USE DATABASE customer;
...
mavenRepositories: (1)
private: https://myprivate.host.com/maven2
private2: https://myprivate.host2.com/maven2
-
Define one or more maven private repositories to be used with the build. Make sure these are not secured and can be accessed without authentication
The maven repo defined this is added in addition to above settings if both are available.