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

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


The following commit(s) were added to refs/heads/dev by this push:
     new 79b5f8c  [Improvement][K8s] Optimize ingress compatibility
     new 4706de7  Merge pull request #4902 from 
chengshiwen/improve-k8s-compatibility
79b5f8c is described below

commit 79b5f8c79158d587fc496bfaf182fdf5a963bedb
Author: chengshiwen <[email protected]>
AuthorDate: Sun Feb 28 12:08:44 2021 +0800

    [Improvement][K8s] Optimize ingress compatibility
---
 docker/kubernetes/dolphinscheduler/README.md       |  3 +--
 .../templates/deployment-dolphinscheduler-api.yaml |  2 +-
 .../dolphinscheduler/templates/ingress.yaml        | 22 ++++++++++++++++++----
 .../templates/svc-dolphinscheduler-api.yaml        |  4 ++--
 docker/kubernetes/dolphinscheduler/values.yaml     |  4 +---
 5 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/docker/kubernetes/dolphinscheduler/README.md 
b/docker/kubernetes/dolphinscheduler/README.md
index 0a5efe3..05bf24e 100644
--- a/docker/kubernetes/dolphinscheduler/README.md
+++ b/docker/kubernetes/dolphinscheduler/README.md
@@ -253,9 +253,8 @@ The Configuration file is `values.yaml`, and the following 
tables lists the conf
 |                                                                              
     |                                                                          
                                                      |                         
                              |
 | `ingress.enabled`                                                            
     | Enable ingress                                                           
                                                      | `false`                 
                              |
 | `ingress.host`                                                               
     | Ingress host                                                             
                                                      | `dolphinscheduler.org`  
                              |
-| `ingress.path`                                                               
     | Ingress path                                                             
                                                      | `/`                     
                              |
+| `ingress.path`                                                               
     | Ingress path                                                             
                                                      | `/dolphinscheduler`     
                              |
 | `ingress.tls.enabled`                                                        
     | Enable ingress tls                                                       
                                                      | `false`                 
                              |
-| `ingress.tls.hosts`                                                          
     | Ingress tls hosts                                                        
                                                      | `dolphinscheduler.org`  
                              |
 | `ingress.tls.secretName`                                                     
     | Ingress tls secret name                                                  
                                                      | `dolphinscheduler-tls`  
                              |
 
 ## FAQ
diff --git 
a/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml
 
b/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml
index f4b4795..f25a16a 100644
--- 
a/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml
+++ 
b/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml
@@ -69,7 +69,7 @@ spec:
             - "api-server"
           ports:
             - containerPort: 12345
-              name: tcp-port
+              name: "api-port"
           env:
             - name: TZ
               value: {{ .Values.timezone }}
diff --git a/docker/kubernetes/dolphinscheduler/templates/ingress.yaml 
b/docker/kubernetes/dolphinscheduler/templates/ingress.yaml
index 6edc82b..329ba2c 100644
--- a/docker/kubernetes/dolphinscheduler/templates/ingress.yaml
+++ b/docker/kubernetes/dolphinscheduler/templates/ingress.yaml
@@ -15,7 +15,13 @@
 # limitations under the License.
 #
 {{- if .Values.ingress.enabled }}
+{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
+apiVersion: networking.k8s.io/v1
+{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" 
}}
 apiVersion: networking.k8s.io/v1beta1
+{{- else }}
+apiVersion: extensions/v1beta1
+{{- end }}
 kind: Ingress
 metadata:
   name: {{ include "dolphinscheduler.fullname" . }}
@@ -30,14 +36,22 @@ spec:
       paths:
         - path: {{ .Values.ingress.path }}
           backend:
+            {{- if .Capabilities.APIVersions.Has 
"networking.k8s.io/v1/Ingress" }}
+            service:
+              name: {{ include "dolphinscheduler.fullname" . }}-api
+              port:
+                name: api-port
+            {{- else }}
             serviceName: {{ include "dolphinscheduler.fullname" . }}-api
-            servicePort: tcp-port
+            servicePort: api-port
+            {{- end }}
+          {{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" 
}}
+          pathType: Prefix
+          {{- end }}
   {{- if .Values.ingress.tls.enabled }}
   tls:
     hosts:
-      {{- range .Values.ingress.tls.hosts }}
-      - {{ . | quote }}
-    {{- end }}
+      - {{ .Values.ingress.host }}
     secretName: {{ .Values.ingress.tls.secretName }}
   {{- end }}
 {{- end }}
\ No newline at end of file
diff --git 
a/docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-api.yaml 
b/docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-api.yaml
index 4d07ade..5daa7c4 100644
--- a/docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-api.yaml
+++ b/docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-api.yaml
@@ -25,9 +25,9 @@ metadata:
 spec:
   ports:
     - port: 12345
-      targetPort: tcp-port
+      targetPort: api-port
       protocol: TCP
-      name: tcp-port
+      name: api-port
   selector:
     app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api
     app.kubernetes.io/instance: {{ .Release.Name }}
diff --git a/docker/kubernetes/dolphinscheduler/values.yaml 
b/docker/kubernetes/dolphinscheduler/values.yaml
index 99979af..b68dd65 100644
--- a/docker/kubernetes/dolphinscheduler/values.yaml
+++ b/docker/kubernetes/dolphinscheduler/values.yaml
@@ -390,9 +390,7 @@ api:
 ingress:
   enabled: false
   host: "dolphinscheduler.org"
-  path: "/"
+  path: "/dolphinscheduler"
   tls:
     enabled: false
-    hosts:
-      - "dolphinscheduler.org"
     secretName: "dolphinscheduler-tls"
\ No newline at end of file

Reply via email to