This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 9b0938fae [KYUUBI #5631] [K8S][HELM] Set session affinity if needed in 
helm chart
9b0938fae is described below

commit 9b0938faeec75d1ef9a7b5384329d46a25a43d09
Author: hezhao2 <[email protected]>
AuthorDate: Wed Nov 22 12:14:27 2023 +0800

    [KYUUBI #5631] [K8S][HELM] Set session affinity if needed in helm chart
    
    ### _Why are the changes needed?_
    This can ensure that incoming requests from same client are forward to the 
same Kyuubi service instance in K8S. So this may be a workaround for users to 
get their session states during a period of time.
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [ ] [Run 
test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests)
 locally before make a pull request
    
    ### _Was this patch authored or co-authored using generative AI tooling?_
    
    No.
    
    Closes #5631 from zhaohehuhu/dev-1106.
    
    Closes #5631
    
    ba1a73301 [Cheng Pan] comments
    6f9d62927 [hezhao2] reformat
    db9e84215 [hezhao2] take toYaml approach
    d94354dc5 [hezhao2] refactor
    c5f055a97 [hezhao2] sync
    86955328d [hezhao2] set session affinity if needed
    
    Lead-authored-by: hezhao2 <[email protected]>
    Co-authored-by: Cheng Pan <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
---
 charts/kyuubi/templates/kyuubi-service.yaml |  6 ++++++
 charts/kyuubi/values.yaml                   | 28 ++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/charts/kyuubi/templates/kyuubi-service.yaml 
b/charts/kyuubi/templates/kyuubi-service.yaml
index 64c8b06ac..9d9362e86 100644
--- a/charts/kyuubi/templates/kyuubi-service.yaml
+++ b/charts/kyuubi/templates/kyuubi-service.yaml
@@ -37,6 +37,12 @@ spec:
       {{- end }}
   selector:
     {{- include "kyuubi.selectorLabels" $ | nindent 4 }}
+  {{- if ($frontend.service.sessionAffinity) }}
+  sessionAffinity: {{ $frontend.service.sessionAffinity }}
+  {{- end }}
+  {{- with $frontend.service.sessionAffinityConfig }}
+  sessionAffinityConfig: {{- toYaml . | nindent 4 }}
+  {{- end }}
 ---
 {{- end }}
 {{- end }}
diff --git a/charts/kyuubi/values.yaml b/charts/kyuubi/values.yaml
index faa854b10..044668040 100644
--- a/charts/kyuubi/values.yaml
+++ b/charts/kyuubi/values.yaml
@@ -85,6 +85,13 @@ server:
       port: "{{ .Values.server.thriftBinary.port }}"
       nodePort: ~
       annotations: {}
+      # candidates are ClientIP or None
+      # 
https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/
+      sessionAffinity: ~
+      sessionAffinityConfig: {}
+      #  sessionAffinityConfig:
+      #    clientIP:
+      #      timeoutSeconds: 10800
 
   # Thrift HTTP protocol (HiveServer2 compatible)
   thriftHttp:
@@ -95,6 +102,13 @@ server:
       port: "{{ .Values.server.thriftHttp.port }}"
       nodePort: ~
       annotations: {}
+      # candidates are ClientIP or None
+      # 
https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/
+      sessionAffinity: ~
+      sessionAffinityConfig: {}
+      #  sessionAffinityConfig:
+      #    clientIP:
+      #      timeoutSeconds: 10800
 
   # REST API protocol (experimental)
   rest:
@@ -105,6 +119,13 @@ server:
       port: "{{ .Values.server.rest.port }}"
       nodePort: ~
       annotations: {}
+      # candidates are ClientIP or None
+      # 
https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/
+      sessionAffinity: ~
+      sessionAffinityConfig: {}
+      #  sessionAffinityConfig:
+      #    clientIP:
+      #      timeoutSeconds: 10800
 
   # MySQL compatible text protocol (experimental)
   mysql:
@@ -115,6 +136,13 @@ server:
       port: "{{ .Values.server.mysql.port }}"
       nodePort: ~
       annotations: {}
+      # candidates are ClientIP or None
+      # 
https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/
+      sessionAffinity: ~
+      sessionAffinityConfig: {}
+      #  sessionAffinityConfig:
+      #    clientIP:
+      #      timeoutSeconds: 10800
 
 monitoring:
   # Exposes metrics in Prometheus format

Reply via email to