1
0

ingress-configservice.yaml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #
  2. # Copyright 2021 Apollo Authors
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # 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. #
  16. {{- if .Values.configService.ingress.enabled -}}
  17. {{- $fullName := include "apollo.configService.fullName" . -}}
  18. {{- $svcPort := .Values.configService.service.port -}}
  19. {{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion }}
  20. apiVersion: networking.k8s.io/v1beta1
  21. {{- else }}
  22. apiVersion: extensions/v1beta1
  23. {{- end }}
  24. kind: Ingress
  25. metadata:
  26. name: {{ $fullName }}
  27. labels:
  28. {{- include "apollo.service.labels" . | nindent 4 }}
  29. {{- with .Values.configService.ingress.annotations }}
  30. annotations:
  31. {{- toYaml . | nindent 4 }}
  32. {{- end }}
  33. spec:
  34. {{- if .Values.configService.ingress.tls }}
  35. tls:
  36. {{- range .Values.configService.ingress.tls }}
  37. - hosts:
  38. {{- range .hosts }}
  39. - {{ . | quote }}
  40. {{- end }}
  41. secretName: {{ .secretName }}
  42. {{- end }}
  43. {{- end }}
  44. rules:
  45. {{- range .Values.configService.ingress.hosts }}
  46. - host: {{ .host | quote }}
  47. http:
  48. paths:
  49. {{- range .paths }}
  50. - path: {{ . }}
  51. backend:
  52. serviceName: {{ $fullName }}
  53. servicePort: {{ $svcPort }}
  54. {{- end }}
  55. {{- end }}
  56. {{- end }}