apiVersion: route.openshift.io/v1
kind: Route
metadata:
  name: {{ template "landing.routename" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    app: {{ template "landing.name" . }}
spec:
  host: {{ .Values.ingress.host }}
  to:
    kind: Service
    name: {{ template "landing.name" . }}
  port:
    targetPort: 8080
  tls:
    termination: edge
    insecureEdgeTerminationPolicy: Redirect
    {{- if and (hasKey .Values "tls") (hasKey .Values.tls "enabled") .Values.tls.enabled (hasKey .Values.tls "secretName") }}
    # Use the secret name directly in the route so OpenShift knows which certificate to use
    destinationCACertificate: ""
    {{- end }}
