Skip to content

Releases: spilchen/vertica-kubernetes

1.11.0

26 Apr 17:26
d871665
Compare
Choose a tag to compare
New EventTrigger CRD to create Jobs for status changes in the Vertica…

…DB (#377)

We need the ability to run arbitrary scripts immediately following a new
database creation. This is intended to be used for cases where specific
DB initialization is required before the database can be used by apps.
We are going to take advantage of the Job type and have the operator
create the job when the DB is initialized. This will be handled in a
separate custom resource, called the EventTrigger.

The new CRD will allow you to specify what object and states to watch.
And it will have a job template in it that will get constructed when the
event matches the desired condition. The first use case will look at
specific conditions in the VerticaDB. But it is generic enough so that
we could extend it for other events in the future -- a future use case
that we may want is to watch a secret and update Vertica when its
contents change.

This runs as a separate controller in our existing operator pod.

A sample EventTrigger CR is as follows. This will create a user table
(T1) right after the VerticaDB completes its database creation.

```
apiVersion: vertica.com/v1beta1
kind: EventTrigger
metadata:
  name: eventtrigger-sample
spec:
  references:
  - object:
      apiVersion: vertica.com/v1beta1
      kind: VerticaDB
      name: verticadb-sample
  matches:
  - condition:
      type: DBInitialized
      status: "True"
  template:
    metadata:
      generateName: create-user-table-
    spec:
      template:
        spec:
          restartPolicy: OnFailure
          containers:
          - name: main
            image: "vertica/vertica-k8s:latest"
            command: ["/opt/vertica/bin/vsql", "-h", "verticadb-sample-defaultsubcluster", "-c", "CREATE TABLE T1 (C1 INT);"]
```

---------

Co-authored-by: Matt Spilchen <matt.spilchen@vertica.com>