You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-28
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ GO111MODULE=on go get github.com/norwoodj/helm-docs/cmd/helm-docs
53
53
54
54
## Usage
55
55
56
-
## Pre-commit hook
56
+
### Pre-commit hook
57
57
58
58
If you want to automatically generate `README.md` files with a pre-commit hook, make sure you
59
59
[install the pre-commit binary](https://pre-commit.com/#install), and add a [.pre-commit-config.yaml file](./.pre-commit-config.yaml)
@@ -66,7 +66,7 @@ pre-commit install-hooks
66
66
67
67
Future changes to your chart's `requirements.yaml`, `values.yaml`, `Chart.yaml`, or `README.md.gotmpl` files will cause an update to documentation when you commit.
68
68
69
-
## Running the binary directly
69
+
### Running the binary directly
70
70
71
71
To run and generate documentation into READMEs for all helm charts within or recursively contained by a directory:
72
72
@@ -79,7 +79,7 @@ helm-docs --dry-run # prints generated documentation to stdout rather than modif
79
79
The tool searches recursively through subdirectories of the current directory for `Chart.yaml` files and generates documentation
80
80
for every chart that it finds.
81
81
82
-
## Using docker
82
+
### Using docker
83
83
84
84
You can mount a directory with charts under `/helm-docs` within the container.
85
85
@@ -89,7 +89,7 @@ Then run:
89
89
docker run --rm --volume "$(pwd):/helm-docs" -u $(id -u) jnorwood/helm-docs:latest
90
90
```
91
91
92
-
# Building from source
92
+
### Building from source
93
93
Notice that you need to have build chain toolkit for given platform and golang installed.
94
94
Next you may need to export some vars to build standalone, non-linked binary for given platform and architecture:
95
95
@@ -101,26 +101,35 @@ make test
101
101
make
102
102
```
103
103
104
-
## Available Templates
105
-
The templates generated by the tool are shown below, and can be included in your `README.md.gotmpl` file like so:
104
+
## Ignoring Chart Directories
105
+
helm-docs supports a `.helmdocsignore` file, exactly like a `.gitignore` file in which one can specify directories to ignore
106
+
when searching for charts. Directories specified need not be charts themselves, so parent directories containing potentially
107
+
many charts can be ignored and none of the charts underneath them will be processed. You may also directly reference the
108
+
Chart.yaml file for a chart to skip processing for it.
109
+
110
+
111
+
## Markdown Rendering
112
+
The helm-docs tool uses go-templates to render output documentation. There are a number of sub-templates that are
113
+
referenced in the internal default template and can be used by custom `README.md.gotmpl` templates your repository provides as well.
114
+
115
+
Templates can be invoked like so:
106
116
```
107
117
{{ template "template-name" . }}
108
118
```
109
119
120
+
And the complete listing of available templates is below:
121
+
110
122
| Name | Description |
111
123
|------|-------------|
112
124
| chart.header | The main heading of the generated markdown file |
113
125
| chart.name | The _name_ field from the chart's `Chart.yaml` file |
114
126
| chart.deprecationWarning | A deprecation warning which is displayed when the _deprecated_ field from the chart's `Chart.yaml` file is `true` |
115
127
| chart.description | A description line containing the _description_ field from the chart's `Chart.yaml` file, or "" if that field is not set |
116
128
| chart.version | The _version_ field from the chart's `Chart.yaml` file |
117
-
| chart.versionLine | A text line stating the current version of the chart |
118
129
| chart.versionBadge | A badge stating the current version of the chart |
119
130
| chart.type | The _type_ field from the chart's `Chart.yaml` file |
120
-
| chart.typeLine | A text line stating the current type of the chart |
121
131
| chart.typeBadge | A badge stating the current type of the chart |
122
132
| chart.appVersion | The _appVersion_ field from the chart's `Chart.yaml` file |
123
-
| chart.appVersionLine | A text line stating the current appVersion of the chart |
124
133
| chart.appVersionBadge | A badge stating the current appVersion of the chart |
125
134
| chart.homepage | The _home_ link from the chart's `Chart.yaml` file, or "" if that field is not set |
126
135
| chart.homepageLine | A text line stating the current homepage of the chart |
@@ -167,14 +176,7 @@ The tool includes the [sprig templating library](https://github.com/Masterminds/
167
176
in the templates you supply.
168
177
169
178
170
-
## Ignoring Chart Directories
171
-
helm-docs supports a `.helmdocsignore` file, exactly like a `.gitignore` file in which one can specify directories to ignore
172
-
when searching for charts. Directories specified need not be charts themselves, so parent directories containing potentially
173
-
many charts can be ignored and none of the charts underneath them will be processed. You may also directly reference the
174
-
Chart.yaml file for a chart to skip processing for it.
175
-
176
-
177
-
## values.yaml metadata
179
+
### values.yaml metadata
178
180
This tool can parse descriptions and defaults of values from `values.yaml` files. The defaults are pulled directly from
179
181
the yaml in the file.
180
182
@@ -199,21 +201,19 @@ controller:
199
201
# -- Whether to expose the ingress controller to the public world
200
202
enabled: false
201
203
202
-
# -- Number of nginx-ingress pods to load balance between. Do not set this below 2.
204
+
# -- Number of nginx-ingress pods to load balance between.
205
+
# Do not set this below 2.
203
206
replicas: 2
204
207
```
205
208
206
-
There are a number of limitations to this comment format, the foremost being that they can only comprise a single line and while
207
-
the old-style comment for a field could appear anywhere in the file, the new comment must appear **on the line immediately preceding the field being documented.**
208
-
209
-
Additionally, there are a number of methods for encoding more data in the old comment format, documented later in this guide. These
210
-
extensions are largely not supported with the new _auto-detection_ format.
209
+
New-style comments are much the same as the old-style comments, except that while old comments for a field could appear
210
+
anywhere in the file, new-style comments must appear **on the line(s) immediately preceding the field being documented.**
211
211
212
212
I invite you to check out the [example-charts](./example-charts) to see how this is done in practice. The `but-auto-comments`
213
213
examples in particular document the new comment format.
214
214
215
-
Note that comments of the old form can continue on the next line. In that case leave out the double dash, and the lines
216
-
will simply be appended with a space in-between.
215
+
Note that comments can continue on the next line. In that case leave out the double dash, and the lines will simply be
216
+
appended with a space in-between, as in the `controller.replicas` field in the example above
217
217
218
218
The following rules are used to determine which values will be added to the values table in the README:
219
219
@@ -283,13 +283,14 @@ inside the chart, you can change the contents of the column like so:
283
283
284
284
```yaml
285
285
service:
286
-
# service.annotations -- Add annotations to the service
286
+
# -- Add annotations to the service, this is going to be a long comment across multiple lines
287
+
# but that's fine, these will be concatenated and the @default will be rendered as the default for this field
287
288
# @default -- the chart will add some internal annotations automatically
288
289
annotations: []
289
290
```
290
291
291
-
The order is important. The name must be spelled just like the column heading. The first comment must be the
292
-
one specifying the key. The "@default" comment must follow. This is only possible with the old comment format
292
+
The order is important. The first comment line(s) must be the one specifying the key or using the auto-detection feature and
293
+
the description for the field. The `@default` comment must follow.
293
294
294
295
See [here](./example-charts/custom-template/values.yaml) for an example.
Copy file name to clipboardExpand all lines: example-charts/nginx-ingress-but-auto-comments/README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -34,8 +34,8 @@ A simple wrapper around the stable/nginx-ingress chart that adds a few of our co
34
34
| controller.livenessProbe.httpGet.path | string |`"/healthz"`| This is the liveness check endpoint |
35
35
| controller.name | string |`"controller"`||
36
36
| controller.persistentVolumeClaims | list |`[]`| List of persistent volume claims to create |
37
-
| controller.podLabels | object |`{}`| The labels to be applied to instances of the controller pod |
37
+
| controller.podLabels | object |A number of chart-specific labels | The labels to be applied to instances of the controller pod. By default, a number of labels will automatically be applied|
38
38
| controller.publishService.enabled | bool |`false`| Whether to expose the ingress controller to the public world |
39
-
| controller.replicas | int |`nil`| Number of nginx-ingress pods to load balance between |
39
+
| controller.replicas | int |`nil`| Number of nginx-ingress pods to load balance between. Do not set this below 2|
40
40
| controller.service.annotations."external-dns.alpha.kubernetes.io/hostname" | string |`"stupidchess.jmn23.com"`| Hostname to be assigned to the ELB for the service |
0 commit comments