Creating External Reference in Helm Chart(3.3)

This section describes how to create External References using Helm Chart.

  1. Perform the following steps to have your External References in a Helm chart:

    1. Create an External Reference Profile with the type Kubernetes Properties described in External Reference (3.3) and save it.
    2. Change to the YAML tab and click on the download button to download the YAML file of the ConfigMap.

      Example - ConfigMap.yaml downloaded from External Reference Profile

      ---
      apiVersion: "v1"
      data:
        time_unit: ""
        interval: ""
      kind: "ConfigMap"
      metadata:
        labels:
          app.kubernetes.io/component: "extref"
        name: "default.k8s-extref"
  2. Create a Helm chart with one or more ConfigMaps that will be used in your configuration by following these steps:

    1. Create an empty Helm chart using the following command:

      $ helm create [name of helm chart]
    2. A new directory is created with the specified name.

    3. Delete everything in the templates directory in the new Helm chart.

      $ rm -rf [name of helm chart]/templates/*
    4. Add your ConfigMap YAML file downloaded in step 1.b into the templates directory. 

    5. External Reference values will be received from the data field. Update the values for your keys. 

    6. Install your Helm chart. 

      $ helm install [release name] ./[name of helm chart]


  3. Optional step: To easily maintain your External Reference data you can move it to the values.yaml file.
    1. Add the following parameter in your ConfigMap YAML file in the templates directory: 

      data:
      {{ toYaml .Values.externalReference.data | indent 2 }}

      See the following ConfigMap as an example:

      Example - ConfigMap.yaml file

      apiVersion: v1
      kind: "ConfigMap"
      data:
      {{ toYaml .Values.externalReference.data | indent 2 }}
      metadata:
        labels:
          app.kubernetes.io/component: "extref"
        name: "default.k8s-extref"
    2. Move the data field from your ConfigMap YAML file to the values.yaml file. For example:

      Example - values.yaml file

      # Default values for [name of helm chart].
      # This is a YAML-formatted file.
      # Declare variables to be passed into your templates.
      
      externalReference:
        data:
          interval: "2"
      	time_unit: "seconds"

      Note!

      All the default values created by Helm can be deleted if you don't want to use them.