github.com/koderover/helm@v2.17.0+incompatible/docs/charts.md (about)

     1  # Charts
     2  
     3  Helm uses a packaging format called _charts_. A chart is a collection of files
     4  that describe a related set of Kubernetes resources. A single chart
     5  might be used to deploy something simple, like a memcached pod, or
     6  something complex, like a full web app stack with HTTP servers,
     7  databases, caches, and so on.
     8  
     9  Charts are created as files laid out in a particular directory tree,
    10  then they can be packaged into versioned archives to be deployed.
    11  
    12  This document explains the chart format, and provides basic guidance for
    13  building charts with Helm.
    14  
    15  ## The Chart File Structure
    16  
    17  A chart is organized as a collection of files inside of a directory. The
    18  directory name is the name of the chart (without versioning information). Thus,
    19  a chart describing WordPress would be stored in the `wordpress/` directory.
    20  
    21  Inside of this directory, Helm will expect a structure that matches this:
    22  
    23  ```
    24  wordpress/
    25    Chart.yaml          # A YAML file containing information about the chart
    26    LICENSE             # OPTIONAL: A plain text file containing the license for the chart
    27    README.md           # OPTIONAL: A human-readable README file
    28    requirements.yaml   # OPTIONAL: A YAML file listing dependencies for the chart
    29    values.yaml         # The default configuration values for this chart
    30    charts/             # A directory containing any charts upon which this chart depends.
    31    templates/          # A directory of templates that, when combined with values,
    32                        # will generate valid Kubernetes manifest files.
    33    templates/NOTES.txt # OPTIONAL: A plain text file containing short usage notes
    34  ```
    35  
    36  Helm reserves use of the `charts/` and `templates/` directories, and of
    37  the listed file names. Other files will be left as they are.
    38  
    39  ## The Chart.yaml File
    40  
    41  The `Chart.yaml` file is required for a chart. It contains the following fields:
    42  
    43  ```yaml
    44  apiVersion: The chart API version, always "v1" (required)
    45  name: The name of the chart (required)
    46  version: A SemVer 2 version (required)
    47  kubeVersion: A SemVer range of compatible Kubernetes versions (optional)
    48  description: A single-sentence description of this project (optional)
    49  keywords:
    50    - A list of keywords about this project (optional)
    51  home: The URL of this project's home page (optional)
    52  sources:
    53    - A list of URLs to source code for this project (optional)
    54  maintainers: # (optional)
    55    - name: The maintainer's name (required for each maintainer)
    56      email: The maintainer's email (optional for each maintainer)
    57      url: A URL for the maintainer (optional for each maintainer)
    58  engine: gotpl # The name of the template engine (optional, defaults to gotpl)
    59  icon: A URL to an SVG or PNG image to be used as an icon (optional).
    60  appVersion: The version of the app that this contains (optional). This needn't be SemVer.
    61  deprecated: Whether this chart is deprecated (optional, boolean)
    62  tillerVersion: The version of Tiller that this chart requires. This should be expressed as a SemVer range: ">2.0.0" (optional)
    63  ```
    64  
    65  If you are familiar with the `Chart.yaml` file format for Helm Classic, you will
    66  notice that fields specifying dependencies have been removed. That is because
    67  the new Chart format expresses dependencies using the `charts/` directory.
    68  
    69  Other fields will be silently ignored.
    70  
    71  ### Charts and Versioning
    72  
    73  Every chart must have a version number. A version must follow the
    74  [SemVer 2](https://semver.org/) standard. Unlike Helm Classic, Kubernetes
    75  Helm uses version numbers as release markers. Packages in repositories
    76  are identified by name plus version.
    77  
    78  For example, an `nginx` chart whose version field is set to `version:
    79  1.2.3` will be named:
    80  
    81  ```
    82  nginx-1.2.3.tgz
    83  ```
    84  
    85  More complex SemVer 2 names are also supported, such as
    86  `version: 1.2.3-alpha.1+ef365`. But non-SemVer names are explicitly
    87  disallowed by the system.
    88  
    89  **NOTE:** Whereas Helm Classic and Deployment Manager were both
    90  very GitHub oriented when it came to charts, Kubernetes Helm does not
    91  rely upon or require GitHub or even Git. Consequently, it does not use
    92  Git SHAs for versioning at all.
    93  
    94  The `version` field inside of the `Chart.yaml` is used by many of the
    95  Helm tools, including the CLI and the Tiller server. When generating a
    96  package, the `helm package` command will use the version that it finds
    97  in the `Chart.yaml` as a token in the package name. The system assumes
    98  that the version number in the chart package name matches the version number in
    99  the `Chart.yaml`. Failure to meet this assumption will cause an error.
   100  
   101  ### The appVersion field
   102  
   103  Note that the `appVersion` field is not related to the `version` field. It is
   104  a way of specifying the version of the application. For example, the `drupal`
   105  chart may have an `appVersion: 8.2.1`, indicating that the version of Drupal
   106  included in the chart (by default) is `8.2.1`. This field is informational, and
   107  has no impact on chart version calculations.
   108  
   109  ### Deprecating Charts
   110  
   111  When managing charts in a Chart Repository, it is sometimes necessary to
   112  deprecate a chart. The optional `deprecated` field in `Chart.yaml` can be used
   113  to mark a chart as deprecated. If the **latest** version of a chart in the
   114  repository is marked as deprecated, then the chart as a whole is considered to
   115  be deprecated. The chart name can later be reused by publishing a newer version
   116  that is not marked as deprecated. The workflow for deprecating charts, as
   117  followed by the [helm/charts](https://github.com/helm/charts)
   118  project is:
   119  
   120  - Update chart's `Chart.yaml` to mark the chart as deprecated, bumping the version
   121  - Release the new chart version in the Chart Repository
   122  - Remove the chart from the source repository (e.g. git)
   123  
   124  ## Chart LICENSE, README and NOTES
   125  
   126  Charts can also contain files that describe the installation, configuration, usage and license of a
   127  chart.
   128  
   129  A LICENSE is a plain text file containing the [license](https://en.wikipedia.org/wiki/Software_license)
   130  for the chart. The chart can contain a license as it may have programming logic in the templates and
   131  would therefore not be configuration only. There can also be separate license(s) for the application
   132  installed by the chart, if required.
   133  
   134  A README for a chart should be formatted in Markdown (README.md), and should generally
   135  contain:
   136  
   137  - A description of the application or service the chart provides
   138  - Any prerequisites or requirements to run the chart
   139  - Descriptions of options in `values.yaml` and default values
   140  - Any other information that may be relevant to the installation or configuration of the chart
   141  
   142  The chart can also contain a short plain text `templates/NOTES.txt` file that will be printed out
   143  after installation, and when viewing the status of a release. This file is evaluated as a
   144  [template](#templates-and-values), and can be used to display usage notes, next steps, or any other
   145  information relevant to a release of the chart. For example, instructions could be provided for
   146  connecting to a database, or accessing a web UI. Since this file is printed to STDOUT when running
   147  `helm install` or `helm status`, it is recommended to keep the content brief and point to the README
   148  for greater detail.
   149  
   150  ## Chart Dependencies
   151  
   152  In Helm, one chart may depend on any number of other charts.
   153  These dependencies can be dynamically linked through the `requirements.yaml`
   154  file or brought in to the `charts/` directory and managed manually.
   155  
   156  Although manually managing your dependencies has a few advantages some teams need,
   157  the preferred method of declaring dependencies is by using a
   158  `requirements.yaml` file inside of your chart.
   159  
   160  **Note:** The `dependencies:` section of the `Chart.yaml` from Helm
   161  Classic has been completely removed.
   162  
   163  ### Managing Dependencies with `requirements.yaml`
   164  
   165  A `requirements.yaml` file is a simple file for listing your
   166  dependencies.
   167  
   168  ```yaml
   169  dependencies:
   170    - name: apache
   171      version: 1.2.3
   172      repository: http://example.com/charts
   173    - name: mysql
   174      version: 3.2.1
   175      repository: http://another.example.com/charts
   176  ```
   177  
   178  - The `name` field is the name of the chart you want.
   179  - The `version` field is the version of the chart you want.
   180  - The `repository` field is the full URL to the chart repository. Note
   181    that you must also use `helm repo add` to add that repo locally.
   182  
   183  Once you have a dependencies file, you can run `helm dependency update`
   184  and it will use your dependency file to download all the specified
   185  charts into your `charts/` directory for you.
   186  
   187  ```console
   188  $ helm dep up foochart
   189  Hang tight while we grab the latest from your chart repositories...
   190  ...Successfully got an update from the "local" chart repository
   191  ...Successfully got an update from the "stable" chart repository
   192  ...Successfully got an update from the "example" chart repository
   193  ...Successfully got an update from the "another" chart repository
   194  Update Complete.
   195  Saving 2 charts
   196  Downloading apache from repo http://example.com/charts
   197  Downloading mysql from repo http://another.example.com/charts
   198  ```
   199  
   200  When `helm dependency update` retrieves charts, it will store them as
   201  chart archives in the `charts/` directory. So for the example above, one
   202  would expect to see the following files in the charts directory:
   203  
   204  ```
   205  charts/
   206    apache-1.2.3.tgz
   207    mysql-3.2.1.tgz
   208  ```
   209  
   210  Managing charts with `requirements.yaml` is a good way to easily keep
   211  charts updated, and also share requirements information throughout a
   212  team.
   213  
   214  #### Alias field in requirements.yaml
   215  
   216  In addition to the other fields above, each requirements entry may contain
   217  the optional field `alias`.
   218  
   219  Adding an alias for a dependency chart would put
   220  a chart in dependencies using alias as name of new dependency.
   221  
   222  One can use `alias` in cases where they need to access a chart
   223  with other name(s).
   224  
   225  ```yaml
   226  # parentchart/requirements.yaml
   227  dependencies:
   228    - name: subchart
   229      repository: http://localhost:10191
   230      version: 0.1.0
   231      alias: new-subchart-1
   232    - name: subchart
   233      repository: http://localhost:10191
   234      version: 0.1.0
   235      alias: new-subchart-2
   236    - name: subchart
   237      repository: http://localhost:10191
   238      version: 0.1.0
   239  ```
   240  
   241  In the above example we will get 3 dependencies in all for `parentchart`
   242  
   243  ```
   244  subchart
   245  new-subchart-1
   246  new-subchart-2
   247  ```
   248  
   249  The manual way of achieving this is by copy/pasting the same chart in the
   250  `charts/` directory multiple times with different names.
   251  
   252  #### Tags and Condition fields in requirements.yaml
   253  
   254  In addition to the other fields above, each requirements entry may contain
   255  the optional fields `tags` and `condition`.
   256  
   257  All charts are loaded by default. If `tags` or `condition` fields are present,
   258  they will be evaluated and used to control loading for the chart(s) they are applied to.
   259  
   260  Condition - The condition field holds one or more YAML paths (delimited by commas).
   261  If this path exists in the parent's values and resolves to a boolean value,
   262  the chart will be enabled or disabled based on that boolean value. Only the first
   263  valid path found in the list is evaluated and if no paths exist then the condition 
   264  has no effect. For multiple level dependencies the condition is prependend by the 
   265  path to the parent chart.
   266  
   267  Tags - The tags field is a YAML list of labels to associate with this chart.
   268  In the top parent's values, all charts with tags can be enabled or disabled by
   269  specifying the tag and a boolean value.
   270  
   271  ```yaml
   272  # parentchart/requirements.yaml
   273  dependencies:
   274    - name: subchart1
   275      repository: http://localhost:10191
   276      version: 0.1.0
   277      condition: subchart1.enabled
   278      tags:
   279        - front-end
   280        - subchart1
   281  
   282    - name: subchart2
   283      repository: http://localhost:10191
   284      version: 0.1.0
   285      condition: subchart2.enabled
   286      tags:
   287        - back-end
   288        - subchart2
   289  ```
   290  
   291  ```yaml
   292  # subchart2/requirements.yaml
   293  dependencies:
   294    - name: subsubchart
   295      repository: http://localhost:10191
   296      version: 0.1.0
   297      condition: subsubchart.enabled
   298  ```
   299  
   300  ```yaml
   301  # parentchart/values.yaml
   302  
   303  subchart1:
   304    enabled: true
   305  subchart2:
   306    subsubchart:
   307      enabled: false
   308  tags:
   309    front-end: false
   310    back-end: true
   311  ```
   312  
   313  In the above example all charts with the tag `front-end` would be disabled but since the
   314  `subchart1.enabled` path evaluates to 'true' in the parent's values, the condition will override the
   315  `front-end` tag and `subchart1` will be enabled.
   316  
   317  Since `subchart2` is tagged with `back-end` and that tag evaluates to `true`, `subchart2` will be
   318  enabled. Also note that although `subchart2` has a condition specified in `requirements.yaml`, there
   319  is no corresponding path and value in the parent's values so that condition has no effect.
   320  
   321  `subsubchart` is disabled by default but can be enabled by setting `subchart2.subsubchart.enabled=true`.
   322  Hint: disabling `subchart2` via tag will also disable all sub-charts (even if overriding the value `subchart2.subsubchart.enabled=true`).
   323  
   324  ##### Using the CLI with Tags and Conditions
   325  
   326  The `--set` parameter can be used as usual to alter tag and condition values.
   327  
   328  ````
   329  helm install --set tags.front-end=true --set subchart2.enabled=false
   330  ````
   331  
   332  ##### Tags and Condition Resolution
   333  
   334  - **Conditions (when set in values) always override tags.**
   335  - The first condition path that exists wins and subsequent ones for that chart are ignored.
   336  - Tags are evaluated as 'if any of the chart's tags are true then enable the chart'.
   337  - Tags and conditions values must be set in the top parent's values.
   338  - The `tags:` key in values must be a top level key. Globals and nested `tags:` tables
   339      are not currently supported.
   340  
   341  #### Importing Child Values via requirements.yaml
   342  
   343  In some cases it is desirable to allow a child chart's values to propagate to the parent chart and be
   344  shared as common defaults. An additional benefit of using the `exports` format is that it will enable future
   345  tooling to introspect user-settable values.
   346  
   347  The keys containing the values to be imported can be specified in the parent chart's `requirements.yaml` file
   348  using a YAML list. Each item in the list is a key which is imported from the child chart's `exports` field.
   349  
   350  To import values not contained in the `exports` key, use the [child-parent](#using-the-child-parent-format) format.
   351  Examples of both formats are described below.
   352  
   353  ##### Using the exports format
   354  
   355  If a child chart's `values.yaml` file contains an `exports` field at the root, its contents may be imported
   356  directly into the parent's values by specifying the keys to import as in the example below:
   357  
   358  ```yaml
   359  # parent's requirements.yaml file
   360      ...
   361      import-values:
   362        - data
   363  ```
   364  
   365  ```yaml
   366  # child's values.yaml file
   367  ...
   368  exports:
   369    data:
   370      myint: 99
   371  ```
   372  
   373  Since we are specifying the key `data` in our import list, Helm looks in the `exports` field of the child
   374  chart for `data` key and imports its contents.
   375  
   376  The final parent values would contain our exported field:
   377  
   378  ```yaml
   379  # parent's values file
   380  ...
   381  myint: 99
   382  
   383  ```
   384  
   385  Please note the parent key `data` is not contained in the parent's final values. If you need to specify the
   386  parent key, use the 'child-parent' format.
   387  
   388  ##### Using the child-parent format
   389  
   390  To access values that are not contained in the `exports` key of the child chart's values, you will need to
   391  specify the source key of the values to be imported (`child`) and the destination path in the parent chart's
   392  values (`parent`).
   393  
   394  The `import-values` in the example below instructs Helm to take any values found at `child:` path and copy them
   395  to the parent's values at the path specified in `parent:`
   396  
   397  ```yaml
   398  # parent's requirements.yaml file
   399  dependencies:
   400    - name: subchart1
   401      repository: http://localhost:10191
   402      version: 0.1.0
   403      ...
   404      import-values:
   405        - child: default.data
   406          parent: myimports
   407  ```
   408  
   409  In the above example, values found at `default.data` in the subchart1's values will be imported
   410  to the `myimports` key in the parent chart's values as detailed below:
   411  
   412  ```yaml
   413  # parent's values.yaml file
   414  
   415  myimports:
   416    myint: 0
   417    mybool: false
   418    mystring: "helm rocks!"
   419  
   420  ```
   421  
   422  ```yaml
   423  # subchart1's values.yaml file
   424  
   425  default:
   426    data:
   427      myint: 999
   428      mybool: true
   429  
   430  ```
   431  
   432  The parent chart's resulting values would be:
   433  
   434  ```yaml
   435  # parent's final values
   436  
   437  myimports:
   438    myint: 999
   439    mybool: true
   440    mystring: "helm rocks!"
   441  
   442  ```
   443  
   444  The parent's final values now contains the `myint` and `mybool` fields imported from subchart1.
   445  
   446  ### Managing Dependencies manually via the `charts/` directory
   447  
   448  If more control over dependencies is desired, these dependencies can
   449  be expressed explicitly by copying the dependency charts into the
   450  `charts/` directory.
   451  
   452  A dependency can be either a chart archive (`foo-1.2.3.tgz`) or an
   453  unpacked chart directory. But its name cannot start with `_` or `.`.
   454  Such files are ignored by the chart loader.
   455  
   456  For example, if the WordPress chart depends on the Apache chart, the
   457  Apache chart (of the correct version) is supplied in the WordPress
   458  chart's `charts/` directory:
   459  
   460  ```
   461  wordpress:
   462    Chart.yaml
   463    requirements.yaml
   464    # ...
   465    charts/
   466      apache/
   467        Chart.yaml
   468        # ...
   469      mysql/
   470        Chart.yaml
   471        # ...
   472  ```
   473  
   474  The example above shows how the WordPress chart expresses its dependency
   475  on Apache and MySQL by including those charts inside of its `charts/`
   476  directory.
   477  
   478  **TIP:** _To drop a dependency into your `charts/` directory, use the
   479  `helm fetch` command_
   480  
   481  ### Operational aspects of using dependencies
   482  
   483  The above sections explain how to specify chart dependencies, but how does this affect
   484  chart installation using `helm install` and `helm upgrade`?
   485  
   486  Suppose that a chart named "A" creates the following Kubernetes objects
   487  
   488  - namespace "A-Namespace"
   489  - statefulset "A-StatefulSet"
   490  - service "A-Service"
   491  
   492  Furthermore, A is dependent on chart B that creates objects
   493  
   494  - namespace "B-Namespace"
   495  - replicaset "B-ReplicaSet"
   496  - service "B-Service"
   497  
   498  After installation/upgrade of chart A, a single Helm release is created/modified. The release will
   499  create/update all of the above Kubernetes objects in the following order:
   500  
   501  - A-Namespace
   502  - B-Namespace
   503  - A-StatefulSet
   504  - B-ReplicaSet
   505  - A-Service
   506  - B-Service
   507  
   508  This is because when Helm installs/upgrades charts,
   509  the Kubernetes objects from the charts and all its dependencies are
   510  
   511  - aggregated into a single set; then
   512  - sorted by type followed by name; and then
   513  - created/updated in that order.
   514  
   515  Hence a single release is created with all the objects for the chart and its dependencies.
   516  
   517  The install order of Kubernetes types is given by the enumeration InstallOrder in kind_sorter.go
   518  (see [the Helm source file](https://github.com/helm/helm/blob/master/pkg/tiller/kind_sorter.go#L26)).
   519  
   520  ## Templates and Values
   521  
   522  Helm Chart templates are written in the
   523  [Go template language](https://golang.org/pkg/text/template/), with the
   524  addition of 50 or so add-on template
   525  functions [from the Sprig library](https://github.com/Masterminds/sprig) and a
   526  few other [specialized functions](charts_tips_and_tricks.md).
   527  
   528  All template files are stored in a chart's `templates/` folder. When
   529  Helm renders the charts, it will pass every file in that directory
   530  through the template engine.
   531  
   532  Values for the templates are supplied two ways:
   533  
   534  - Chart developers may supply a file called `values.yaml` inside of a
   535    chart. This file can contain default values.
   536  - Chart users may supply a YAML file that contains values. This can be
   537    provided on the command line with `helm install`.
   538  
   539  When a user supplies custom values, these values will override the
   540  values in the chart's `values.yaml` file.
   541  
   542  ### Template Files
   543  
   544  Template files follow the standard conventions for writing Go templates
   545  (see [the text/template Go package documentation](https://golang.org/pkg/text/template/)
   546  for details).
   547  An example template file might look something like this:
   548  
   549  ```yaml
   550  apiVersion: v1
   551  kind: ReplicationController
   552  metadata:
   553    name: deis-database
   554    namespace: deis
   555    labels:
   556      app.kubernetes.io/managed-by: deis
   557  spec:
   558    replicas: 1
   559    selector:
   560      app.kubernetes.io/name: deis-database
   561    template:
   562      metadata:
   563        labels:
   564          app.kubernetes.io/name: deis-database
   565      spec:
   566        serviceAccount: deis-database
   567        containers:
   568          - name: deis-database
   569            image: {{.Values.imageRegistry}}/postgres:{{.Values.dockerTag}}
   570            imagePullPolicy: {{.Values.pullPolicy}}
   571            ports:
   572              - containerPort: 5432
   573            env:
   574              - name: DATABASE_STORAGE
   575                value: {{default "minio" .Values.storage}}
   576  ```
   577  
   578  The above example, based loosely on [https://github.com/deis/charts](https://github.com/deis/charts), is a template for a Kubernetes replication controller.
   579  It can use the following four template values (usually defined in a
   580  `values.yaml` file):
   581  
   582  - `imageRegistry`: The source registry for the Docker image.
   583  - `dockerTag`: The tag for the docker image.
   584  - `pullPolicy`: The Kubernetes pull policy.
   585  - `storage`: The storage backend, whose default is set to `"minio"`
   586  
   587  All of these values are defined by the template author. Helm does not
   588  require or dictate parameters.
   589  
   590  To see many working charts, check out the [Helm Charts
   591  project](https://github.com/helm/charts)
   592  
   593  ### Predefined Values
   594  
   595  Values that are supplied via a `values.yaml` file (or via the `--set`
   596  flag) are accessible from the `.Values` object in a template. But there
   597  are other pre-defined pieces of data you can access in your templates.
   598  
   599  The following values are pre-defined, are available to every template, and
   600  cannot be overridden. As with all values, the names are _case
   601  sensitive_.
   602  
   603  - `Release.Name`: The name of the release (not the chart)
   604  - `Release.Time`: The time the chart release was last updated. This will
   605    match the `Last Released` time on a Release object.
   606  - `Release.Namespace`: The namespace the chart was released to.
   607  - `Release.Service`: The service that conducted the release. Usually
   608    this is `Tiller`.
   609  - `Release.IsUpgrade`: This is set to true if the current operation is an upgrade or rollback.
   610  - `Release.IsInstall`: This is set to true if the current operation is an
   611    install.
   612  - `Release.Revision`: The revision number. It begins at 1, and increments with
   613    each `helm upgrade`.
   614  - `Chart`: The contents of the `Chart.yaml`. Thus, the chart version is
   615    obtainable as `Chart.Version` and the maintainers are in
   616    `Chart.Maintainers`.
   617  - `Files`: A map-like object containing all non-special files in the chart. This
   618    will not give you access to templates, but will give you access to additional
   619    files that are present (unless they are excluded using `.helmignore`). Files can be
   620    accessed using `{{index .Files "file.name"}}` or using the `{{.Files.Get name}}` or
   621    `{{.Files.GetString name}}` functions. You can also access the contents of the file
   622    as `[]byte` using `{{.Files.GetBytes}}`
   623  - `Capabilities`: A map-like object that contains information about the versions
   624    of Kubernetes (`{{.Capabilities.KubeVersion}}`, Tiller
   625    (`{{.Capabilities.TillerVersion}}`, and the supported Kubernetes API versions
   626    (`{{.Capabilities.APIVersions.Has "batch/v1"`)
   627  
   628  **NOTE:** Any unknown Chart.yaml fields will be dropped. They will not
   629  be accessible inside of the `Chart` object. Thus, Chart.yaml cannot be
   630  used to pass arbitrarily structured data into the template. The values
   631  file can be used for that, though.
   632  
   633  ### Values files
   634  
   635  Considering the template in the previous section, a `values.yaml` file
   636  that supplies the necessary values would look like this:
   637  
   638  ```yaml
   639  imageRegistry: "quay.io/deis"
   640  dockerTag: "latest"
   641  pullPolicy: "Always"
   642  storage: "s3"
   643  ```
   644  
   645  A values file is formatted in YAML. A chart may include a default
   646  `values.yaml` file. The Helm install command allows a user to override
   647  values by supplying additional YAML values:
   648  
   649  ```console
   650  $ helm install --values=myvals.yaml wordpress
   651  ```
   652  
   653  When values are passed in this way, they will be merged into the default
   654  values file. For example, consider a `myvals.yaml` file that looks like
   655  this:
   656  
   657  ```yaml
   658  storage: "gcs"
   659  ```
   660  
   661  When this is merged with the `values.yaml` in the chart, the resulting
   662  generated content will be:
   663  
   664  ```yaml
   665  imageRegistry: "quay.io/deis"
   666  dockerTag: "latest"
   667  pullPolicy: "Always"
   668  storage: "gcs"
   669  ```
   670  
   671  Note that only the last field was overridden.
   672  
   673  **NOTE:** The default values file included inside of a chart _must_ be named
   674  `values.yaml`. But files specified on the command line can be named
   675  anything.
   676  
   677  **NOTE:** If the `--set` flag is used on `helm install` or `helm upgrade`, those
   678  values are simply converted to YAML on the client side.
   679  
   680  **NOTE:** If any required entries in the values file exist, they can be declared
   681  as required in the chart template by using the ['required' function](charts_tips_and_tricks.md)
   682  
   683  Any of these values are then accessible inside of templates using the
   684  `.Values` object:
   685  
   686  ```yaml
   687  apiVersion: v1
   688  kind: ReplicationController
   689  metadata:
   690    name: deis-database
   691    namespace: deis
   692    labels:
   693      app.kubernetes.io/managed-by: deis
   694  spec:
   695    replicas: 1
   696    selector:
   697      app.kubernetes.io/name: deis-database
   698    template:
   699      metadata:
   700        labels:
   701          app.kubernetes.io/name: deis-database
   702      spec:
   703        serviceAccount: deis-database
   704        containers:
   705          - name: deis-database
   706            image: {{.Values.imageRegistry}}/postgres:{{.Values.dockerTag}}
   707            imagePullPolicy: {{.Values.pullPolicy}}
   708            ports:
   709              - containerPort: 5432
   710            env:
   711              - name: DATABASE_STORAGE
   712                value: {{default "minio" .Values.storage}}
   713  
   714  ```
   715  
   716  ### Scope, Dependencies, and Values
   717  
   718  Values files can declare values for the top-level chart, as well as for
   719  any of the charts that are included in that chart's `charts/` directory.
   720  Or, to phrase it differently, a values file can supply values to the
   721  chart as well as to any of its dependencies. For example, the
   722  demonstration WordPress chart above has both `mysql` and `apache` as
   723  dependencies. The values file could supply values to all of these
   724  components:
   725  
   726  ```yaml
   727  title: "My WordPress Site" # Sent to the WordPress template
   728  
   729  mysql:
   730    max_connections: 100 # Sent to MySQL
   731    password: "secret"
   732  
   733  apache:
   734    port: 8080 # Passed to Apache
   735  ```
   736  
   737  Charts at a higher level have access to all of the variables defined
   738  beneath. So the WordPress chart can access the MySQL password as
   739  `.Values.mysql.password`. But lower level charts cannot access things in
   740  parent charts, so MySQL will not be able to access the `title` property. Nor,
   741  for that matter, can it access `apache.port`.
   742  
   743  Values are namespaced, but namespaces are pruned. So for the WordPress
   744  chart, it can access the MySQL password field as `.Values.mysql.password`. But
   745  for the MySQL chart, the scope of the values has been reduced and the
   746  namespace prefix removed, so it will see the password field simply as
   747  `.Values.password`.
   748  
   749  #### Global Values
   750  
   751  As of 2.0.0-Alpha.2, Helm supports special "global" value. Consider
   752  this modified version of the previous example:
   753  
   754  ```yaml
   755  title: "My WordPress Site" # Sent to the WordPress template
   756  
   757  global:
   758    app: MyWordPress
   759  
   760  mysql:
   761    max_connections: 100 # Sent to MySQL
   762    password: "secret"
   763  
   764  apache:
   765    port: 8080 # Passed to Apache
   766  ```
   767  
   768  The above adds a `global` section with the value `app: MyWordPress`.
   769  This value is available to _all_ charts as `.Values.global.app`.
   770  
   771  For example, the `mysql` templates may access `app` as `{{.Values.global.app}}`, and
   772  so can the `apache` chart. Effectively, the values file above is
   773  regenerated like this:
   774  
   775  ```yaml
   776  title: "My WordPress Site" # Sent to the WordPress template
   777  
   778  global:
   779    app: MyWordPress
   780  
   781  mysql:
   782    global:
   783      app: MyWordPress
   784    max_connections: 100 # Sent to MySQL
   785    password: "secret"
   786  
   787  apache:
   788    global:
   789      app: MyWordPress
   790    port: 8080 # Passed to Apache
   791  ```
   792  
   793  This provides a way of sharing one top-level variable with all
   794  subcharts, which is useful for things like setting `metadata` properties
   795  like labels.
   796  
   797  If a subchart declares a global variable, that global will be passed
   798  _downward_ (to the subchart's subcharts), but not _upward_ to the parent
   799  chart. There is no way for a subchart to influence the values of the
   800  parent chart.
   801  
   802  Also, global variables of parent charts take precedence over the global variables from subcharts.
   803  
   804  ### References
   805  
   806  When it comes to writing templates and values files, there are several
   807  standard references that will help you out.
   808  
   809  - [Go templates](https://godoc.org/text/template)
   810  - [Extra template functions](https://godoc.org/github.com/Masterminds/sprig)
   811  - [The YAML format](https://yaml.org/spec/)
   812  
   813  ## Using Helm to Manage Charts
   814  
   815  The `helm` tool has several commands for working with charts.
   816  
   817  It can create a new chart for you:
   818  
   819  ```console
   820  $ helm create mychart
   821  Created mychart/
   822  ```
   823  
   824  Once you have edited a chart, `helm` can package it into a chart archive
   825  for you:
   826  
   827  ```console
   828  $ helm package mychart
   829  Archived mychart-0.1.-.tgz
   830  ```
   831  
   832  You can also use `helm` to help you find issues with your chart's
   833  formatting or information:
   834  
   835  ```console
   836  $ helm lint mychart
   837  No issues found
   838  ```
   839  
   840  ## Chart Repositories
   841  
   842  A _chart repository_ is an HTTP server that houses one or more packaged
   843  charts. While `helm` can be used to manage local chart directories, when
   844  it comes to sharing charts, the preferred mechanism is a chart
   845  repository.
   846  
   847  Any HTTP server that can serve YAML files and tar files and can answer
   848  GET requests can be used as a repository server.
   849  
   850  Helm comes with built-in package server for developer testing (`helm
   851  serve`). The Helm team has tested other servers, including Google Cloud
   852  Storage with website mode enabled, and S3 with website mode enabled.
   853  
   854  A repository is characterized primarily by the presence of a special
   855  file called `index.yaml` that has a list of all of the packages supplied
   856  by the repository, together with metadata that allows retrieving and
   857  verifying those packages.
   858  
   859  On the client side, repositories are managed with the `helm repo`
   860  commands. However, Helm does not provide tools for uploading charts to
   861  remote repository servers. This is because doing so would add
   862  substantial requirements to an implementing server, and thus raise the
   863  barrier for setting up a repository.
   864  
   865  ## Chart Starter Packs
   866  
   867  The `helm create` command takes an optional `--starter` option that lets you
   868  specify a "starter chart".
   869  
   870  Starters are just regular charts, but are located in `$HELM_HOME/starters`.
   871  As a chart developer, you may author charts that are specifically designed
   872  to be used as starters. Such charts should be designed with the following
   873  considerations in mind:
   874  
   875  - The `Chart.yaml` will be overwritten by the generator.
   876  - Users will expect to modify such a chart's contents, so documentation
   877    should indicate how users can do so.
   878  - All occurrences of `<CHARTNAME>` in files within the `templates` directory
   879    will be replaced with the specified chart name so that starter charts can be
   880    used as templates. Additionally, occurrences of `<CHARTNAME>` in
   881    `values.yaml` will also be replaced.
   882  
   883  Currently the only way to add a chart to `$HELM_HOME/starters` is to manually
   884  copy it there. In your chart's documentation, you may want to explain that
   885  process.