2

I have a requirement to create helm charts in a Jenkins pipeline.

As I understand, helmfile makes it easier to deploy helm charts across environments, but it does not help create helm charts.

I have looked at chartify. It looks like it is no longer maintained.

move2kube seems to be prompt-based system. I cannot find an argument to generate a helm chart.

Has anyone achieved this some other way ?

David Maze
  • 130,717
  • 29
  • 175
  • 215
Att A
  • 165
  • 1
  • 2
  • 7
  • 3
    Why do you want to create a chart dynamically? What would be so different between two different deployments that you couldn't parameterize it (or use complex Helm logic to construct it)? – David Maze Mar 16 '21 at 01:34
  • @DavidMaze David , thank you for replying. Would you please point me to some examples where helm chart creation is parameterized across projects ? What I am trying to achieve is creating a helm chart in a step of a Jenkins pipeline . Ideally , this step should be reused across pipelines. – Att A Mar 20 '21 at 16:59
  • You _could_ run `sh "helm init"` and the like from a Jenkins pipeline, I guess, but I'm still a little unclear why you'd want to do this. Usually I've seen Jenkins used to build and deploy existing code and not to try to build up new code from scratch. (That is, I'd check in a Helm chart with each service, and possibly in a deployment step `helm install` the chart from the repository, but the chart would be in source control with the rest of the source code.) – David Maze Mar 20 '21 at 17:55
  • You can take a look into [helmify](https://github.com/arttor/helmify) CLI. It generates a Helm chart from k8s yaml. I've explained how to use it in [this answer](https://stackoverflow.com/a/69150410/6065134) – Artem Sep 12 '21 at 13:00

1 Answers1

1

There are two choices in move2kube (use 0.2.0 alpha versions or latest), --setconfig and --config. The simplest for you is to run the step manually once, and then copy the m2kconfig.yaml file in the output folder, and place it in the filesystem, and provide that as --config m2kconfig.yaml during execution. Add --qaskip too.

Dreams
  • 5,854
  • 9
  • 48
  • 71
  • Thanks Ashok. This is the [m2kconfig.yaml](https://github.com/avgKol/m2k-helm/blob/master/m2kconfig.yaml) and this is the command I am running from the Jenkins pipeline. `move2kube translate --setconfig m2kconfig.yaml --config m2kconfig.yaml --qaskip --source yamls --overwrite --verbose --name myredis` . Does this look correct ? I could not find much documentation on the parameters used for move2kube. – Att A Mar 22 '21 at 21:30
  • Yes, "--setconfig" can be ignored in this case. We will be updating https://move2kube.konveyor.io/ with more documentation. For now, `move2kube help` has some documentation to guide you. – Ashok Pon Kumar Mar 24 '21 at 05:30