rancher-partner-charts/charts/cockroachdb/templates/ingress.yaml

52 lines
1.5 KiB
YAML

{{- if .Values.ingress.enabled -}}
{{- $paths := .Values.ingress.paths -}}
{{- $ports := .Values.service.ports -}}
{{- $fullName := include "cockroachdb.fullname" . -}}
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
{{- if .Values.ingress.annotations }}
annotations:
{{- range $key, $value := .Values.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
name: {{ $fullName }}-ingress
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: {{ template "cockroachdb.chart" . }}
app.kubernetes.io/name: {{ template "cockroachdb.name" . }}
app.kubernetes.io/instance: {{ $.Release.Name | quote }}
app.kubernetes.io/managed-by: {{ $.Release.Service | quote }}
{{- if .Values.ingress.labels }}
{{- toYaml .Values.ingress.labels | nindent 4 }}
{{- end }}
spec:
rules:
{{- if .Values.ingress.hosts }}
{{- range $host := .Values.ingress.hosts }}
- host: {{ $host }}
http:
paths:
{{- range $path := $paths }}
- path: {{ $path }}
backend:
serviceName: {{ $fullName }}-public
servicePort: {{ $ports.http.name | quote }}
{{- end -}}
{{- end -}}
{{- else }}
- http:
paths:
{{- range $path := $paths }}
- path: {{ $path }}
backend:
serviceName: {{ $fullName }}-public
servicePort: {{ $ports.http.name | quote }}
{{- end -}}
{{- end -}}
{{- if .Values.ingress.tls }}
tls:
{{- toYaml .Values.ingress.tls | nindent 4 }}
{{- end -}}
{{- end -}}