Skip to content

Commit 129caf5

Browse files
Feat: Trino Listener Integration (#753)
* add listener to roles * wip - adapt role and rolegroup access * remove unused error * fmt * fix tests * fmt * regenerated charts * add docs * wip - working * make headless service name a function * added tests * adapted changelog * move scripts to commons folder, fix tests * new lines * fix tls test * fix authentication test * fix opa test * attempt to fix * adapt getting started to listener * use role level listener * add lost comment * fix listener examples / comments * Apply suggestions from code review Co-authored-by: Nick <[email protected]> * clippy * fix smoke test * fix tls test * fix authorization test * regenerate charts * fix metrics test for lsitener changes * fix test * Update rust/operator-binary/src/crd/mod.rs Co-authored-by: Nick <[email protected]> * Update rust/operator-binary/src/crd/mod.rs Co-authored-by: Nick <[email protected]> * fmt * fix app version * remove merge artifact * adapt readme for smoke aws test * move rolegroup_metrics_service_name out of cluster impl * typo --------- Co-authored-by: Nick <[email protected]>
1 parent 6b83a29 commit 129caf5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+736
-821
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
1010
- Use `--file-log-max-files` (or `FILE_LOG_MAX_FILES`) to limit the number of log files kept.
1111
- Use `--file-log-rotation-period` (or `FILE_LOG_ROTATION_PERIOD`) to configure the frequency of rotation.
1212
- Use `--console-log-format` (or `CONSOLE_LOG_FORMAT`) to set the format to `plain` (default) or `json`.
13+
- Add Listener integration for Trino ([#753]).
1314
- Add support for Trino 476 ([#755]).
1415

1516
### Changed
@@ -52,6 +53,7 @@ All notable changes to this project will be documented in this file.
5253
[#745]: https://github.com/stackabletech/trino-operator/pull/745
5354
[#748]: https://github.com/stackabletech/trino-operator/pull/748
5455
[#752]: https://github.com/stackabletech/trino-operator/pull/752
56+
[#753]: https://github.com/stackabletech/trino-operator/pull/753
5557
[#755]: https://github.com/stackabletech/trino-operator/pull/755
5658
[#760]: https://github.com/stackabletech/trino-operator/pull/760
5759

deploy/helm/trino-operator/crds/crds.yaml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -105,23 +105,6 @@ spec:
105105
description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
106106
type: object
107107
type: object
108-
listenerClass:
109-
default: cluster-internal
110-
description: |-
111-
This field controls which type of Service the Operator creates for this TrinoCluster:
112-
113-
* cluster-internal: Use a ClusterIP service
114-
115-
* external-unstable: Use a NodePort service
116-
117-
* external-stable: Use a LoadBalancer service
118-
119-
This is a temporary solution with the goal to keep yaml manifests forward compatible. In the future, this setting will control which [ListenerClass](https://docs.stackable.tech/home/nightly/listener-operator/listenerclass.html) will be used to expose the service, and ListenerClass names will stay the same, allowing for a non-breaking change.
120-
enum:
121-
- cluster-internal
122-
- external-unstable
123-
- external-stable
124-
type: string
125108
tls:
126109
default:
127110
internalSecretClass: tls
@@ -436,11 +419,16 @@ spec:
436419
x-kubernetes-preserve-unknown-fields: true
437420
roleConfig:
438421
default:
422+
listenerClass: cluster-internal
439423
podDisruptionBudget:
440424
enabled: true
441425
maxUnavailable: null
442426
description: This is a product-agnostic RoleConfig, which is sufficient for most of the products.
443427
properties:
428+
listenerClass:
429+
default: cluster-internal
430+
description: This field controls which [ListenerClass](https://docs.stackable.tech/home/nightly/listener-operator/listenerclass.html) is used to expose the coordinator.
431+
type: string
444432
podDisruptionBudget:
445433
default:
446434
enabled: true

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,16 @@ rules:
9797
verbs:
9898
- get
9999
- apiGroups:
100-
- apiextensions.k8s.io
100+
- listeners.stackable.tech
101101
resources:
102-
- customresourcedefinitions
102+
- listeners
103103
verbs:
104104
- get
105+
- list
106+
- watch
107+
- patch
108+
- create
109+
- delete
105110
- apiGroups:
106111
- events.k8s.io
107112
resources:

docs/modules/trino/examples/getting_started/code/trino.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ spec:
1010
catalogLabelSelector:
1111
matchLabels:
1212
trino: simple-trino
13-
listenerClass: external-unstable
1413
coordinators:
14+
roleConfig:
15+
listenerClass: external-unstable
1516
roleGroups:
1617
default:
1718
replicas: 1

docs/modules/trino/examples/getting_started/code/trino.yaml.j2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ spec:
1010
catalogLabelSelector:
1111
matchLabels:
1212
trino: simple-trino
13-
listenerClass: external-unstable
1413
coordinators:
14+
roleConfig:
15+
listenerClass: external-unstable
1516
roleGroups:
1617
default:
1718
replicas: 1
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
= Service exposition with ListenerClasses
2+
:description: Configure Trino service exposure with ListenerClasses: cluster-internal, external-unstable, or external-stable.
23

3-
Trino offers a web UI and an API, both are exposed by the `connector` xref:concepts:roles-and-role-groups.adoc[role].
4-
The Operator deploys a service called `<name>-connector` (where `<name>` is the name of the TrinoCluster) through which Trino can be reached.
5-
6-
This service can have three different types: `cluster-internal`, `external-unstable` and `external-stable`.
7-
Read more about the types in the xref:concepts:service-exposition.adoc[service exposition] documentation at platform level.
8-
9-
This is how the ListenerClass is configured:
4+
The operator deploys a xref:listener-operator:listener.adoc[Listener] for the coodinator pod.
5+
The listener defaults to only being accessible from within the Kubernetes cluster, but this can be changed by setting `.spec.coordinators.roleConfig.listenerClass`:
106

117
[source,yaml]
128
----
139
spec:
14-
clusterConfig:
15-
listenerClass: cluster-internal # <1>
10+
coordinators:
11+
roleConfig:
12+
listenerClass: external-unstable # <1>
13+
...
14+
workers:
15+
...
1616
----
17-
<1> The default `cluster-internal` setting.
17+
<1> Specify a ListenerClass, such as `external-stable`, `external-unstable`, or `cluster-internal` (the default setting is `cluster-internal`).
18+
This can be set only for the coordinator role.

rust/operator-binary/src/config/jvm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ mod tests {
276276
let role = TrinoRole::Coordinator;
277277
let rolegroup_ref = role.rolegroup_ref(&trino, "default");
278278
let merged_config = trino.merged_config(&role, &rolegroup_ref, &[]).unwrap();
279-
let coordinators = trino.spec.coordinators.unwrap();
279+
let coordinators = trino.role(&role).unwrap();
280280

281281
let product_version = trino.spec.image.product_version();
282282

0 commit comments

Comments
 (0)