Skip to content

Commit ab73f04

Browse files
authored
Merge branch 'main' into felicity3786/JDBC
2 parents 65dce0e + 673bcf5 commit ab73f04

File tree

88 files changed

+3794
-939
lines changed

Some content is hidden

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

88 files changed

+3794
-939
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ ij_java_doc_align_param_comments = false
1919

2020
[*.yml]
2121
indent_size = 2
22+
23+
[*.tsx]
24+
indent_size = 2

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
java-version: [24]
27+
java-version: [25]
2828
timeout-minutes: 20
2929
steps:
3030
- name: Checkout source

.java-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
24
1+
25.0.1+8

docker/Dockerfile

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,48 @@
1313

1414
# syntax=docker/dockerfile:1
1515
ARG TRINO_GATEWAY_BASE_IMAGE
16-
FROM ${TRINO_GATEWAY_BASE_IMAGE} AS jdk-download
16+
ARG TRINO_GATEWAY_BUILD_IMAGE
17+
18+
FROM ${TRINO_GATEWAY_BUILD_IMAGE} AS jdk-download
1719
ARG JDK_DOWNLOAD_LINK
18-
ARG JDK_VERSION
19-
ENV JAVA_HOME="/usr/lib/jvm/jdk-${JDK_VERSION}"
20+
ARG JDK_RELEASE_NAME
21+
ENV JAVA_HOME="/usr/lib/jvm/jdk-${JDK_RELEASE_NAME}"
2022

2123
RUN \
2224
set -xeuo pipefail && \
23-
microdnf install -y tar gzip && \
25+
dnf install -y tar gzip && \
2426
# Install JDK from the provided archive link \
2527
echo "Downloading JDK from ${JDK_DOWNLOAD_LINK}" && \
2628
mkdir -p "${JAVA_HOME}" && \
2729
curl -#LfS "${JDK_DOWNLOAD_LINK}" | tar -zx --strip 1 -C "${JAVA_HOME}"
2830

