Skip to content
Snippets Groups Projects
ingress.yaml 1.18 KiB
Newer Older
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "wordpress.fullname" . -}}
{{- $ingressPath := .Values.ingress.path -}}
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: {{ $fullName }}
  labels:
    app: {{ include "wordpress.name" . }}
    chart: {{ include "wordpress.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
  annotations:
{{ toYaml . | indent 4 }}
{{- if .Values.mu_cron.enabled }}
    # Deny any traffic to the cronjob path that goes through ingress
    # (i.e. external traffic)
    nginx.org/server-snippets: |-
      location {{ .Values.mu_cron.cronjob.path }}{
          deny all;
      }
{{- end }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
  tls:
  {{- range .Values.ingress.tls }}
    - hosts:
      {{- range .hosts }}
        - {{ . | quote }}
      {{- end }}
      secretName: {{ .secretName }}
  {{- end }}
{{- end }}
  rules:
  {{- range .Values.ingress.hosts }}
    - host: {{ . | quote }}
      http:
        paths:
          - path: {{ $ingressPath }}
            backend:
              serviceName: {{ $fullName }}
              servicePort: http
  {{- end }}
{{- end }}