# helm_charts_ingress-www.yaml
{{- if and .Values.ingress.enabled .Values.ingress.subdomainWWW }}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
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 }}