Browse Source

[Improvement][K8s] Optimize ingress compatibility

pull/3/MERGE
chengshiwen 4 years ago
parent
commit
79b5f8c791
  1. 3
      docker/kubernetes/dolphinscheduler/README.md
  2. 2
      docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml
  3. 22
      docker/kubernetes/dolphinscheduler/templates/ingress.yaml
  4. 4
      docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-api.yaml
  5. 4
      docker/kubernetes/dolphinscheduler/values.yaml

3
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.enabled` | Enable ingress | `false` |
| `ingress.host` | Ingress host | `dolphinscheduler.org` | | `ingress.host` | Ingress host | `dolphinscheduler.org` |
| `ingress.path` | Ingress path | `/` | | `ingress.path` | Ingress path | `/dolphinscheduler` |
| `ingress.tls.enabled` | Enable ingress tls | `false` | | `ingress.tls.enabled` | Enable ingress tls | `false` |
| `ingress.tls.hosts` | Ingress tls hosts | `dolphinscheduler.org` |
| `ingress.tls.secretName` | Ingress tls secret name | `dolphinscheduler-tls` | | `ingress.tls.secretName` | Ingress tls secret name | `dolphinscheduler-tls` |
## FAQ ## FAQ

2
docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml

@ -69,7 +69,7 @@ spec:
- "api-server" - "api-server"
ports: ports:
- containerPort: 12345 - containerPort: 12345
name: tcp-port name: "api-port"
env: env:
- name: TZ - name: TZ
value: {{ .Values.timezone }} value: {{ .Values.timezone }}

22
docker/kubernetes/dolphinscheduler/templates/ingress.yaml

@ -15,7 +15,13 @@
# limitations under the License. # limitations under the License.
# #
{{- if .Values.ingress.enabled }} {{- 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 apiVersion: networking.k8s.io/v1beta1
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ include "dolphinscheduler.fullname" . }} name: {{ include "dolphinscheduler.fullname" . }}
@ -30,14 +36,22 @@ spec:
paths: paths:
- path: {{ .Values.ingress.path }} - path: {{ .Values.ingress.path }}
backend: 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 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 }} {{- if .Values.ingress.tls.enabled }}
tls: tls:
hosts: hosts:
{{- range .Values.ingress.tls.hosts }} - {{ .Values.ingress.host }}
- {{ . | quote }}
{{- end }}
secretName: {{ .Values.ingress.tls.secretName }} secretName: {{ .Values.ingress.tls.secretName }}
{{- end }} {{- end }}
{{- end }} {{- end }}

4
docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-api.yaml

@ -25,9 +25,9 @@ metadata:
spec: spec:
ports: ports:
- port: 12345 - port: 12345
targetPort: tcp-port targetPort: api-port
protocol: TCP protocol: TCP
name: tcp-port name: api-port
selector: selector:
app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}

4
docker/kubernetes/dolphinscheduler/values.yaml

@ -390,9 +390,7 @@ api:
ingress: ingress:
enabled: false enabled: false
host: "dolphinscheduler.org" host: "dolphinscheduler.org"
path: "/" path: "/dolphinscheduler"
tls: tls:
enabled: false enabled: false
hosts:
- "dolphinscheduler.org"
secretName: "dolphinscheduler-tls" secretName: "dolphinscheduler-tls"
Loading…
Cancel
Save