{{- if and .Values.ingress.enabled .Values.ingress.subdomainWWW }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ template "lamp.fullname" . }}-www
  annotations:
    {{- if .Values.ingress.ssl }}
    kubernetes.io/tls-acme: "true"
    {{- end }}
    {{- if .Values.ingress.htpasswdString }}
    ingress.kubernetes.io/auth-type: basic
    ingress.kubernetes.io/auth-secret: {{ template "lamp.fullname" . }}
    ingress.kubernetes.io/auth-realm: "Authenticate"
    {{- end }}
{{ toYaml .Values.ingress.annotations | indent 4 }}
spec:
  {{- if .Values.ingress.ssl }}
  tls:
  - secretName: {{ template "lamp.fullname" . }}-tls-www
    hosts:
    - www.{{ template "lamp.domain" . }}
  {{- end }}
  rules:
  - host: www.{{ template "lamp.domain" . }}
    http:
      paths:
      - path: /
        backend:
          serviceName: {{ template "lamp.fullname" . }}
          servicePort: {{ .Values.service.HTTPPort }}
{{- end }}
