Skip to content

Commit a9734bf

Browse files
sudohainguyennineinchnick
authored andcommitted
Add session properties configuration
Signed-off-by: Harry <quanghai.ng1512@gmail.com>
1 parent 875cf80 commit a9734bf

File tree

4 files changed

+104
-0
lines changed

4 files changed

+104
-0
lines changed

charts/trino/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,12 @@ Fast distributed SQL query engine for big data analytics that helps you explore
349349
- exchange.s3.aws-access-key=your-access-key
350350
- exchange.s3.aws-secret-key=your-secret-key
351351
```
352+
* `sessionProperties` - object, default: `{}`
353+
354+
[Session properties manager config file](https://trino.io/docs/current/admin/session-property-managers.html) is mounted to {{ .Values.server.config.path }}/session-property-config.json
355+
Set the type property to either:
356+
* `configmap`, and provide the session properties manager file contents in `sessionPropertiesConfig`,
357+
* `properties`, and provide configuration properties in `properties`.
352358
* `eventListenerProperties` - list, default: `[]`
353359

354360
[Event listener](https://trino.io/docs/current/develop/event-listener.html#event-listener) properties. To configure multiple event listeners, add them in `coordinator.additionalConfigFiles` and `worker.additionalConfigFiles`, and set the `event-listener.config-files` property in `additionalConfigProperties` to their locations.

charts/trino/templates/configmap-coordinator.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,26 @@ data:
117117
{{- end }}
118118
{{- end }}
119119

120+
{{- if .Values.sessionProperties }}
121+
{{- if eq .Values.sessionProperties.type "configmap" }}
122+
session-property-config.properties: |
123+
session-property-config.configuration-manager=file
124+
session-property-manager.config-file={{ .Values.server.config.path }}/session-property-config.json
125+
126+
session-property-config.json: |
127+
{{- .Values.sessionProperties.sessionPropertiesConfig | nindent 4 }}
128+
{{- else if eq .Values.sessionProperties.type "properties" }}
129+
session-property-config.properties: |
130+
{{- if .Values.sessionProperties.properties }}
131+
{{- .Values.sessionProperties.properties | nindent 4 }}
132+
{{- else}}
133+
{{- fail "sessionProperties.properties is required when sessionProperties.type is 'properties'." }}
134+
{{- end }}
135+
{{- else}}
136+
{{- fail "Invalid sessionProperties.type value. It must be either 'configmap' or 'properties'." }}
137+
{{- end }}
138+
{{- end }}
139+
120140
{{- if .Values.server.exchangeManager }}
121141
exchange-manager.properties: |
122142
exchange-manager.name={{ .Values.server.exchangeManager.name }}

charts/trino/values.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,50 @@ additionalExchangeManagerProperties: []
368368
# - exchange.s3.aws-secret-key=your-secret-key
369369
# ```
370370

371+
sessionProperties: {}
372+
# sessionProperties -- [Session properties manager config
373+
# file](https://trino.io/docs/current/admin/session-property-managers.html) is
374+
# mounted to {{ .Values.server.config.path }}/session-property-config.json
375+
# @raw
376+
# Set the type property to either:
377+
# * `configmap`, and provide the session properties manager file contents in `sessionPropertiesConfig`,
378+
# * `properties`, and provide configuration properties in `properties`.
379+
380+
# Properties example:
381+
# ```yaml
382+
# type: properties
383+
# properties: |
384+
# session-property-config.configuration-manager=file
385+
# session-property-manager.config-file=/etc/trino/session-property-config.json
386+
387+
# Configmap Example:
388+
# ```yaml
389+
# type: configmap
390+
# sessionPropertiesConfig: |-
391+
# [
392+
# {
393+
# "group": "global.*",
394+
# "sessionProperties": {
395+
# "query_max_execution_time": "8h"
396+
# }
397+
# },
398+
# {
399+
# "group": "global.interactive.*",
400+
# "sessionProperties": {
401+
# "query_max_execution_time": "1h"
402+
# }
403+
# },
404+
# {
405+
# "group": "global.pipeline.*",
406+
# "clientTags": ["etl"],
407+
# "sessionProperties": {
408+
# "scale_writers": "true",
409+
# "hive.insert_existing_partitions_behavior": "overwrite"
410+
# }
411+
# }
412+
# ]
413+
# ```
414+
371415
eventListenerProperties: []
372416
# eventListenerProperties -- [Event
373417
# listener](https://trino.io/docs/current/develop/event-listener.html#event-listener)

tests/trino/test-values.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,17 @@ accessControl:
208208
"user": "alice",
209209
"owner": false
210210
}
211+
],
212+
"system_session_properties": [
213+
{
214+
"role": "admin",
215+
"allow": true
216+
},
217+
{
218+
"user": ".*",
219+
"property": "query_max_execution_time",
220+
"allow": true
221+
}
211222
]
212223
}
213224
@@ -311,6 +322,29 @@ networkPolicy:
311322
- key: test
312323
operator: NotIn
313324
values: [network-policy]
325+
sessionProperties:
326+
type: configmap
327+
sessionPropertiesConfig: |-
328+
[
329+
{
330+
"group": "global.admin",
331+
"sessionProperties": {
332+
"query_max_execution_time": "8h"
333+
}
334+
},
335+
{
336+
"group": "global.readonly",
337+
"sessionProperties": {
338+
"query_max_execution_time": "1h"
339+
}
340+
},
341+
{
342+
"group": "global.(finance_human_resources|general)",
343+
"sessionProperties": {
344+
"query_max_execution_time": "10m"
345+
}
346+
}
347+
]
314348
315349
catalogs:
316350
tpch: |

0 commit comments

Comments
 (0)