{{- if .Values.controller.route.enabled }}
apiVersion: route.openshift.io/v1
kind: Route
metadata:
  namespace: {{ template "jenkins.namespace" . }}
  labels:
    app: {{ template "jenkins.fullname" . }}
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
    component: "{{ .Release.Name }}-{{ .Values.controller.componentName }}"
    {{- include "jenkins.labels" . | nindent 4 }}
{{- if .Values.controller.route.labels }}
{{ toYaml .Values.controller.route.labels | indent 4 }}
{{- end }}
{{- if .Values.controller.route.annotations }}
  annotations:
{{ toYaml .Values.controller.route.annotations | indent 4 }}
{{- end }}
  name: {{ template "jenkins.fullname" . }}
spec:
  host: {{ .Values.controller.route.path }}
  port:
    targetPort: http
  tls:
    insecureEdgeTerminationPolicy: Redirect
    termination: edge
  to:
    kind: Service
    name: {{ template "jenkins.fullname" . }}
    weight: 100
  wildcardPolicy: None
{{- end }}
