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 f0d256a15 [KYUUBI #4788][K8S][HELM] Use StatefulSet instead of 
Deployment
f0d256a15 is described below

commit f0d256a15bb4db2a50f5cd73efb6e3c6173e20e2
Author: camper42 <[email protected]>
AuthorDate: Tue Aug 1 22:12:11 2023 +0800

    [KYUUBI #4788][K8S][HELM] Use StatefulSet instead of Deployment
    
    ### _Why are the changes needed?_
    
    Use StatefulSet instead of Deployment, add a headless service for 
statefulset
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [x] Add screenshots for manual tests if appropriate
    
    - [x] [Run 
test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests)
 locally before make a pull request
    
    
![image](https://github.com/apache/kyuubi/assets/3177898/0991c287-cf1a-40f1-8e50-3934bd2886ca)
    
![image](https://github.com/apache/kyuubi/assets/3177898/9a5d11a5-2ac9-468e-bfcb-9a070f54c6b4)
    
    Closes #5062 from camper42/statefulset.
    
    Closes #4788
    
    a1a7f1b0e [camper42] style: remove redudant Global variable `$`
    5286f4ff4 [camper42] fix: set statefulset podManagementPolicy
    ed83ae2e8 [camper42] style: move headless service to separate file
    97b76ea24 [camper42] use `clusterIP: None` for headless serivce
    d2078ffe5 [Cheng Pan] Update charts/kyuubi/templates/kyuubi-statefulset.yaml
    35c7e0f90 [Cheng Pan] Update charts/kyuubi/templates/kyuubi-statefulset.yaml
    8d970d21d [camper42] style: indent
    3cf22748f [camper42] [KYUUBI #4788][K8S][HELM] Use StatefulSet instead of 
Deployment
    
    Lead-authored-by: camper42 <[email protected]>
    Co-authored-by: Cheng Pan <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
---
 .../kyuubi/templates/kyuubi-headless-service.yaml  | 35 ++++++++++++++++++++++
 ...ubi-deployment.yaml => kyuubi-statefulset.yaml} | 11 +++++--
 charts/kyuubi/values.yaml                          | 20 +++++++++++++
 3 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/charts/kyuubi/templates/kyuubi-headless-service.yaml 
b/charts/kyuubi/templates/kyuubi-headless-service.yaml
new file mode 100644
index 000000000..895859bac
--- /dev/null
+++ b/charts/kyuubi/templates/kyuubi-headless-service.yaml
@@ -0,0 +1,35 @@
+{{/*
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/}}
+
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ .Release.Name }}-headless
+  labels:
+    {{- include "kyuubi.labels" $ | nindent 4 }}
+spec:
+  type: ClusterIP
+  clusterIP: None
+  ports:
+    {{- range $name, $frontend := .Values.server }}
+    - name: {{ $name | kebabcase }}
+      port: {{ tpl $frontend.service.port $ }}
+      targetPort: {{ $frontend.port }}
+    {{- end }}
+  selector:
+    {{- include "kyuubi.selectorLabels" $ | nindent 4 }}
+
diff --git a/charts/kyuubi/templates/kyuubi-deployment.yaml 
b/charts/kyuubi/templates/kyuubi-statefulset.yaml
similarity index 93%
rename from charts/kyuubi/templates/kyuubi-deployment.yaml
rename to charts/kyuubi/templates/kyuubi-statefulset.yaml
index a81ec01e9..626796a78 100644
--- a/charts/kyuubi/templates/kyuubi-deployment.yaml
+++ b/charts/kyuubi/templates/kyuubi-statefulset.yaml
@@ -16,16 +16,23 @@
 */}}
 
 apiVersion: apps/v1
-kind: Deployment
+kind: StatefulSet
 metadata:
   name: {{ .Release.Name }}
   labels:
     {{- include "kyuubi.labels" . | nindent 4 }}
 spec:
-  replicas: {{ .Values.replicaCount }}
   selector:
     matchLabels:
       {{- include "kyuubi.selectorLabels" . | nindent 6 }}
+  serviceName: {{ .Release.Name }}-headless
+  minReadySeconds: {{ .Values.minReadySeconds }}
+  replicas: {{ .Values.replicaCount }}
+  revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
+  podManagementPolicy: {{ .Values.podManagementPolicy }}
+  {{- with .Values.updateStrategy }}
+  updateStrategy: {{- toYaml . | nindent 4 }}
+  {{- end }}
   template:
     metadata:
       labels:
diff --git a/charts/kyuubi/values.yaml b/charts/kyuubi/values.yaml
index f239e18a3..940a7c80e 100644
--- a/charts/kyuubi/values.yaml
+++ b/charts/kyuubi/values.yaml
@@ -22,6 +22,26 @@
 # Kyuubi server numbers
 replicaCount: 2
 
+# controls how Kyuubi server pods are created during initial scale up,
+# when replacing pods on nodes, or when scaling down.
+# The default policy is `OrderedReady`, alternative policy is `Parallel`.
+podManagementPolicy: OrderedReady
+
+# Minimum number of seconds for which a newly created kyuubi server
+# should be ready without any of its container crashing for it to be 
considered available.
+minReadySeconds: 30
+
+# maximum number of revisions that will be maintained in the StatefulSet's 
revision history.
+revisionHistoryLimit: 10
+
+# indicates the StatefulSetUpdateStrategy that will be employed to update 
Kyuubi server Pods in the StatefulSet
+# when a revision is made to Template.
+updateStrategy:
+  type: RollingUpdate
+  rollingUpdate:
+    maxUnavailable: 1
+    partition: 0
+
 image:
   repository: apache/kyuubi
   pullPolicy: IfNotPresent

Reply via email to