If you use a single release for both KOTS and Helm installations, you need a consistent way to access license fields so that your Helm templates can look in one place for those license fields, whether the customer installs with the helm CLI or the kots CLI.
Imagine you have a license field called numSeats.
For Helm installations, the Replicated registry injects this license field into the global values like this:
global:
replicated:
licenseFields:
numSeats:
name: numSeats
signature:
v1: DS0JmZhdhII+cQraAE80NzcfuxGJmKwm81azHVOdQgDeJmuthVk3eSx+2K3JKWA9QEu5VaMztctq65atD0Nkn5LrtRF7fjrgccpZrZFZv1hmvcWmBx4yg37ZyKGGTIhP6Oa4rq3n3YSHFM+0dWidAs3/pylGGk9eRrL2Tvlbkoy7cT/Yv+dP8dpOCuo50o9yWM/1I4SB4CX8E+O05TkdlPJ/EVgyhEidozJMn9js5pzDPzYN17v/wy5fNtfD/JDB8SVFdHHh0szrk0YQ2Mz+3k+2MlgUrrMeTyxlEBkgJxZT4tMPlldFG9uOMKlWNtHCvXpZhWQnu4CRhpbCV53rXA==
title: Number of Seats
value: 10
valueType: Integer
So if you want to use the numSeats license field value in your Helm templates, you reference it with .Values.global.replicated.licenseFields.numSeats.value
.
KOTS installations do not pull the Helm chart from the Replicated registry where the license fields are injected. So when your templates try to reference .Values.global.replicated.licenseFields.numSeats.value
, nothing will be there.
KOTS installations still support repl
templating. So for KOTS, you need to use repl
templating to map your license field values to the same location. This is done using the HelmChart kind.
In HelmChart, you map the license fields using the values
field like this:
apiVersion: kots.io/v1beta1
kind: HelmChart
metadata:
name: samplechart
spec:
values:
global:
replicated:
licenseFields:
numSeats:
value: {{repl LicenseFieldValue "numSeats" }}
Now, KOTS will map the license field values to the same location as Helm installations, and your templates can access them the same way.