Topics

Ordering of Helm subcharts

Bernd Adamowicz
 

According to the documentation here it is possible to declare dependencies in Heln charts using the charts subdirectory. However, the order in which the K8s resources will be deployed depends on the implementation of kind_sorter.go. Here only native K8s resources will be taken into account.

Now I've got a Helm chart dependency with no native K8s resources at all. Instead only Tekton pipeline resources are used which obviously (after several attempts) makes the order of the deployed Tekton resources unpredictable.

Actually I want to have these Tekton resources deployed:

  • first: Tekton task
  • second: Tekton pipeline
  • third: Tekton pipeline-run

And I have created this chart structure to achieve it (of course with all the necessary files in place):

pipeline-run/charts/pipeline/charts/task/

As mentioned the order is not predictable and mostly the pipeline run is started before the tasks are available which leads to an error.

Now I'm not sure if this is worth a feature request which says to include not only native K8s resources but instead all resources available inside the cluster.

I'd like to hear some opinions. Thanks!

Paul Czarkowski <pczarkowski@...>
 

Hi Bernd!
I could see two options:

* use the `post-install` hook for the pipeline-run ?   
* use two helm charts, one for the tasks and pipeline, the other for the pipeline-run.   the latter can have the former as a dependency, or you could use helmfile or similar to order them.

On Tue, Jan 21, 2020 at 7:02 AM Bernd Adamowicz <bernd.adamowicz@...> wrote:

According to the documentation here it is possible to declare dependencies in Heln charts using the charts subdirectory. However, the order in which the K8s resources will be deployed depends on the implementation of kind_sorter.go. Here only native K8s resources will be taken into account.

Now I've got a Helm chart dependency with no native K8s resources at all. Instead only Tekton pipeline resources are used which obviously (after several attempts) makes the order of the deployed Tekton resources unpredictable.

Actually I want to have these Tekton resources deployed:

  • first: Tekton task
  • second: Tekton pipeline
  • third: Tekton pipeline-run

And I have created this chart structure to achieve it (of course with all the necessary files in place):

pipeline-run/charts/pipeline/charts/task/

As mentioned the order is not predictable and mostly the pipeline run is started before the tasks are available which leads to an error.

Now I'm not sure if this is worth a feature request which says to include not only native K8s resources but instead all resources available inside the cluster.

I'd like to hear some opinions. Thanks!

Bernd Adamowicz
 

Hi Paul!

Thanks for answering. Actually I already tried your second approach with some scripting voodoo around it which of course worked. But meanwhile I came across a better solution by using the k8s resource List. Looks like this:

apiVersion: v1
kind: List
items:
  - apiVersion: {{ .Values.tekton.apiVersion }}
    kind: Task
    metadata:
...
  - apiVersion: {{ .Values.tekton.apiVersion }}
    kind: Pipeline
    metadata:
...
  - apiVersion: {{ .Values.tekton.apiVersion }}
    kind: PipelineRun
    metadata:
...

However, for me the question remains if it is sufficient that Helm sorts resources only by a hard wired source file? Wouldn't it be better to get all available resources from the API and sort those? I'm not sure and like to hear some opinions.