airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Chart: Enable templating in extraContainers and extraInitContainers

Open mewa opened this issue 1 year ago • 2 comments

Currently, the extraContainers and extraInitContainers are passed on an "as-is" basis. What this means in practice is that if you depend on a release-specific resource you have to manually provide the names rather than use templating.


Example: mounting a release-specific ConfigMap into an extraContainer

The following config will not work, since it produces an init container which references {{ .Release.Name }}-stuff-config copied verbatim, rather than the templated value including the actual release name as you would expect.

workers:
  extraInitContainers:
    - name: init-stuff
      image: does/stuff:1.0.0
      envFrom:
        - configMapRef:
            name: "{{ .Release.Name }}-stuff-config"

extraConfigMaps:
  '{{ .Release.Name }}-stuff-config':
    data: |-
      STUFF_ENV_VAR1: one
      STUFF_ENV_VAR2: two

This PR enables templating for extraContainers and extraInitContainers fields to fix this issue and improve the reusability of the chart.


^ Add meaningful description above Read the Pull Request Guidelines for more information. In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed. In case of a new dependency, check compliance with the ASF 3rd Party License Policy. In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

mewa avatar Mar 26 '24 16:03 mewa

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 11 '24 00:05 github-actions[bot]

Rebased on main

mewa avatar May 13 '24 13:05 mewa

IMO would also be nice to add informations about templating to the comments in values file itself (as in done volumes)

I'm personally waiting for this to be merged as I depend on this feature in umbrella chart I'm writing.

JuniorJPDJ avatar May 22 '24 16:05 JuniorJPDJ