flower-ingress.yaml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Licensed to the Apache Software Foundation (ASF) under one
  2. # or more contributor license agreements. See the NOTICE file
  3. # distributed with this work for additional information
  4. # regarding copyright ownership. The ASF licenses this file
  5. # to you under the Apache License, Version 2.0 (the
  6. # "License"); you may not use this file except in compliance
  7. # with the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing,
  12. # software distributed under the License is distributed on an
  13. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. # KIND, either express or implied. See the License for the
  15. # specific language governing permissions and limitations
  16. # under the License.
  17. ################################
  18. ## Airflow Flower Ingress
  19. #################################
  20. {{- if .Values.flower.enabled }}
  21. {{- if and (or .Values.ingress.flower.enabled .Values.ingress.enabled) (or (eq .Values.executor "CeleryExecutor") (eq .Values.executor "CeleryKubernetesExecutor")) }}
  22. {{- $apiIsStable := semverCompare ">= 1.19.x" (include "kubeVersion" .) -}}
  23. {{- if $apiIsStable }}
  24. apiVersion: networking.k8s.io/v1
  25. {{- else }}
  26. apiVersion: networking.k8s.io/v1beta1
  27. {{- end }}
  28. kind: Ingress
  29. metadata:
  30. name: {{ .Release.Name }}-flower-ingress
  31. labels:
  32. tier: airflow
  33. component: flower-ingress
  34. release: {{ .Release.Name }}
  35. chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
  36. heritage: {{ .Release.Service }}
  37. {{- with .Values.labels }}
  38. {{- toYaml . | nindent 4 }}
  39. {{- end }}
  40. {{- with .Values.ingress.flower.annotations }}
  41. annotations:
  42. {{- toYaml . | nindent 4 }}
  43. {{- end }}
  44. spec:
  45. {{- if and .Values.ingress.flower.hosts (.Values.ingress.flower.hosts | first | kindIs "string" | not) }}
  46. {{- $anyTlsHosts := false -}}
  47. {{- range .Values.ingress.flower.hosts }}
  48. {{- if .tls }}
  49. {{- if .tls.enabled }}
  50. {{- $anyTlsHosts = true -}}
  51. {{- end }}
  52. {{- end }}
  53. {{- end }}
  54. {{- if $anyTlsHosts }}
  55. tls:
  56. {{- range .Values.ingress.flower.hosts }}
  57. {{- if .tls }}
  58. {{- if .tls.enabled }}
  59. - hosts:
  60. - {{ .name | quote }}
  61. secretName: {{ .tls.secretName }}
  62. {{- end }}
  63. {{- end }}
  64. {{- end }}
  65. {{- end }}
  66. {{- else if .Values.ingress.flower.tls.enabled }}
  67. tls:
  68. - hosts:
  69. {{- .Values.ingress.flower.hosts | default (list .Values.ingress.flower.host) | toYaml | nindent 8 }}
  70. secretName: {{ .Values.ingress.flower.tls.secretName }}
  71. {{- end }}
  72. rules:
  73. {{- range .Values.ingress.flower.hosts | default (list .Values.ingress.flower.host) }}
  74. - http:
  75. paths:
  76. - backend:
  77. {{- if $apiIsStable }}
  78. service:
  79. name: {{ $.Release.Name }}-flower
  80. port:
  81. name: flower-ui
  82. {{- else }}
  83. serviceName: {{ $.Release.Name }}-flower
  84. servicePort: flower-ui
  85. {{- end }}
  86. {{- if $.Values.ingress.flower.path }}
  87. path: {{ $.Values.ingress.flower.path }}
  88. {{- if $apiIsStable }}
  89. pathType: {{ $.Values.ingress.flower.pathType }}
  90. {{- end }}
  91. {{- end }}
  92. {{- $hostname := . -}}
  93. {{- if . | kindIs "string" | not }}
  94. {{- $hostname = .name -}}
  95. {{- end }}
  96. {{- if $hostname }}
  97. host: {{ $hostname | quote }}
  98. {{- end }}
  99. {{- end }}
  100. {{- if and .Values.ingress.flower.ingressClassName $apiIsStable }}
  101. ingressClassName: {{ .Values.ingress.flower.ingressClassName }}
  102. {{- end }}
  103. {{- end }}
  104. {{- end }}