Helm Chart requirements.yaml: Difference between revisions

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


=Internal=
=Internal=
 
* [[Helm_Concepts#Deprecated_Elements|Deprecated Elements]]
* [[Helm_Concepts#requirements.yaml|Chart Layout]]
* [[Helm Dependencies|Dependencies]]
* [[Helm_Concepts#Dependencies|Dependencies]]


=Overview=
=Overview=


requirements.yaml is an optional metadata file that contains dynamic dependencies for the chart. For a general discussion on chart dependencies, see [[Helm_Concepts#Dependencies|Helm Dependencies]].
{{Note|The requirements.yaml file was deprecated in Helm 3 and replaced with the [[Helm_Chart_Chart.yaml#dependencies|Chart.yaml 'dependencies' element]].}}
requirements.yaml is an '''optional''' metadata file that contains the immediate dependencies for the chart, expressed as a list of chart "coordinates": [[#name|name]], [[#version|version]] and [[#repository|repository URL]]. Note that the immediate dependencies might have dependencies on their own, which are not explicitly specified in the chart's requirements.yaml file, but implied. For an in-depth discussion on how Helm dependencies work, see: {{Internal|Helm_Dependencies#How_Helm_Dependencies_Work|How Helm Dependencies Work}}


=Structure=
=Structure=
Line 26: Line 26:
   version 3.2.1
   version 3.2.1
   repository: http://another.example.com/charts
   repository: http://another.example.com/charts
=Example=
<syntaxhighlight lang='yaml'>
dependencies:
  - name: postgresql
    version: 6.3.2
    repository: https://kubernetes-charts.storage.googleapis.com
</syntaxhighlight>
=requirements.lock=
{{Internal|Helm_Dependencies#Transitive_Dependencies_and_requirements.lock_File|Transitive Dependencies and requirements.lock File}}


=Fields=
=Fields=
Line 31: Line 43:
====name====
====name====


The dependency [[Helm_Concepts#Chart_Name|chart name]].
The dependency [[Helm_Concepts#Chart_Name|chart name]]. The name must match the name in the chart's Chart.yaml file.


====version====
====version====


The dependency [[Helm_Concepts#Chart_Version|chart version]].
The dependency [[Helm_Concepts#Chart_Version|chart version]]. It could be a version or a version range.


====repository====
====repository====


The dependency chart [[Helm_Concepts#Repository_URL|repository full URL]]. Note that [[Helm_repo#Add_a_New_Repository|helm repo add]] must be used to add the repository locally.
The dependency chart [[Helm_Concepts#Repository_URL|repository full URL]].  


====alias====
The most common case is to specify an on-line repository, as such:


<font color=darkgray>TODO: https://helm.sh/docs/developing_charts/#alias-field-in-requirements-yaml</font>
<syntaxhighlight lang='yaml'>
- name: postgresql
    version: 6.3.2
    repository: https://kubernetes-charts.storage.googleapis.com
</syntaxhighlight>


====condition====
In this case, [[Helm_repo#Add_a_New_Repository|helm repo add]] must be used to add the repository locally before using the dependent chart.


<font color=darkgray>TODO:https://helm.sh/docs/developing_charts/#tags-and-condition-fields-in-requirements-yaml</font>
However, we can refer to dependencies that exist on the local filesystem, using an absolute path file URL or a relative path URL, as such:
<syntaxhighlight lang='yaml'>
- name: my-chart
    version: 1.0.0
    repository: file:///tmp/charts/my-chart
</syntaxhighlight>


====tags====
<syntaxhighlight lang='yaml'>
- name: my-chart
    version: 1.0.0
    repository: file://../my-chart
</syntaxhighlight>


<font color=darkgray>TODO: https://helm.sh/docs/developing_charts/#tags-and-condition-fields-in-requirements-yaml</font>
Note that when a relative path is used, it is considered relative to the dependent chart root directory.  


=Example=
In case the dependency chart is not archived, but exist as an exploded directory on the file system, the file:// URL must point to the root directory of the chart - the one that contains [[Helm_Chart_Chart.yaml|Chart.yaml]].


<syntaxhighlight lang='yaml'>
If the dependency chart is retrieved locally, it is not required to have the repository added to helm by [[helm repo|helm repo add]].
dependencies:
  - name: postgresql
    version: 6.3.2
    repository: https://kubernetes-charts.storage.googleapis.com
<syntaxhighlight lang='yaml'>

Latest revision as of 21:05, 5 February 2022

External

Internal

Overview


The requirements.yaml file was deprecated in Helm 3 and replaced with the Chart.yaml 'dependencies' element.

requirements.yaml is an optional metadata file that contains the immediate dependencies for the chart, expressed as a list of chart "coordinates": name, version and repository URL. Note that the immediate dependencies might have dependencies on their own, which are not explicitly specified in the chart's requirements.yaml file, but implied. For an in-depth discussion on how Helm dependencies work, see:

How Helm Dependencies Work

Structure

dependencies:
- name: blue
  version: 1.2.3
  repository: http://example.com/charts
  alias: something
  condition: something.enabled, global. something.enabled
  tags:
  - front-end
  - big    
- name: green
  version 3.2.1
  repository: http://another.example.com/charts

Example

dependencies:
  - name: postgresql
    version: 6.3.2
    repository: https://kubernetes-charts.storage.googleapis.com

requirements.lock

Transitive Dependencies and requirements.lock File

Fields

name

The dependency chart name. The name must match the name in the chart's Chart.yaml file.

version

The dependency chart version. It could be a version or a version range.

repository

The dependency chart repository full URL.

The most common case is to specify an on-line repository, as such:

- name: postgresql
    version: 6.3.2
    repository: https://kubernetes-charts.storage.googleapis.com

In this case, helm repo add must be used to add the repository locally before using the dependent chart.

However, we can refer to dependencies that exist on the local filesystem, using an absolute path file URL or a relative path URL, as such:

- name: my-chart
    version: 1.0.0
    repository: file:///tmp/charts/my-chart
- name: my-chart
    version: 1.0.0
    repository: file://../my-chart

Note that when a relative path is used, it is considered relative to the dependent chart root directory.

In case the dependency chart is not archived, but exist as an exploded directory on the file system, the file:// URL must point to the root directory of the chart - the one that contains Chart.yaml.

If the dependency chart is retrieved locally, it is not required to have the repository added to helm by helm repo add.