Warm tip: This article is reproduced from serverfault.com, please click

Configuring TLS on openshift using helm

发布于 2020-11-28 11:02:17

I am trying to configure TLS using edge termination on openshift, am passing the TLS certificates and private key in values.yaml and referring it in route.yaml file, when I execute the helm chart the creation of the route fails due to improper indentation and newlines introduced while copying the certificate from values.yaml to the route.yaml file.

Below are the values.yaml file from which am referring the certificate in the route.yaml file. What is the better way to do this? how can I pass the tls cert and private key from values.yaml with proper indentation.

Values.yaml

route:
  Enabled: true
  annotations:
    haproxy.router.openshift.io/cookie_name: SESSION_XLD
    haproxy.router.openshift.io/disable_cookies: "false"
    haproxy.router.openshift.io/rewrite-target: /
  path: /
  hosts:
    - www.example.com
  tls:
    key:
      -----BEGIN CERTIFICATE-----
      [...]
      -----END CERTIFICATE-----
    certificate:
      -----BEGIN CERTIFICATE-----
      [...]
      -----END CERTIFICATE-----
    caCertificate:
      -----BEGIN CERTIFICATE-----
      [...]
      -----END CERTIFICATE-----
    insecureEdgeTerminationPolicy: Redirect

route.yaml

{{- if $.Values.route.tls }}
  tls:
    termination: edge
  {{- with $.Values.route.tls }}
    key: |
      {{ .key }}
    certificate: |
      {{ .certificate }}
    caCertificate: |
      {{ .caCertificate }}
    insecureEdgeTerminationPolicy: {{ .insecureEdgeTerminationPolicy }}
  {{- end }}
{{- end }}
Questioner
chandrashekar
Viewed
0
Daein Park 2020-11-29 00:16:08

How about try to pass the each certificate to route.yaml with | for preserving the indentation in Values.yaml either as follows ?

  tls:
    key: | <--- add
      -----BEGIN CERTIFICATE-----
      [...]
      -----END CERTIFICATE-----
    certificate: | <--- add
      -----BEGIN CERTIFICATE-----
      [...]
      -----END CERTIFICATE-----
    caCertificate: | <--- add
      -----BEGIN CERTIFICATE-----
      [...]
      -----END CERTIFICATE-----