Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add toYaml and fromYaml example #230

Merged
merged 4 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add example
  • Loading branch information
ebuildy committed May 11, 2024
commit 5ed2562e7f6a84593904683c2c338f3c87ab8963
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
36 changes: 36 additions & 0 deletions example-charts/use-yaml-file/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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 |

## 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 |
|-----|------|---------|-------------|
| volumeSnapshotClass.azure.parameters | object | `{}` | |
| volumeSnapshotClass.local.parameters | object | `{}` | |
| volumeSnapshotClass.mask-data.parameters.resourceGroup | string | `"rg-mask-data"` | |

33 changes: 33 additions & 0 deletions example-charts/use-yaml-file/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{ 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 }}

## 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" . }}
10 changes: 10 additions & 0 deletions example-charts/use-yaml-file/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
volumeSnapshotClass:
azure:
parameters: {}

local:
parameters: {}

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