Skip to content

Commit

Permalink
Merge pull request #230 from ebuildy/feat_yaml_functions
Browse files Browse the repository at this point in the history
feat: add toYaml and fromYaml example
  • Loading branch information
norwoodj authored Jul 6, 2024
2 parents 65110a3 + e4cf274 commit 06560fd
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 1 deletion.
10 changes: 10 additions & 0 deletions example-charts/use-yaml-file/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
name: no-values
description: A very simple chart that doesn't even need any values for customization
version: "0.2.0"
home: "https://github.com/norwoodj/helm-docs/tree/master/example-charts/no-values"
sources: ["https://github.com/norwoodj/helm-docs/tree/master/example-charts/no-values"]
engine: gotpl
maintainers:
- email: norwood.john.m@gmail.com
name: John Norwood
46 changes: 46 additions & 0 deletions example-charts/use-yaml-file/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# no-values

A very simple chart that doesn't even need any values for customization

![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square)

## Additional Information

### Snapshot classes

| name | resource group | incremental |
|----------|----------------|-------------|
| azure-incr | true | |
| azure | false | |
| local-incr | true | |
| local | false | |
| mask-data-incr | true | rg-mask-data |
| mask-data | false | rg-mask-data |

### Default resources

```yaml
requests:
cpu: 10m
memory: 100m
```
## Installing the Chart
To install the chart with the release name `my-release`:

```console
$ helm repo add foo-bar http://charts.foo-bar.com
$ helm install my-release foo-bar/no-values
```

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| resources.requests.cpu | string | `"10m"` | |
| resources.requests.memory | string | `"100m"` | |
| volumeSnapshotClass.azure.parameters | object | `{}` | |
| volumeSnapshotClass.local.parameters | object | `{}` | |
| volumeSnapshotClass.mask-data.parameters.resourceGroup | string | `"rg-mask-data"` | |

39 changes: 39 additions & 0 deletions example-charts/use-yaml-file/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{ template "chart.header" . }}
{{ template "chart.description" . }}

{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}

## Additional Information

{{ $values := (.Files.Get "values.yaml") | fromYaml }}

### Snapshot classes

| name | resource group | incremental |
|----------|----------------|-------------|
{{- range $name, $spec := $values.volumeSnapshotClass }}
{{- range $parameterIncr := list "true" "false" }}
| {{ $name }}{{- if eq $parameterIncr "true" -}}-incr{{- end }} | {{ $parameterIncr }} | {{ $spec.parameters.resourceGroup | default "" }} |
{{- end }}
{{- end }}

### Default resources

```yaml
{{ $values.resources | toYaml }}
```

## Installing the Chart

To install the chart with the release name `my-release`:

```console
$ helm repo add foo-bar http://charts.foo-bar.com
$ helm install my-release foo-bar/{{ template "chart.name" . }}
```

{{ template "chart.requirementsSection" . }}

{{ template "chart.valuesSection" . }}

{{ template "helm-docs.versionFooter" . }}
15 changes: 15 additions & 0 deletions example-charts/use-yaml-file/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
volumeSnapshotClass:
azure:
parameters: {}

local:
parameters: {}

mask-data:
parameters:
resourceGroup: rg-mask-data

resources:
requests:
cpu: 10m
memory: 100m
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/norwoodj/helm-docs

go 1.22.0
go 1.22

require (
github.com/Masterminds/sprig/v3 v3.2.3
Expand Down

0 comments on commit 06560fd

Please sign in to comment.