{{- if .Values.ingress.enabled -}} {{- $serviceName := include "sonarqube.fullname" . -}} {{- $servicePort := .Values.service.externalPort -}} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: {{ template "sonarqube.fullname" . }} labels: app: {{ template "sonarqube.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} {{- if .Values.ingress.labels }} {{ .Values.ingress.labels | toYaml | trimSuffix "\n"| indent 4 -}} {{- end}} {{- with .Values.labels }} {{- toYaml . | nindent 4 }} {{- end }} {{- if or .Values.ingress.annotations .Values.nginx.enabled}} annotations: {{- range $key, $value := .Values.ingress.annotations }} {{ $key }}: {{ $value | quote }} {{- end }} {{- if and .Values.nginx.enabled (not (hasKey (.Values.ingress.annotations) "nginx.ingress.kubernetes.io/proxy-body-size")) }} nginx.ingress.kubernetes.io/proxy-body-size: "64m" {{- end -}} {{- end }} spec: {{- if .Values.ingress.ingressClassName }} ingressClassName: {{ .Values.ingress.ingressClassName }} {{- end }} rules: {{- range .Values.ingress.hosts }} - host: {{ printf "%s" .name }} http: paths: - backend: service: name: {{ default $serviceName .serviceName }} port: number: {{ default $servicePort .servicePort }} path: {{ .path | default (include "sonarqube.webcontext" $) }} pathType: {{ default "ImplementationSpecific" .pathType }} {{- end }} {{- if .Values.ingress.tls }} tls: {{ toYaml .Values.ingress.tls | indent 4 }} {{- end -}} {{- end }}