31+
FROM ${TRINO_GATEWAY_BUILD_IMAGE} AS packages
32+
33+
RUN \
34+
set -xeuo pipefail && \
35+
mkdir -p /tmp/overlay/usr/libexec/ && \
36+
touch /tmp/overlay/usr/libexec/grepconf.sh && \
37+
chmod +x /tmp/overlay/usr/libexec/grepconf.sh && \
38+
dnf update -y && \
39+
dnf install --installroot /tmp/overlay --setopt install_weak_deps=false --nodocs -y \
40+
less \
41+
zlib `#required by java` \
42+
curl-minimal grep `# required by health-check` \
43+
shadow-utils `# required by useradd` \
44+
tar `# required to support kubectl cp` && \
45+
rm -rf /tmp/overlay/var/cache/*
46+
2947
FROM ${TRINO_GATEWAY_BASE_IMAGE}
3048
WORKDIR /usr/lib/trino-gateway
3149

32-
ARG JDK_VERSION
33-
ENV JAVA_HOME="/usr/lib/jvm/jdk-${JDK_VERSION}"
50+
ARG JDK_RELEASE_NAME
51+
ENV JAVA_HOME="/usr/lib/jvm/jdk-${JDK_RELEASE_NAME}"
3452
ENV PATH=$PATH:$JAVA_HOME/bin
3553
COPY --from=jdk-download $JAVA_HOME $JAVA_HOME
54+
COPY --from=packages /tmp/overlay /
3655

3756
RUN \
3857
set -xeu && \
39-
microdnf update -y && \
40-
microdnf install -y tar less shadow-utils && \
4158
groupadd trino --gid 1000 && \
4259
useradd trino --uid 1000 --gid 1000 --create-home && \
4360
mkdir -p /usr/lib/trino-gateway /etc/trino-gateway && \

docker/build.sh

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ SOURCE_DIR="${SCRIPT_DIR}/.."
2222

2323
ARCHITECTURES=(amd64 arm64 ppc64le)
2424
TRINO_GATEWAY_VERSION=
25-
JDK_VERSION=$(cat "${SOURCE_DIR}/.java-version")
25+
JDK_RELEASE_NAME=$(cat "${SOURCE_DIR}/.java-version")
2626
# necessary to allow version parsing from the pom file
2727
MVNW_VERBOSE=false
2828

@@ -39,7 +39,7 @@ while getopts ":a:h:r:j:" o; do
3939
exit 0
4040
;;
4141
j)
42-
JDK_VERSION="${OPTARG}"
42+
JDK_RELEASE_NAME="${OPTARG}"
4343
;;
4444
*)
4545
usage
@@ -61,29 +61,18 @@ function check_environment() {
6161
}
6262

6363
function temurin_jdk_link() {
64-
JDK_VERSION="${1}"
64+
JDK_RELEASE_NAME="${1}"
6565
ARCH="${2}"
6666

67-
versionsUrl="https://api.adoptium.net/v3/info/release_names?heap_size=normal&image_type=jdk&os=linux&page=0&page_size=20&project=jdk&release_type=ga&semver=false&sort_method=DEFAULT&sort_order=ASC&vendor=eclipse&version=%28${JDK_VERSION}%2C%5D"
68-
if ! result=$(curl -fLs "$versionsUrl" -H 'accept: application/json'); then
69-
echo >&2 "Failed to fetch release names for JDK version [${JDK_VERSION}, ) from Temurin API : $result"
70-
exit 1
71-
fi
72-
73-
if ! RELEASE_NAME=$(echo "$result" | jq -er '.releases[]' | grep "${JDK_VERSION}" | head -n 1); then
74-
echo >&2 "Failed to determine release name: ${RELEASE_NAME}"
75-
exit 1
76-
fi
77-
7867
case "${ARCH}" in
7968
arm64)
80-
echo "https://api.adoptium.net/v3/binary/version/${RELEASE_NAME}/linux/aarch64/jdk/hotspot/normal/eclipse?project=jdk"
69+
echo "https://api.adoptium.net/v3/binary/version/${JDK_RELEASE_NAME}/linux/aarch64/jdk/hotspot/normal/eclipse?project=jdk"
8170
;;
8271
amd64)
83-
echo "https://api.adoptium.net/v3/binary/version/${RELEASE_NAME}/linux/x64/jdk/hotspot/normal/eclipse?project=jdk"
72+
echo "https://api.adoptium.net/v3/binary/version/${JDK_RELEASE_NAME}/linux/x64/jdk/hotspot/normal/eclipse?project=jdk"
8473
;;
8574
ppc64le)
86-
echo "https://api.adoptium.net/v3/binary/version/${RELEASE_NAME}/linux/ppc64le/jdk/hotspot/normal/eclipse?project=jdk"
75+
echo "https://api.adoptium.net/v3/binary/version/${JDK_RELEASE_NAME}/linux/ppc64le/jdk/hotspot/normal/eclipse?project=jdk"
8776
;;
8877
*)
8978
echo "${ARCH} is not supported for Docker image"
@@ -118,17 +107,19 @@ TAG_PREFIX="trino-gateway:${TRINO_GATEWAY_VERSION}"
118107
#version file is used by the Helm chart test
119108
echo "${TRINO_GATEWAY_VERSION}" > "${SOURCE_DIR}"/trino-gateway-version.txt
120109

121-
TRINO_GATEWAY_BASE_IMAGE=${TRINO_GATEWAY_BASE_IMAGE:-'registry.access.redhat.com/ubi9/ubi-minimal:latest'}
110+
TRINO_GATEWAY_BASE_IMAGE=${TRINO_GATEWAY_BASE_IMAGE:-'redhat/ubi10-micro:latest'}
111+
TRINO_GATEWAY_BUILD_IMAGE=${TRINO_GATEWAY_BUILD_IMAGE:-'redhat/ubi10:latest'}
122112

123113
for arch in "${ARCHITECTURES[@]}"; do
124-
echo "🫙 Building the image for $arch with JDK ${JDK_VERSION}"
114+
echo "🫙 Building the image for $arch with Temurin JDK release ${JDK_RELEASE_NAME}"
125115
DOCKER_BUILDKIT=1 \
126116
docker build \
127117
"${WORK_DIR}" \
128118
--pull \
129-
--build-arg JDK_VERSION="${JDK_VERSION}" \
130-
--build-arg JDK_DOWNLOAD_LINK="$(temurin_jdk_link "${JDK_VERSION}" "${arch}")" \
119+
--build-arg JDK_RELEASE_NAME="${JDK_RELEASE_NAME}" \
120+
--build-arg JDK_DOWNLOAD_LINK="$(temurin_jdk_link "jdk-${JDK_RELEASE_NAME}" "${arch}")" \
131121
--build-arg TRINO_GATEWAY_BASE_IMAGE="${TRINO_GATEWAY_BASE_IMAGE}" \
122+
--build-arg TRINO_GATEWAY_BUILD_IMAGE="${TRINO_GATEWAY_BUILD_IMAGE}" \
132123
--platform "linux/$arch" \
133124
-f Dockerfile \
134125
-t "${TAG_PREFIX}-$arch"

docker/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ services:
1818
type: bind
1919

2020
postgres:
21-
image: ${TRINO_GATEWAY_POSTGRES_IMAGE:-postgres}
21+
image: ${TRINO_GATEWAY_POSTGRES_IMAGE:-postgres:17-alpine}
2222
environment:
2323
- PGPORT=5432
2424
- POSTGRES_PASSWORD=P0stG&es

docs/development.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Build requirements
44

55
* Mac OS X or Linux
6-
* Java 24+, 64-bit
6+
* Java 25+, 64-bit
77
* Docker
88

99
#### Running Trino Gateway in your IDE
@@ -21,7 +21,7 @@ or execute the following command:
2121

2222
#### Locally
2323

24-
This project requires Java 24. Note that higher version of Java have not been
24+
This project requires Java 25. Note that higher version of Java have not been
2525
verified and may run into unexpected issues.
2626

2727
Run `./mvnw clean install` to build `trino-gateway`. VM options required for
@@ -71,7 +71,6 @@ Gateway, and can help with pull request reviews and merges.
7171
* [:fontawesome-brands-github: oneonestar - Star Poon](https://github.com/oneonestar)
7272
* [:fontawesome-brands-github: vishalya - Vishal Jadhav](https://github.com/vishalya)
7373
* [:fontawesome-brands-github: wendigo - Mateusz Gajewski](https://github.com/wendigo)
74-
* [:fontawesome-brands-github: willmostly - Will Morrison](https://github.com/willmostly)
7574

7675
## Contributor meetings
7776

docs/gateway-api.md

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
# Gateway API
22

3-
Please note that if there are duplicate `proxyTo` URLs in the backend configuration,
4-
the RoutedTo in the Query History page might not be shown correctly.
3+
The REST API for Trino Gateway can be used to update routing configuration for
4+
the Trino clusters. Note that the API calls do not perform actions on the
5+
clusters themselves.
56

6-
## Add or update a backend
7+
The example commands are for a Trino Gateway server running at
8+
`http://localhost:8080`.
9+
10+
If there are duplicate `proxyTo` URLs in the configuration, the `Name` in the
11+
**Query History** page of the UI might not show correctly.
12+
13+
## Add or update a Trino cluster
714

815
```shell
916
curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
@@ -14,9 +21,9 @@ curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
1421
}'
1522
```
1623

17-
If the backend URL is different from the `proxyTo` URL (for example if they are
18-
internal vs. external hostnames). You can use the optional `externalUrl` field
19-
to override the link in the Active Backends page.
24+
If the Trino cluster URL is different from the `proxyTo` URL, for example if
25+
they are internal and external hostnames used, you can use the optional
26+
`externalUrl` field to override the link in the **Active Backends** page.
2027

2128
```shell
2229
curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
@@ -28,9 +35,14 @@ curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
2835
}'
2936
```
3037

31-
## Get all backends
38+
## List all Trino clusters
39+
40+
```shell
41+
curl -X GET http://localhost:8080/entity/GATEWAY_BACKEND
42+
```
43+
44+
Returns a JSON array of Trino cluster:
3245

33-
`curl -X GET http://localhost:8080/entity/GATEWAY_BACKEND`
3446
```json
3547
[
3648
{
@@ -57,25 +69,26 @@ curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
5769
]
5870
```
5971

60-
## Delete a backend
72+
## Delete a Trino cluster
6173

6274
```shell
6375
curl -X POST -d "trino3" http://localhost:8080/gateway/backend/modify/delete
6476
```
6577

66-
## Deactivate a backend
78+
## Deactivate a Trino cluster
6779

6880
```shell
6981
curl -X POST http://localhost:8080/gateway/backend/deactivate/trino-2
7082
```
7183

72-
## Get all active backends
84+
## List all active Trino clusters
7385

7486
```shell
7587
curl -X GET http://localhost:8080/gateway/backend/active
7688
```
7789

78-
Will return a JSON array of active Trino cluster backends:
90+
Returns a JSON array of active Trino clusters:
91+
7992
```json
8093
[
8194
{
@@ -88,18 +101,22 @@ Will return a JSON array of active Trino cluster backends:
88101
]
89102
```
90103

91-
## Activate a backend
104+
## Activate a Trino cluster
92105

93106
```shell
94107
curl -X POST http://localhost:8080/gateway/backend/activate/trino-2
95108
```
96109

97-
## Update Routing Rules
110+
## Update routing rules
98111

99-
This API can be used to programmatically update the Routing Rules.
100-
Rule will be updated based on the rule name.
112+
The API can be used to programmatically update the routing rules. Rule are
113+
updated based on the rule name. Storage of the rules must use a writeable file
114+
and the configuration 'rulesType: FILE'.
101115

102-
For this feature to work with multiple replicas of the Trino Gateway, you will need to provide a shared storage that supports file locking for the routing rules file. If multiple replicas are used with local storage, then rules will get out of sync when updated.
116+
For this feature to work with multiple replicas of the Trino Gateway, you must
117+
provide a shared storage that supports file locking for the routing rules file.
118+
If multiple replicas are used with local storage, then rules get out of
119+
sync when updated.
103120

104121
```shell
105122
curl -X POST http://localhost:8080/webapp/updateRoutingRules \
@@ -111,20 +128,4 @@ curl -X POST http://localhost:8080/webapp/updateRoutingRules \
111128
"condition": "updated condition"
112129
}'
113130
```
114-
### Disable Routing Rules UI
115-
116-
You can set the `disablePages` config to disable pages on the UI.
117-
118-
The following pages are available:
119-
- `dashboard`
120-
- `cluster`
121-
- `resource-group`
122-
- `selector`
123-
- `history`
124-
- `routing-rules`
125-
126-
```yaml
127-
uiConfiguration:
128-
disablePages:
129-
- 'routing-rules'
130-
```
131+

0 commit comments

Comments
 (0)