Skip to content

Commit 4020b3d

Browse files
committed
feat: add support for openlineage
1 parent b4e3d25 commit 4020b3d

37 files changed

Lines changed: 1519 additions & 42 deletions

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ All notable changes to this project will be documented in this file.
1111
Previously, users had to use the `generic` connector ([#883]).
1212
- Added support for Trino 481 ([#900]).
1313
- Add a new `.spec.name.inferred.replaceHyphensWithUnderscores` field on TrinoCatalog, which allows tweaking the catalog name in Trino ([#903]).
14+
- Add `spec.clusterConfig.openLineage` to emit [OpenLineage](https://openlineage.io/) lineage events:
15+
the operator configures the Trino OpenLineage event listener on the coordinator (an
16+
`event-listener.properties` pointing at the backend `host`/`port`, with the cluster's `trino.uri`
17+
and namespace). The backend connection is inlined or references an `OpenLineageConnection`
18+
resource. TLS server verification against a `secretClass` CA is imported into the coordinator
19+
truststore, and a bearer token from a Static `AuthenticationClass` is injected at startup without
20+
landing in the ConfigMap ([#914]).
1421

1522
### Changed
1623

@@ -46,6 +53,7 @@ All notable changes to this project will be documented in this file.
4653
[#900]: https://github.com/stackabletech/trino-operator/pull/900
4754
[#903]: https://github.com/stackabletech/trino-operator/pull/903
4855
[#908]: https://github.com/stackabletech/trino-operator/pull/908
56+
[#914]: https://github.com/stackabletech/trino-operator/pull/914
4957

5058
## [26.3.0] - 2026-03-16
5159

Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.nix

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,9 @@ tokio = { version = "1.52", features = ["full"] }
2929
tracing = "0.1"
3030

3131
[patch."https://github.com/stackabletech/operator-rs.git"]
32+
# TODO: Switch back to a release tag once operator-rs#1250 (the `crd::openlineage`
33+
# module) has merged and a new stackable-operator release has been published.
34+
# See <https://github.com/stackabletech/operator-rs/pull/1250>.
35+
stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "feat/openlineage-crd" }
3236
# stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "smooth-operator"}
3337
# stackable-operator = { path = "../operator-rs/crates/stackable-operator" }

crate-hashes.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/helm/trino-operator/templates/clusterrole-operator.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,12 @@ rules:
176176
- get
177177
- list
178178
- watch
179+
# Read OpenLineage connection configuration referenced in the TrinoCluster spec.
180+
- apiGroups:
181+
- openlineage.stackable.tech
182+
resources:
183+
- openlineageconnections
184+
verbs:
185+
- get
186+
- list
187+
- watch
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
= OpenLineage
2+
:description: Emit OpenLineage data lineage events from Trino queries to an OpenLineage-compatible backend such as Marquez.
3+
:keywords: OpenLineage, data lineage, event listener, Marquez, Trino
4+
5+
https://openlineage.io/[OpenLineage] is an open standard for data lineage collection.
6+
Trino ships an https://trino.io/docs/current/admin/event-listeners-openlineage.html[OpenLineage event listener] as a core plugin, which emits a lineage event for every executed query.
7+
The Trino operator can configure this listener automatically, so lineage from all queries run on the cluster is sent to an OpenLineage-compatible backend such as https://marquezproject.github.io/marquez/[Marquez], without any manual configuration.
8+
9+
When configured, the operator:
10+
11+
* writes an `event-listener.properties` file on the *coordinator* selecting the OpenLineage plugin and its HTTP transport,
12+
* points the transport at the backend endpoint (`<scheme>://<host>:<port>`),
13+
* records this cluster's `trino.uri` and a lineage namespace, and
14+
* (optionally) imports a backend CA certificate into the coordinator trust store and injects a bearer token for authenticated backends.
15+
16+
The event listener runs on the coordinator only; workers are not affected.
17+
18+
== Enabling OpenLineage
19+
20+
OpenLineage is configured through `clusterConfig.openLineage.connection`, which either inlines an OpenLineage connection or references a standalone `OpenLineageConnection` resource by name:
21+
22+
[source,yaml]
23+
----
24+
apiVersion: trino.stackable.tech/v1alpha1
25+
kind: TrinoCluster
26+
metadata:
27+
name: trino
28+
spec:
29+
clusterConfig:
30+
openLineage: # <1>
31+
connection: # <2>
32+
inline:
33+
host: marquez
34+
port: 5000
35+
# tls:
36+
# verification:
37+
# server:
38+
# caCert:
39+
# secretClass: marquez-ca
40+
# namespace: trino-lineage # <3>
41+
...
42+
----
43+
<1> Adding the `openLineage` block enables OpenLineage event emission. Omit it entirely to leave OpenLineage off (the default).
44+
<2> The OpenLineage backend connection. Use `inline` (shown here) to define the connection directly, or `reference: <name>` to point at an `OpenLineageConnection` resource in the same namespace. Required.
45+
<3> Optional. The OpenLineage namespace events are reported under. Defaults to the cluster's Kubernetes namespace.
46+
47+
NOTE: The shared connection type also accepts an `appName` field. It is ignored for Trino, which is a long-running service rather than a single job and derives an OpenLineage job name per query.
48+
49+
The `OpenLineageConnection` resource (`openlineage.stackable.tech`) is a reusable definition of a connection to an OpenLineage backend, provided by the Stackable operator library.
50+
Reference it to share one backend definition across multiple clusters:
51+
52+
[source,yaml]
53+
----
54+
apiVersion: openlineage.stackable.tech/v1alpha1
55+
kind: OpenLineageConnection
56+
metadata:
57+
name: marquez
58+
spec:
59+
host: marquez
60+
port: 5000
61+
----
62+
63+
The transport scheme is `https` when `tls.verification.server` is configured, otherwise `http`.
64+
When the connection verifies the server against a `secretClass` CA (as in the commented `tls` block above), the operator mounts that SecretClass certificate into the coordinator and adds it to the trust store, so the OpenLineage listener trusts the backend's certificate.
65+
66+
[#authentication]
67+
== Authentication
68+
69+
Backends that require authentication (for example DataHub, or a Marquez instance behind a gateway) expect a bearer token on each request.
70+
Configure this by referencing an xref:concepts:authentication.adoc[`AuthenticationClass`] from the connection via `authenticationClassRef`:
71+
72+
[source,yaml]
73+
----
74+
apiVersion: trino.stackable.tech/v1alpha1
75+
kind: TrinoCluster
76+
metadata:
77+
name: trino
78+
spec:
79+
clusterConfig:
80+
openLineage:
81+
connection:
82+
inline:
83+
host: marquez
84+
port: 5000
85+
authenticationClassRef: openlineage-auth # <1>
86+
...
87+
---
88+
apiVersion: authentication.stackable.tech/v1alpha1
89+
kind: AuthenticationClass
90+
metadata:
91+
name: openlineage-auth
92+
spec:
93+
provider:
94+
static: # <2>
95+
userCredentialsSecret:
96+
name: openlineage-token # <3>
97+
---
98+
apiVersion: v1
99+
kind: Secret
100+
metadata:
101+
name: openlineage-token
102+
namespace: default # <4>
103+
stringData:
104+
apiKey: "s3cr3t-bearer-token" # <5>
105+
----
106+
<1> References an `AuthenticationClass` by name (cluster-scoped). If omitted, no authentication is used.
107+
<2> Only the `static` provider is supported for OpenLineage. Other providers (LDAP, OIDC, TLS) are rejected with an error.
108+
<3> Name of the Secret holding the token. Must exist in the same namespace as the `TrinoCluster`.
109+
<4> The Secret must be in the cluster's namespace so it can be projected into the coordinator.
110+
<5> The token must be stored under the fixed key `apiKey`. The token is mounted as a file into the coordinator and resolved into the event listener configuration at startup, so it never appears in the ConfigMap or the pod's environment.
111+
112+
The operator translates this into the OpenLineage HTTP transport's `api-key` (bearer) authentication.
113+
Combine it with the `tls` block above when the backend also needs TLS server verification.
114+
115+
== Overriding the generated configuration
116+
117+
The generated `event-listener.properties` can be extended or overridden per role group through xref:usage-guide/overrides.adoc[config overrides], using the `event-listener.properties` file name.
118+
Overrides are merged last and therefore take precedence over the operator-generated values:
119+
120+
[source,yaml]
121+
----
122+
spec:
123+
coordinators:
124+
configOverrides:
125+
event-listener.properties:
126+
openlineage-event-listener.trino.uri: "https://trino.example.com:8443"
127+
----
128+
129+
Event listeners run on the coordinator, so `event-listener.properties` overrides only take effect on the coordinator role.

docs/modules/trino/partials/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
** xref:trino:usage-guide/s3.adoc[]
1212
** xref:trino:usage-guide/security.adoc[]
1313
** xref:trino:usage-guide/monitoring.adoc[]
14+
** xref:trino:usage-guide/openlineage.adoc[]
1415
** xref:trino:usage-guide/log_aggregation.adoc[]
1516
** xref:trino:usage-guide/OpenTelemetry.adoc[]
1617
** xref:trino:usage-guide/query.adoc[]

0 commit comments

Comments
 (0)