Skip to content

Converting Jinja Files


The starter-kit that you used at the start of this document will come with several chart files defined for you. These chart files are usually a 1:1 relationship with the the kind:, however to verify do a search all files in your IDE for “kind:” filtered on your jinja files. Make a note of all of them that show up and how many of them show up. Then do the same with the .tpl files.

If you find that your .tpl files are missing some of the "kind"s that your jinja files have, then you will want to make new .tpl files in the ./deployment/helm/ templates older for each one of them and copy that segment from your jinja file into your new .tpl file related to that "kind". For example, the starter-kit does not come with a kind: EnvoyFilter, so if you have of those in Jinja, you will need to make an envoy-filter.tpl in the ./deployment/helm/templates older and copy the kind: EnvoyFilter from your jinja file into your new envoy-filter.tpl

If you find that your .tpl files do not contain the same number of specific "kind"s that your jinja files have, then you will need to update the .tpl files that contain that "kind", adding a "---" to the end of the file and copying the segment from your jinja file.


Example:

---
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
...
---
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
...

After you have made new .tpl files or updated the existing ones, you will now need to replace the variables that Jinja used with ones for Helm. To do this, you will need to search through your jinja files for anything matching this regex \{\{ .*? \}\}, make a note of your search results.

Look through the values files in ./deployment/helm to see if there are already existing variables in Helm that can replace the ones Jinja was using.

You will now need to extract the values of those variables from where ever they are stored for your jinja files to access during your pipeline run, generally inside of your CircleCi config in the deployment step. Once you have these values, go ahead and set up the new variables in your values.yaml file (or environment/colored values files depending on needs) in the ./deployment/helm folder.

You will now need to go through your .tpl files that have reference to the jinja variables and update them to point to the Helm variables. If you kept the name similar, you can just append .Values. to the variable name that was in jinja.


Example Jinja:

metadata:
  name: allow-productcore-shell
  namespace: {{ self_namespace }}
Example values.yaml:


self_namespace: name-dev #[update with client link](liatrio-tag)
Example tpl file:


metadata:
  name: allow-productcore-shell
  namespace: {{ .Values.self_namespace }}