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