A CRD is the new VDB
Here’s a quick rundown of how Teiid is evolving to make usage on OpenShift as easy as possible. It all starts with a CRD.
OpenShift / Kubernetes provide an extension mechanism called custom resources. The Teiid project has defined a VDB custom resource, which the Teiid Operator uses to create an instance of your Teiid runtime. A CRD is a custom resource definition, which is nothing more than yaml or json describing your custom resource.
Here’s an example that creates a VDB accessing a SOAP source:
apiVersion: teiid.io/v1alpha1 kind: VirtualDatabase metadata: name: dv-soap spec: replicas: 1 datasources: - name: soapCountry type: soap properties: - name: wsdl value: http://www.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL - name: namespaceUri value: http://www.oorsprong.org/websamples.countryinfo - name: serviceName value: CountryInfoService - name: endPointName value: CountryInfoServiceSoap12 build: source: ddl: | CREATE DATABASE soap; USE DATABASE soap; --sources CREATE SERVER soapCountry FOREIGN DATA WRAPPER soap; --schema CREATE SCHEMA countrySource SERVER soapCountry; CREATE VIRTUAL SCHEMA country; IMPORT FROM SERVER soapCountry INTO countrySource; SET SCHEMA country; CREATE VIRTUAL PROCEDURE GetCapitalCity (code string) returns string as select xpathValue(CapitalCitySoapResponse, '//*:CapitalCityResult') from (call countrySource.CapitalCity(xmlelement("CapitalCity", xmlnamespaces(default 'http://www.oorsprong.org/websamples.countryinfo'), xmlelement("sCountryISOCode",code)))) x;
For those who have already converted to using DDL VDBs, this isn’t too much of a leap. In addition to your Teiid DDL you provide metadata for use by OpenShift (apiVersion, replica count, etc.) and datasource management. The secret sauce is that the Teiid Operator can take this minimal definition and create your fully functioning runtime image and OpenShift deployment. No Java code, no Spring Boot knowledge, not even Maven required. Default JDBC, pg/ODBC, and OData access are available as well as high-level integration with Jaeger, Prometheus, and Keycloak. For the most common sources even the driver versions are managed for you.
The Teiid CR leverages existing OpenShift functionality such as ConfigMap and Secrets to keep environmentally dependent information out of your CRD. For example, rather than a hard coded wsdl endpoint, you could have:
properties: - name: wsdl valueFrom: configMapKeyRef: name: special-config key: wsdl
The quickest path for trying this out is getting a local instance of Code Ready Containers (CRC) setup - fair warning you do need a sufficiently powerful machine as you are launching an entire hybrid cloud platform ;)
Once you setup or have access to an OpenShift environment, you install the Teiid Operator. There are instructions in The Teiid Operator for building from source. There are also tagged versions maintained in quay.
Then you create your CR, typically by issuing an oc command - $oc create -f my-vdb.yml
Finally sit back and let the Teiid Operator and OpenShift handle everything from there.
For those that are thinking that sounds great, but what about all of the possible configuration and extension points I was was used to in Teiid WildFly? The answer is a little complicated:
- many things are available or will soon will be and just need more documentation/examples - custom translators, user defined functions, setting container resources, ssl, etc. - some things aren’t available yet in the underlying Teiid Spring Boot runtime - such as advanced security scenarios, or a properties / ddl driven way of using XA datasources - some things we’d like the operator to handle if possible - imagine a serverless like mode that maintains only a minimal number of hot instances and shuts down everything else based upon active connections.
So if you try this out and see something that’s needed for your scenario, please bring it to our attention.