Skip to content

Commit d84d1c1

Browse files
committed
Merge branch 'master' of https://github.com/apache/kyuubi into bump/kubernetes-client-6.1.1
2 parents 7079c90 + 8760eee commit d84d1c1

File tree

11 files changed

+147
-100
lines changed

11 files changed

+147
-100
lines changed

.github/workflows/master.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,9 @@ jobs:
398398
- name: Setup Minikube
399399
uses: manusa/[email protected]
400400
with:
401-
minikube version: 'v1.25.2'
402-
kubernetes version: 'v1.23.3'
401+
minikube version: 'v1.28.0'
402+
kubernetes version: 'v1.25.4'
403+
github token: ${{ secrets.GITHUB_TOKEN }}
403404
driver: docker
404405
start args: '--extra-config=kubeadm.ignore-preflight-errors=NumCPU --force --cpus 2 --memory 4096'
405406
# in case: https://spark.apache.org/docs/latest/running-on-kubernetes.html#rbac

charts/kyuubi/templates/NOTES.txt

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,29 @@
1515
# limitations under the License.
1616
#
1717

18-
Get kyuubi expose URL by running these commands:
19-
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "kyuubi.fullname" . }}-nodeport)
20-
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
21-
echo $NODE_IP:$NODE_PORT
18+
The chart has been installed!
19+
20+
In order to check the release status, use:
21+
helm status {{ .Release.Name }} -n {{ .Release.Namespace }}
22+
or for more detailed info
23+
helm get all {{ .Release.Name }} -n {{ .Release.Namespace }}
24+
25+
************************
26+
******* Services *******
27+
************************
28+
{{- range $name, $frontend := .Values.server }}
29+
{{- if $frontend.enabled }}
30+
{{ $name | snakecase | upper }}:
31+
- To access {{ $.Release.Name }}-{{ $name | kebabcase }} service within the cluster, use the following URL:
32+
{{ $.Release.Name }}-{{ $name | kebabcase }}.{{ $.Release.Namespace }}.svc.cluster.local
33+
- To access {{ $.Release.Name }}-{{ $name | kebabcase }} service from outside the cluster for debugging, run the following command:
34+
kubectl port-forward svc/{{ $.Release.Name }}-{{ $name | kebabcase }} {{ tpl $frontend.service.port $ }}:{{ tpl $frontend.service.port $ }} -n {{ $.Release.Namespace }}
35+
and use 127.0.0.1:{{ tpl $frontend.service.port $ }}
36+
{{- if eq $frontend.service.type "NodePort" }}
37+
- To access {{ $.Release.Name }}-{{ $name | kebabcase }} service from outside the cluster through configured NodePort, run the following commands:
38+
export NODE_PORT=$(kubectl get service {{ $.Release.Name }}-{{ $name | kebabcase }} -n {{ $.Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}")
39+
export NODE_IP=$(kubectl get nodes -n {{ $.Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
40+
echo http://$NODE_IP:$NODE_PORT
41+
{{- end }}
42+
{{- end }}
43+
{{- end }}

charts/kyuubi/templates/_helpers.tpl

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,18 @@
1616
*/}}
1717

1818
{{/*
19-
Expand the name of the chart.
19+
A comma separated string of enabled frontend protocols, e.g. "REST,THRIFT_BINARY".
20+
For details, see 'kyuubi.frontend.protocols': https://kyuubi.readthedocs.io/en/master/deployment/settings.html#frontend
2021
*/}}
21-
{{- define "kyuubi.name" -}}
22-
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
23-
{{- end }}
24-
25-
{{/*
26-
Create a default fully qualified app name.
27-
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
28-
If release name contains chart name it will be used as a full name.
29-
*/}}
30-
{{- define "kyuubi.fullname" -}}
31-
{{- if .Values.fullnameOverride }}
32-
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
33-
{{- else }}
34-
{{- $name := default .Chart.Name .Values.nameOverride }}
35-
{{- if contains $name .Release.Name }}
36-
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
37-
{{- else }}
38-
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- define "kyuubi.frontend.protocols" -}}
23+
{{- $protocols := list }}
24+
{{- range $name, $frontend := .Values.server }}
25+
{{- if $frontend.enabled }}
26+
{{- $protocols = $name | snakecase | upper | append $protocols }}
27+
{{- end }}
3928
{{- end }}
29+
{{- if not $protocols }}
30+
{{ fail "At least one frontend protocol must be enabled!" }}
4031
{{- end }}
32+
{{- $protocols | join "," }}
4133
{{- end }}
42-
43-
{{/*
44-
Create chart name and version as used by the chart label.
45-
*/}}
46-
{{- define "kyuubi.chart" -}}
47-
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
48-
{{- end }}

charts/kyuubi/templates/kyuubi-configmap.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,26 @@ metadata:
2626
app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
2727
app.kubernetes.io/managed-by: {{ .Release.Service }}
2828
data:
29-
{{- with .Values.server.conf.kyuubiEnv }}
29+
{{- with .Values.kyuubiConf.kyuubiEnv }}
3030
kyuubi-env.sh: |
3131
#!/usr/bin/env bash
3232
{{- tpl . $ | nindent 4 }}
3333
{{- end }}
3434
kyuubi-defaults.conf: |
3535
## Helm chart provided Kyuubi configurations
36-
kyuubi.frontend.bind.host={{ .Values.server.bind.host }}
37-
kyuubi.frontend.bind.port={{ .Values.server.bind.port }}
3836
kyuubi.kubernetes.namespace={{ .Release.Namespace }}
37+
kyuubi.frontend.bind.host=localhost
38+
kyuubi.frontend.thrift.binary.bind.port={{ .Values.server.thriftBinary.port }}
39+
kyuubi.frontend.thrift.http.bind.port={{ .Values.server.thriftHttp.port }}
40+
kyuubi.frontend.rest.bind.port={{ .Values.server.rest.port }}
41+
kyuubi.frontend.mysql.bind.port={{ .Values.server.mysql.port }}
42+
kyuubi.frontend.protocols={{ include "kyuubi.frontend.protocols" . }}
3943
4044
## User provided Kyuubi configurations
41-
{{- with .Values.server.conf.kyuubiDefaults }}
45+
{{- with .Values.kyuubiConf.kyuubiDefaults }}
4246
{{- tpl . $ | nindent 4 }}
4347
{{- end }}
44-
{{- with .Values.server.conf.log4j2 }}
48+
{{- with .Values.kyuubiConf.log4j2 }}
4549
log4j2.xml: |
4650
{{- tpl . $ | nindent 4 }}
4751
{{- end }}

charts/kyuubi/templates/kyuubi-deployment.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,16 @@ spec:
5757
envFrom: {{- tpl (toYaml .) $ | nindent 12 }}
5858
{{- end }}
5959
ports:
60-
- name: frontend-port
61-
containerPort: {{ .Values.server.bind.port }}
62-
protocol: TCP
60+
{{- range $name, $frontend := .Values.server }}
61+
{{- if $frontend.enabled }}
62+
- name: {{ $name | kebabcase }}
63+
containerPort: {{ $frontend.port }}
64+
{{- end }}
65+
{{- end }}
6366
{{- if .Values.probe.liveness.enabled }}
6467
livenessProbe:
65-
tcpSocket:
66-
port: {{ .Values.server.bind.port }}
68+
exec:
69+
command: ["/bin/bash", "-c", "bin/kyuubi status"]
6770
initialDelaySeconds: {{ .Values.probe.liveness.initialDelaySeconds }}
6871
periodSeconds: {{ .Values.probe.liveness.periodSeconds }}
6972
timeoutSeconds: {{ .Values.probe.liveness.timeoutSeconds }}
@@ -72,8 +75,8 @@ spec:
7275
{{- end }}
7376
{{- if .Values.probe.readiness.enabled }}
7477
readinessProbe:
75-
tcpSocket:
76-
port: {{ .Values.server.bind.port }}
78+
exec:
79+
command: ["/bin/bash", "-c", "$KYUUBI_HOME/bin/kyuubi status"]
7780
initialDelaySeconds: {{ .Values.probe.readiness.initialDelaySeconds }}
7881
periodSeconds: {{ .Values.probe.readiness.periodSeconds }}
7982
timeoutSeconds: {{ .Values.probe.readiness.timeoutSeconds }}
@@ -85,7 +88,7 @@ spec:
8588
{{- end }}
8689
volumeMounts:
8790
- name: conf
88-
mountPath: {{ .Values.server.confDir }}
91+
mountPath: {{ .Values.kyuubiConfDir }}
8992
{{- with .Values.volumeMounts }}
9093
{{- tpl (toYaml .) $ | nindent 12 }}
9194
{{- end }}

charts/kyuubi/templates/kyuubi-service.yaml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,34 @@
1515
# limitations under the License.
1616
#
1717

18+
{{- range $name, $frontend := .Values.server }}
19+
{{- if $frontend.enabled }}
1820
apiVersion: v1
1921
kind: Service
2022
metadata:
21-
name: {{ .Release.Name }}
23+
name: {{ $.Release.Name }}-{{ $name | kebabcase }}
2224
labels:
23-
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
24-
app.kubernetes.io/name: {{ .Chart.Name }}
25-
app.kubernetes.io/instance: {{ .Release.Name }}
26-
app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
27-
app.kubernetes.io/managed-by: {{ .Release.Service }}
28-
{{- with .Values.service.annotations }}
25+
helm.sh/chart: {{ $.Chart.Name }}-{{ $.Chart.Version }}
26+
app.kubernetes.io/name: {{ $.Chart.Name }}
27+
app.kubernetes.io/instance: {{ $.Release.Name }}
28+
app.kubernetes.io/version: {{ $.Values.image.tag | default $.Chart.AppVersion | quote }}
29+
app.kubernetes.io/managed-by: {{ $.Release.Service }}
30+
{{- with $frontend.service.annotations }}
2931
annotations:
3032
{{- toYaml . | nindent 4 }}
3133
{{- end }}
3234
spec:
35+
type: {{ $frontend.service.type }}
3336
ports:
34-
- name: http
35-
nodePort: {{ .Values.service.port }}
36-
port: {{ .Values.server.bind.port }}
37-
protocol: TCP
38-
type: {{ .Values.service.type }}
37+
- name: {{ $name | kebabcase }}
38+
port: {{ tpl $frontend.service.port $ }}
39+
targetPort: {{ $frontend.port }}
40+
{{- if and (eq $frontend.service.type "NodePort") ($frontend.service.nodePort) }}
41+
nodePort: {{ $frontend.service.nodePort }}
42+
{{- end }}
3943
selector:
40-
app.kubernetes.io/name: {{ .Chart.Name }}
41-
app.kubernetes.io/instance: {{ .Release.Name }}
44+
app.kubernetes.io/name: {{ $.Chart.Name }}
45+
app.kubernetes.io/instance: {{ $.Release.Name }}
46+
---
47+
{{- end }}
48+
{{- end }}

charts/kyuubi/values.yaml

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,59 @@ probe:
5858
successThreshold: 1
5959

6060
server:
61-
bind:
62-
host: 0.0.0.0
61+
# Thrift Binary protocol (HiveServer2 compatible)
62+
thriftBinary:
63+
enabled: true
6364
port: 10009
64-
confDir: /opt/kyuubi/conf
65-
conf:
66-
# The value (templated string) is used for kyuubi-env.sh file
67-
# See https://kyuubi.apache.org/docs/latest/deployment/settings.html#environments for more details
68-
kyuubiEnv: ~
69-
70-
# The value (templated string) is used for kyuubi-defaults.conf file
71-
# See https://kyuubi.apache.org/docs/latest/deployment/settings.html#kyuubi-configurations for more details
72-
kyuubiDefaults: ~
73-
74-
# The value (templated string) is used for log4j2.xml file
75-
# See https://kyuubi.apache.org/docs/latest/deployment/settings.html#logging for more details
76-
log4j2: ~
65+
service:
66+
type: ClusterIP
67+
port: "{{ .Values.server.thriftBinary.port }}"
68+
nodePort: ~
69+
annotations: {}
70+
71+
# Thrift HTTP protocol (HiveServer2 compatible)
72+
thriftHttp:
73+
enabled: false
74+
port: 10010
75+
service:
76+
type: ClusterIP
77+
port: "{{ .Values.server.thriftHttp.port }}"
78+
nodePort: ~
79+
annotations: {}
80+
81+
# REST API protocol (experimental)
82+
rest:
83+
enabled: false
84+
port: 10099
85+
service:
86+
type: ClusterIP
87+
port: "{{ .Values.server.rest.port }}"
88+
nodePort: ~
89+
annotations: {}
90+
91+
# MySQL compatible text protocol (experimental)
92+
mysql:
93+
enabled: false
94+
port: 3309
95+
service:
96+
type: ClusterIP
97+
port: "{{ .Values.server.mysql.port }}"
98+
nodePort: ~
99+
annotations: {}
100+
101+
kyuubiConfDir: /opt/kyuubi/conf
102+
kyuubiConf:
103+
# The value (templated string) is used for kyuubi-env.sh file
104+
# See https://kyuubi.apache.org/docs/latest/deployment/settings.html#environments for more details
105+
kyuubiEnv: ~
106+
107+
# The value (templated string) is used for kyuubi-defaults.conf file
108+
# See https://kyuubi.apache.org/docs/latest/deployment/settings.html#kyuubi-configurations for more details
109+
kyuubiDefaults: ~
110+
111+
# The value (templated string) is used for log4j2.xml file
112+
# See https://kyuubi.apache.org/docs/latest/deployment/settings.html#logging for more details
113+
log4j2: ~
77114

78115
# Environment variables (templated)
79116
env: []
@@ -89,15 +126,6 @@ initContainers: []
89126
# Additional containers for Kyuubi pod (templated)
90127
containers: []
91128

92-
service:
93-
type: NodePort
94-
# The default port limit of kubernetes is 30000-32767
95-
# to change:
96-
# vim kube-apiserver.yaml (usually under path: /etc/kubernetes/manifests/)
97-
# add or change line 'service-node-port-range=1-32767' under kube-apiserver
98-
port: 30009
99-
annotations: {}
100-
101129
resources: {}
102130
# Used to specify resource, default unlimited.
103131
# If you do want to specify resources:

externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/shim/CatalogShim_v2_4.scala

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,7 @@ class CatalogShim_v2_4 extends SparkCatalogShim {
139139
databases.flatMap { db =>
140140
val identifiers = catalog.listTables(db, tablePattern, includeLocalTempViews = true)
141141
catalog.getTablesByName(identifiers).flatMap { t =>
142-
val tableSchema =
143-
if (t.provider.getOrElse("").equalsIgnoreCase("delta")) {
144-
spark.table(t.identifier.table).schema
145-
} else {
146-
t.schema
147-
}
148-
tableSchema.zipWithIndex.filter(f => columnPattern.matcher(f._1.name).matches())
142+
t.schema.zipWithIndex.filter(f => columnPattern.matcher(f._1.name).matches())
149143
.map { case (f, i) => toColumnResult(catalogName, t.database, t.identifier.table, f, i) }
150144
}
151145
}

externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/shim/CatalogShim_v3_0.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,6 @@ class CatalogShim_v3_0 extends CatalogShim_v2_4 {
188188
val catalog = getCatalog(spark, catalogName)
189189

190190
catalog match {
191-
case builtin if builtin.name() == SESSION_CATALOG =>
192-
super.getColumnsByCatalog(
193-
spark,
194-
SESSION_CATALOG,
195-
schemaPattern,
196-
tablePattern,
197-
columnPattern)
198-
199191
case tc: TableCatalog =>
200192
val namespaces = listNamespacesWithPattern(catalog, schemaPattern)
201193
val tp = tablePattern.r.pattern
@@ -210,6 +202,14 @@ class CatalogShim_v3_0 extends CatalogShim_v2_4 {
210202
table.schema.zipWithIndex.filter(f => columnPattern.matcher(f._1.name).matches())
211203
.map { case (f, i) => toColumnResult(tc.name(), namespace, tableName, f, i) }
212204
}
205+
206+
case builtin if builtin.name() == SESSION_CATALOG =>
207+
super.getColumnsByCatalog(
208+
spark,
209+
SESSION_CATALOG,
210+
schemaPattern,
211+
tablePattern,
212+
columnPattern)
213213
}
214214
}
215215
}

kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ class KyuubiSessionImpl(
105105

106106
private var _engineSessionHandle: SessionHandle = _
107107

108+
private var openSessionError: Option[Throwable] = None
109+
108110
override def open(): Unit = handleSessionException {
109111
traceMetricsOnOpen()
110112

@@ -170,6 +172,7 @@ class KyuubiSessionImpl(
170172
s"Opening engine [${engine.defaultEngineName} $host:$port]" +
171173
s" for $user session failed",
172174
e)
175+
openSessionError = Some(e)
173176
throw e
174177
} finally {
175178
attempt += 1
@@ -247,7 +250,7 @@ class KyuubiSessionImpl(
247250
try {
248251
if (_client != null) _client.closeSession()
249252
} finally {
250-
if (engine != null) engine.close()
253+
openSessionError.foreach { _ => if (engine != null) engine.close() }
251254
sessionEvent.endTime = System.currentTimeMillis()
252255
EventBus.post(sessionEvent)
253256
traceMetricsOnClose()

0 commit comments

Comments
 (0)