apiVersion: v1
kind: Route
metadata:
  name: <%= @route['name'] %>
<% if @route.has_key?('labels') %>
  labels:
  <% @route['labels'].each_pair do |k, v| %>
    <%= k %>: <%= v %>
  <%- end -%>
<%- end -%>
spec:
  host: <% @route['host'] %>
  to:
<% @route['to'].each_pair do |k, v| %>
    <%= k %>: <%= v %>
<%- end -%>
<% if @route.has_key?('tls') %>
  tls:
    termination: <%= @route['tls_termination'] %>
<% unless @tls_ca_certificate.empty? %>
    CACertificate: |
      <%= @tls_ca_certificate %>  
<%- end -%>
<% unless @tls_key.empty? %>
    key: <%= @tls_key %>  
<%- end -%>
<% unless @tls_certificate.empty? %>
    certificate: <%= @tls_certificate %>  
<%- end -%>
<% if @route['tls_termination'] == 'reencrypt' %>
    destinationCACertificate: <%= @tls_destination_ca_certificate %>  
<%- end -%>
<%- end -%>

apiVersion: v1
kind: Route
metadata:
  name: <%= @route['name'] %>
<% if @route.has_key?('labels') %>
  labels:
  <% @route['labels'].each_pair do |k, v| %>
    <%= k %>: <%= v %>
  <%- end -%>
<%- end -%>
spec:
  host: <% @route['host'] %>
  to:
<% @route['to'].each_pair do |k, v| %>
    <%= k %>: <%= v %>
<%- end -%>
<% if @route.has_key?('tls') %>
  tls:
    termination: <%= @route['tls_termination'] %>
<% unless @tls_ca_certificate.empty? %>
    CACertificate: |
      <%= @tls_ca_certificate %>  
<%- end -%>
<% unless @tls_key.empty? %>
    key: <%= @tls_key %>  
<%- end -%>
<% unless @tls_certificate.empty? %>
    certificate: <%= @tls_certificate %>  
<%- end -%>
<% if @route['tls_termination'] == 'reencrypt' %>
    destinationCACertificate: |
<%- @tls_destination_ca_certificate.split("\n").each do |cert| %>
      <%= cert %>
<%- end -%>
<%- end -%>
<%- end -%>

Split lines for Certificates (Routes)
Split lines for Certificates (Routes)
