norwoodj/helm-docs

Add support for conditional dependencies

johbo opened this issue · 0 comments

johbo commented

It would be great to have support for the attribute condition in the dependencies section. Then the value of the condition could be rendered into the output.

The below example shows a case from a chart which I am currently working on, it's allowing to bundle the database for ease of use. Showing that this is a conditional dependencies and showing the value of the condition would be of value to users who study the file README.md.

Example:

dependencies:
  - name: "common"
    repository: "https://charts.bitnami.com/bitnami"
    version: "^2.2.2"
  - name: "postgresql"
    repository: "https://charts.bitnami.com/bitnami"
    version: "^12.2.1"
    condition: "postgresql.bundled"

Using {{ . | toPrettyJson }} I found that only the following data is available for the template:

  "Dependencies": [
    {
      "Name": "common",
      "Version": "^2.2.2",
      "Repository": "https://charts.bitnami.com/bitnami",
      "Alias": ""
    },
    {
      "Name": "postgresql",
      "Version": "^12.2.1",
      "Repository": "https://charts.bitnami.com/bitnami",
      "Alias": ""
    }
  ],

Staying consistent with the naming scheme, the new attribute should be called Condition.

The new default templates could render this as follows:

| Repository | Name | Version | Condition |
|------------|------|---------|-----------|
| https://charts.bitnami.com/bitnami | common | ^2.2.2 | |
| https://charts.bitnami.com/bitnami | postgresql | ^12.2.1 | `postgresql.bundled` |