0

I am creating a helm chart for the job I want to run in our k8 cluster. When you execute helm create it creates templates that I do not need.


$ helm create new-job               
Creating new-job

$ tree new-job/
new-job/
├── Chart.yaml
├── charts
├── templates
│   ├── NOTES.txt
│   ├── _helpers.tpl
│   ├── deployment.yaml
│   ├── hpa.yaml
│   ├── ingress.yaml
│   ├── service.yaml
│   ├── serviceaccount.yaml
│   └── tests
│       └── test-connection.yaml
└── values.yaml

3 directories, 10 files

Is there a way to only create a template containing only job.yaml?

alegria
  • 1,290
  • 14
  • 23

2 Answers2

0

Helm has the option to use a custom "starter":

helm create --starter /path/to/starter/chart my-chart
Marco Caberletti
  • 1,353
  • 1
  • 10
  • 13
0

There's nothing magical about helm create. Just so long as the chart has a Chart.yaml file and a templates subdirectory, Helm can install it. You can mkdir an empty directory and create the Chart.yaml file from scratch using your favorite text editor, if you'd prefer.

# Chart.yaml, with only the required fields
apiVersion: v2
name: my-chart
version: '0.0.1'
mkdir my-chart; cd my-chart
$EDITOR Chart.yaml
mkdir templates
$EDITOR templates/job.yaml
helm install --generate-name .

You can also go the other direction; start from the helm create template and delete all of the parts you don't need. Of note, there are a couple of generically helpful things in _helpers.tpl you might want to retain. (Keeping the ServiceAccount turns out to be useful in a couple of situations, and if you use Istio, it also likes you to have a Service even if you don't accept inbound connections.)

David Maze
  • 130,717
  • 29
  • 175
  • 215