ingress.yaml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. {{- /*
  2. Copyright Broadcom, Inc. All Rights Reserved.
  3. SPDX-License-Identifier: APACHE-2.0
  4. */}}
  5. {{- if .Values.ingress.enabled }}
  6. apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
  7. kind: Ingress
  8. metadata:
  9. name: {{ include "common.names.fullname" . }}
  10. namespace: {{ .Release.Namespace | quote }}
  11. labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
  12. {{- if or .Values.ingress.annotations .Values.commonAnnotations }}
  13. {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.ingress.annotations .Values.commonAnnotations ) "context" . ) }}
  14. annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
  15. {{- end }}
  16. spec:
  17. {{- if and .Values.ingress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }}
  18. ingressClassName: {{ .Values.ingress.ingressClassName | quote }}
  19. {{- end }}
  20. rules:
  21. {{- if .Values.ingress.hostname }}
  22. - host: {{ .Values.ingress.hostname | quote }}
  23. http:
  24. paths:
  25. {{- if .Values.ingress.extraPaths }}
  26. {{- toYaml .Values.ingress.extraPaths | nindent 10 }}
  27. {{- end }}
  28. - path: {{ .Values.ingress.path }}
  29. {{- if eq "true" (include "common.ingress.supportsPathType" .) }}
  30. pathType: {{ .Values.ingress.pathType }}
  31. {{- end }}
  32. backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" .) "servicePort" "http" "context" $) | nindent 14 }}
  33. {{- end }}
  34. {{- range .Values.ingress.extraHosts }}
  35. - host: {{ .name | quote }}
  36. http:
  37. paths:
  38. - path: {{ default "/" .path }}
  39. {{- if eq "true" (include "common.ingress.supportsPathType" $) }}
  40. pathType: {{ default "ImplementationSpecific" .pathType }}
  41. {{- end }}
  42. backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" $) "servicePort" "http" "context" $) | nindent 14 }}
  43. {{- end }}
  44. {{- if .Values.ingress.extraRules }}
  45. {{- include "common.tplvalues.render" (dict "value" .Values.ingress.extraRules "context" $) | nindent 4 }}
  46. {{- end }}
  47. {{- if or (and .Values.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.ingress.annotations )) .Values.ingress.selfSigned)) .Values.ingress.extraTls }}
  48. tls:
  49. {{- if and .Values.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.ingress.annotations )) .Values.ingress.selfSigned) }}
  50. - hosts:
  51. - {{ .Values.ingress.hostname | quote }}
  52. secretName: {{ printf "%s-tls" .Values.ingress.hostname }}
  53. {{- end }}
  54. {{- if .Values.ingress.extraTls }}
  55. {{- include "common.tplvalues.render" (dict "value" .Values.ingress.extraTls "context" $) | nindent 4 }}
  56. {{- end }}
  57. {{- end }}
  58. {{- end }}