Helm package: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(13 intermediate revisions by the same user not shown)
Line 7: Line 7:


=Overview=
=Overview=
{{Note|<center>Revised for Helm 3</center>}}
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
helm package ./my-chart
helm package ./my-chart
</syntaxhighlight>
</syntaxhighlight>


The command packages a chart into a versioned chart archive file. The command needs the path to the directory containing the chart's [[Helm_Chart_Chart.yaml#version|Chart.yaml]]. Chart.yaml [[Helm_Chart_Chart.yaml#version|version]] element is used when generating the package name: when generating a package, the package command will use the version that it finds in the Chart.yaml as a token in the package name.
The command packages a chart into a versioned [[Helm_Concepts#Chart_Archive|chart archive]] file. The command needs the path to the directory containing the chart's [[Helm_Chart_Chart.yaml#version|Chart.yaml]]. Chart.yaml [[Helm_Chart_Chart.yaml#version|version]] element is used when generating the package name: when generating a package, the package command will use the version that it finds in the Chart.yaml as a token in the package name. The name of the directory that contains the exploded chart is ignored. The chart archive is saved in the directory the command is run from, unless [[#-d.2C_--destination|--destination]] is used.


The chart archive is saved in the directory the command is run from, unless [[-d.2C_--destination|--destination]] is used.
{{Warn|If interrupted with Ctrl-C during package building, helm package will leave behind a 'tmpcharts' subdirectory in the chart directory.}}


=Packaging and Dependencies=
=Packaging and Dependencies=
If the chart being packaged declares [[Helm_Dependencies#Dependency_Declaration|dependencies]], the dependency charts must be available in the charts/ directory, otherwise the packaging attempt will fail:
If the chart being packaged declares [[Helm_Dependencies#Dependency_Declaration|dependencies]], the dependency charts must be available in the charts/ directory when "package" command is executed, otherwise the packaging attempt will fail:
<syntaxhighlight lang='text'>
<syntaxhighlight lang='text'>
Error: found in Chart.yaml, but missing in charts/ directory: b
Error: found in Chart.yaml, but missing in charts/ directory: some-chart
</syntaxhighlight>
In this case, [[Helm_dependency#Dependency_Update|help dependency update]] must be run on the chart before attempting to package it or [[#-u.2C_--dependency-update|-u]] or [[#-u.2C_--dependency-update|--dependency-update]] options must be used as part of the "package" command:
<syntaxhighlight lang='bash'>
helm package -u ./my-chart
</syntaxhighlight>
</syntaxhighlight>
If that is the case, [[#-u.2C_--dependency-update|--dependency-update]] option must be used, or [[Helm_dependency#Dependency_Update|help dependency update]] must be run on the chart before attempting to package it.
This will insure that all immediate dependencies are shipped with the archive. Because the same requirements apply to dependencies when they are packaged, this effectively insures that the entire transitive graph of dependencies is packaged within a chart archive. For more details on dependencies, see: {{Internal|Helm_Dependencies#How_Helm_Dependencies_Work|How Helm Dependencies Work}}


=Options=
=Options=

Latest revision as of 01:46, 17 May 2022

External

Internal

Overview

helm package ./my-chart

The command packages a chart into a versioned chart archive file. The command needs the path to the directory containing the chart's Chart.yaml. Chart.yaml version element is used when generating the package name: when generating a package, the package command will use the version that it finds in the Chart.yaml as a token in the package name. The name of the directory that contains the exploded chart is ignored. The chart archive is saved in the directory the command is run from, unless --destination is used.


If interrupted with Ctrl-C during package building, helm package will leave behind a 'tmpcharts' subdirectory in the chart directory.

Packaging and Dependencies

If the chart being packaged declares dependencies, the dependency charts must be available in the charts/ directory when "package" command is executed, otherwise the packaging attempt will fail:

Error: found in Chart.yaml, but missing in charts/ directory: some-chart

In this case, help dependency update must be run on the chart before attempting to package it or -u or --dependency-update options must be used as part of the "package" command:

helm package -u ./my-chart

This will insure that all immediate dependencies are shipped with the archive. Because the same requirements apply to dependencies when they are packaged, this effectively insures that the entire transitive graph of dependencies is packaged within a chart archive. For more details on dependencies, see:

How Helm Dependencies Work

Options

-d, --destination

The directory where to write the chart archive. The default is ".".

-u, --dependency-update

Perform a dependency update before packaging. Equivalent with running helm dependency update.

--debug

Use it to see what is packaged in the chart.