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

linying pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git


The following commit(s) were added to refs/heads/dev by this push:
     new 81c73c350 [ISSUE-2988][Bug] Update helm template, fix streampark on 
k8s failed  (#2990)
81c73c350 is described below

commit 81c73c3503fa835fe1265a3dfebe6fd7a3c1883d
Author: blackCat <[email protected]>
AuthorDate: Tue Aug 29 16:57:23 2023 +0800

    [ISSUE-2988][Bug] Update helm template, fix streampark on k8s failed  
(#2990)
    
    * fix ws:xxx fail
    
    * code style improvement
    
    * update helm templete & fix bug
    
    * Update README.md
    
    ---------
    
    Co-authored-by: benjobs <[email protected]>
---
 deploy/helm/README.md                              | 19 +++++++
 deploy/helm/streampark/templates/ingress.yaml      | 20 +++++---
 deploy/helm/streampark/templates/streampark.yml    | 19 +++----
 deploy/helm/streampark/values.yaml                 | 60 +++++++++++++++++-----
 .../src/main/assembly/bin/streampark.sh            |  5 +-
 5 files changed, 88 insertions(+), 35 deletions(-)

diff --git a/deploy/helm/README.md b/deploy/helm/README.md
new file mode 100644
index 000000000..69564ea60
--- /dev/null
+++ b/deploy/helm/README.md
@@ -0,0 +1,19 @@
+# Deploy StreamPark on k8s
+
+### 1. create template
+
+```shell
+helm template streampark/ -n default -f streampark/values.yaml --output-dir 
./result
+```
+
+### 2. apply 
+
+```shell
+kubectl apply -f result/streampark/templates
+```
+
+### 3. open WebUI
+
+http://${host}:10000
+
+#### [more detail](streampark/templates/NOTES.txt)
diff --git a/deploy/helm/streampark/templates/ingress.yaml 
b/deploy/helm/streampark/templates/ingress.yaml
index 5c9ca778c..e4b99d23c 100644
--- a/deploy/helm/streampark/templates/ingress.yaml
+++ b/deploy/helm/streampark/templates/ingress.yaml
@@ -15,23 +15,27 @@
 # limitations under the License.
 #
 {{- if .Values.ingress.enabled }}
-apiVersion: networking.k8s.io/v1beta1
+apiVersion: networking.k8s.io/v1
 kind: Ingress
 metadata:
   name: {{ include "streampark.name" . }}
+  namespace: {{ .Release.Namespace }}
   labels:
   {{- include "streampark.labels" . | nindent 4 }}
   annotations:
-    nginx.ingress.kubernetes.io/configuration-snippet: {{ 
.Values.nginx.ingress.kubernetes.configurationSnippet }}
-    nginx.ingress.kubernetes.io/proxy-body-size: {{ 
.Values.nginx.ingress.kubernetes.proxyBbodySize }}
-    nginx.ingress.kubernetes.io/rewrite-target: {{ 
.Values.nginx.ingress.kubernetes.rewriteTarget }}
+    {{- with .Values.ingress.annotations }}
+    {{- toYaml . | nindent 4 }}
+    {{- end }}
 spec:
   rules:
     - host: {{ .Values.ingress.host }}
       http:
         paths:
-        - backend:
-            serviceName: {{ .Values.service.name }}
-            servicePort: {{ .Values.spec.name }}
-          path: {{ .Values.ingress.path }}
+          - backend:
+              service:
+                name: {{ .Values.service.name }}
+                port:
+                  name: {{ .Values.spec.name }}
+            path: {{ .Values.ingress.path }}
+            pathType: {{ .Values.ingress.pathType }}
 {{- end }}
diff --git a/deploy/helm/streampark/templates/streampark.yml 
b/deploy/helm/streampark/templates/streampark.yml
index 5d7bcb916..fa8a5d4df 100755
--- a/deploy/helm/streampark/templates/streampark.yml
+++ b/deploy/helm/streampark/templates/streampark.yml
@@ -22,7 +22,7 @@ metadata:
   labels:
     {{- include "streampark.labels" . | nindent 4 }}
 spec:
-  replicas: {{ .Values.replicaCount}}
+  replicas: {{ .Values.spec.replicaCount }}
   selector:
     matchLabels:
       {{- include "streampark.selectorLabels" . | nindent 6 }}
@@ -57,11 +57,10 @@ spec:
               containerPort: {{ .Values.spec.containerPort }}
               protocol: TCP
           env:
-            - name: TZ
-              value: {{ .Values.timezone }}
+            {{- toYaml .Values.spec.container.env | nindent 12 }}
           securityContext:
             privileged: false
-          command: ["bash","-c","bash bin/startup.sh"]
+          command: ["bash","-c","bash ./bin/streampark.sh start_docker"]
           {{- if .Values.spec.livenessProbe.enabled }}
           livenessProbe:
             exec:
@@ -83,11 +82,10 @@ spec:
             failureThreshold: {{ .Values.spec.readinessProbe.failureThreshold 
}}
           {{- end }}
           volumeMounts:
-            - name: volume-docker
-              mountPath: /var/run/docker.sock
-              readOnly: true
             - name: streampark-default-config-volume
-              mountPath: /streampark/conf
+              mountPath: /usr/local/service/streampark/conf
+          resources:
+          {{- toYaml .Values.spec.resources | nindent 12 }}
       volumes:
         - name: streampark-default-config-volume
           configMap:
@@ -109,9 +107,6 @@ spec:
                 path: spy.properties
               - key: ValidationMessages.properties
                 path: ValidationMessages.properties
-        - name: volume-docker
-          hostPath:
-            path: /var/run/docker.sock
-            type: ""
+
 
 
diff --git a/deploy/helm/streampark/values.yaml 
b/deploy/helm/streampark/values.yaml
index 915811c03..a8e439247 100644
--- a/deploy/helm/streampark/values.yaml
+++ b/deploy/helm/streampark/values.yaml
@@ -18,18 +18,40 @@
 # When enabled RBAC is only created for said namespaces, otherwise it is done 
for the cluster scope.
 # watchNamespaces: ["streampark"]
 
-timezone: "Asia/Shanghai"
-
 image:
   repository: "apache/streampark"
   pullPolicy: "IfNotPresent"
-  tag: "2.2.0-SNAPSHOT"
+  tag: "2.1.1"
   pullSecret: ""
 
 rbac:
   create: true
 
 spec:
+  container:
+    env: [
+      {
+        name: TZ,
+        value: "Asia/Shanghai"
+      },
+      {
+        name: DOCKER_HOST,
+        value: "tcp://localhost:2375"
+      },
+      {
+        name: LANG,
+        value: en_US.UTF-8
+      },
+      {
+        name: LANGUAGE,
+        value: en_US:en
+      },
+      {
+        name: LC_ALL,
+        value: en_US.UTF-8
+      }
+    ]
+
   replicaCount: 1
   containerPort: 10000
   name: rest
@@ -42,7 +64,17 @@ spec:
   tolerations: [ ]
   ## Affinity is a group of affinity scheduling rules. If specified, the pod's 
scheduling constraints.
   ## More info: 
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#affinity-v1-core
-  resources: { }
+  resources: {
+    limits: {
+      memory: "1Gi",
+      cpu: "1"
+    },
+    requests: {
+      memory: "1Gi",
+      cpu: "1"
+    }
+  }
+
   # resources:
   #   limits:
   #     memory: "2Gi"
@@ -72,10 +104,18 @@ spec:
     successThreshold: "1"
 
 ingress:
-  enabled: false
+  enabled: true
   host: "streampark.apache.org"
-  path: "/streampark"
-  annotations: {}
+  path: "/streampark(/|$)(.*)"
+  pathType: "ImplementationSpecific"
+  annotations: {
+    nginx.ingress.kubernetes.io/rewrite-target: "/$2",
+    nginx.ingress.kubernetes.io/proxy-body-size: "1024m",
+    ## fix swagger 404: 
https://github.com/springdoc/springdoc-openapi/issues/1741
+    ## add rewrite ^/v3/(.*)$ /streampark/v3/$1 redirect;
+    nginx.ingress.kubernetes.io/configuration-snippet: 'rewrite 
^(/streampark)$ $1/ permanent;',
+    kubernetes.io/ingress.class: "nginx"
+  }
 
 service:
   ## type determines how the Service is exposed. Defaults to ClusterIP. Valid 
options are ExternalName, ClusterIP, NodePort, and LoadBalancer
@@ -96,9 +136,3 @@ streamParkServiceAccount:
   annotations: {}
   name: "streampark"
 
-nginx:
-  ingress:
-    kubernetes:
-      configurationSnippet: "rewrite ^(/streampark)$ $1/ permanent;"
-      proxyBbodySize: "1024m"
-      rewriteTarget: "/$2"
diff --git 
a/streampark-console/streampark-console-service/src/main/assembly/bin/streampark.sh
 
b/streampark-console/streampark-console-service/src/main/assembly/bin/streampark.sh
index 84d2247f9..7e7c31545 100755
--- 
a/streampark-console/streampark-console-service/src/main/assembly/bin/streampark.sh
+++ 
b/streampark-console/streampark-console-service/src/main/assembly/bin/streampark.sh
@@ -622,11 +622,12 @@ main() {
         echo_r "Unknown command: $1"
         echo_w "Usage: streampark.sh ( commands ... )"
         echo_w "commands:"
-        echo_w "  start \$conf               Start StreamPark with application 
config."
+        echo_w "  start \$conf              Start StreamPark with application 
config."
         echo_w "  stop                      Stop StreamPark, wait up to 3 
seconds and then use kill -KILL if still running"
+        echo_w "  start_docker              start in docker or k8s mode"
         echo_w "  status                    StreamPark status"
         echo_w "  debug                     StreamPark start with debug 
mode,start debug mode, like: bash streampark.sh debug 10002"
-        echo_w "  restart \$conf             restart StreamPark with 
application config."
+        echo_w "  restart \$conf            restart StreamPark with 
application config."
         exit 0
         ;;
   esac

Reply via email to