5

I'm trying to set multiline values (contents of a ca certificate file) to kustomize environment file for a particular key as displayed in the code below. Is there a way to achieve this?

Note: Adding quotes to the value in some_params.env isn't working.

kustomize.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
  role: authentication
bases:
- ./somebase

configMapGenerator:
- name: some-parameters
  env: some_params.env
vars:
- name: ca_contents
  objref:
    kind: ConfigMap
    name: some-parameters
    apiVersion: v1
  fieldref:
    fieldpath: data.ca_contents
configurations:
 - some_params.yaml

some_params.yaml

varReference:
- path: data/ca.pem
  kind: ConfigMap

some_params.env

ca_contents= |
-----BEGIN CERTIFICATE-----
YOUR CA CERTIFICATE CONTENTS
-----END CERTIFICATE-----

Running the following command: kustomize build base

Returns: Error: NewResMapFromConfigMapArgs: NewResMapFromConfigMapArgs: env source file: some_params.env: "-----BEGIN CERTIFICATE-----" is not a valid key name: a valid environment variable name must consist of alphabetic characters, digits, '_', '-', or '.', and must not start with a digit (e.g. 'my.env-name', or 'MY_ENV.NAME', or 'MyEnvName1', regex used for validation is '[-._a-zA-Z][-._a-zA-Z0-9]*')

Krishna D
  • 81
  • 1
  • 6

0 Answers0