ui-ingress.yaml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # Licensed to the Apache Software Foundation (ASF) under one or more
  2. # contributor license agreements. See the NOTICE file distributed with
  3. # this work for additional information regarding copyright ownership.
  4. # The ASF licenses this file to You under the Apache License, Version 2.0
  5. # (the "License"); you may not use this file except in compliance with
  6. # the License. You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. {{- if .Values.ui.ingress.enabled }}
  16. {{- $serviceName := include "skywalking.ui.fullname" . }}
  17. {{- $servicePort := .Values.ui.service.externalPort }}
  18. {{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
  19. apiVersion: networking.k8s.io/v1
  20. {{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" }}
  21. apiVersion: networking.k8s.io/v1beta1
  22. {{- else }}
  23. apiVersion: extensions/v1beta1
  24. {{- end }}
  25. kind: Ingress
  26. metadata:
  27. labels:
  28. app: {{ template "skywalking.name" . }}
  29. chart: {{ .Chart.Name }}-{{ .Chart.Version }}
  30. component: "{{ .Values.ui.name }}"
  31. heritage: {{ .Release.Service }}
  32. release: {{ .Release.Name }}
  33. name: {{ template "skywalking.ui.fullname" . }}
  34. annotations:
  35. {{- range $key, $value := .Values.ui.ingress.annotations }}
  36. {{ $key }}: {{ $value | quote }}
  37. {{- end }}
  38. spec:
  39. rules:
  40. {{- range .Values.ui.ingress.hosts }}
  41. {{- $url := splitList "/" . }}
  42. - host: {{ first $url }}
  43. http:
  44. paths:
  45. - path: /{{ rest $url | join "/" }}
  46. backend:
  47. {{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
  48. service:
  49. name: {{ $serviceName }}
  50. port:
  51. number: {{ $servicePort }}
  52. {{- else }}
  53. serviceName: {{ $serviceName }}
  54. servicePort: {{ $servicePort }}
  55. {{- end }}
  56. {{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
  57. pathType: Prefix
  58. {{- end }}
  59. {{- end -}}
  60. {{- if .Values.ui.ingress.tls }}
  61. tls:
  62. {{ toYaml .Values.ui.ingress.tls | indent 4 }}
  63. {{- end -}}
  64. {{- end }}