{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: {{ include "influxdb.fullname" . }}
  labels:
    {{- include "influxdb.labels" . | nindent 4 }}
  annotations:
{{ toYaml .Values.ingress.annotations | indent 4 }}
spec:
{{- if .Values.ingress.tls }}
  tls:
    - hosts:
      - {{ .Values.ingress.hostname | quote }}
      secretName: {{ .Values.ingress.secretName }}
{{- end }}
  rules:
  - host: {{ .Values.ingress.hostname }}
    http:
      paths:
      - path: /
        backend:
          serviceName: {{ include "influxdb.fullname" . }}
          servicePort: 8086
{{- end -}}
