Skip to content

Commit dfda890

Browse files
authored
Add Mintlify helm-docs template for k8s-reporter (#854)
Add a second helm-docs template set that generates Mintlify-compatible output with <ParamField> components for the configurations section and an <Info> version callout. The prose sections (install, upgrade, customCA, etc.) are shared with the existing README template to avoid duplication. Also fix two Mintlify-compatibility issues in the shared templates: - Remove {.command} Hugo attribute from shell code fences - Wrap <instance_name> in backticks in values.yaml env description Closes #853
1 parent 105c44c commit dfda890

4 files changed

Lines changed: 138 additions & 7 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: Kubernetes Reporter Helm Chart
3+
description: A Helm chart for installing the Kosli K8S reporter as a cronjob.
4+
---
5+
6+
{{ template "chart.header" . }}
7+
8+
{{ template "mintlify.versionInfo" . }}
9+
10+
{{ template "chart.description" . }}
11+
{{ template "extra.longdescription" . }}
12+
13+
{{ template "extra.prerequisites" . }}
14+
15+
{{ template "extra.install" . }}
16+
17+
{{ template "extra.upgrade" . }}
18+
19+
{{ template "extra.uninstall" . }}
20+
21+
{{ template "extra.customCA" . }}
22+
23+
{{ template "mintlify.configurations" . }}
24+
25+
---
26+
27+
{{ template "helm-docs.versionFooter" . }}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{{ define "mintlify.versionInfo" -}}
2+
<Info>
3+
This reference applies to **chart version {{ .Version }}**, which defaults to CLI **{{ .AppVersion }}** via `appVersion`. Override with `image.tag`.
4+
</Info>
5+
{{- end }}
6+
7+
{{ define "mintlify.configurations" -}}
8+
## Configurations
9+
10+
### General
11+
12+
{{ range .Values -}}
13+
{{ if not (or (hasPrefix "image." .Key) (hasPrefix "reporterConfig." .Key) (hasPrefix "kosliApiToken." .Key) (hasPrefix "customCA" .Key) (hasPrefix "resources." .Key) (hasPrefix "serviceAccount." .Key) (eq "env" .Key) (eq "extraEnvVars" .Key) (eq "extraVolumes" .Key) (eq "extraVolumeMounts" .Key)) -}}
14+
{{ template "mintlify.paramField" . }}
15+
16+
{{ end -}}
17+
{{ end -}}
18+
19+
### Image
20+
21+
{{ range .Values -}}
22+
{{ if hasPrefix "image." .Key -}}
23+
{{ template "mintlify.paramField" . }}
24+
25+
{{ end -}}
26+
{{ end -}}
27+
28+
### Reporter configuration
29+
30+
{{ range .Values -}}
31+
{{ if hasPrefix "reporterConfig." .Key -}}
32+
{{ template "mintlify.paramField" . }}
33+
34+
{{ end -}}
35+
{{ end -}}
36+
37+
### Kosli API token
38+
39+
{{ range .Values -}}
40+
{{ if hasPrefix "kosliApiToken." .Key -}}
41+
{{ template "mintlify.paramField" . }}
42+
43+
{{ end -}}
44+
{{ end -}}
45+
46+
### Environment variables
47+
48+
{{ range .Values -}}
49+
{{ if or (eq "env" .Key) (eq "extraEnvVars" .Key) -}}
50+
{{ template "mintlify.paramField" . }}
51+
52+
{{ end -}}
53+
{{ end -}}
54+
55+
### Volumes
56+
57+
{{ range .Values -}}
58+
{{ if or (eq "extraVolumes" .Key) (eq "extraVolumeMounts" .Key) -}}
59+
{{ template "mintlify.paramField" . }}
60+
61+
{{ end -}}
62+
{{ end -}}
63+
64+
### Custom CA
65+
66+
{{ range .Values -}}
67+
{{ if hasPrefix "customCA" .Key -}}
68+
{{ template "mintlify.paramField" . }}
69+
70+
{{ end -}}
71+
{{ end -}}
72+
73+
### Resources
74+
75+
{{ range .Values -}}
76+
{{ if hasPrefix "resources." .Key -}}
77+
{{ template "mintlify.paramField" . }}
78+
79+
{{ end -}}
80+
{{ end -}}
81+
82+
### Service account
83+
84+
{{ range .Values -}}
85+
{{ if hasPrefix "serviceAccount." .Key -}}
86+
{{ template "mintlify.paramField" . }}
87+
88+
{{ end -}}
89+
{{ end -}}
90+
{{- end }}
91+
92+
{{ define "mintlify.paramField" -}}
93+
{{- $d := .Default | trimPrefix "`" | trimSuffix "`" -}}
94+
{{- $desc := or .Description .AutoDescription -}}
95+
{{- if or (and (eq .Type "object") (ne $d "{}")) (and (eq .Type "list") (ne $d "[]")) }}
96+
<ParamField path="{{ .Key }}" type="{{ .Type }}">
97+
{{ $desc }}
98+
</ParamField>
99+
{{- else }}
100+
<ParamField path="{{ .Key }}" type="{{ .Type }}" default="{{ $d | trimPrefix "\"" | trimSuffix "\"" }}">
101+
{{ $desc }}
102+
</ParamField>
103+
{{- end }}
104+
{{- end }}

charts/k8s-reporter/_templates.gotmpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ Version 2.0.0 removes the previous single-environment mode (`kosliEnvironmentNam
2323
To install this chart via the Helm chart repository:
2424

2525
1. Add the Kosli helm repo
26-
```shell {.command}
26+
```shell
2727
helm repo add kosli https://charts.kosli.com/ && helm repo update
2828
```
2929

3030
2. Create a secret for the Kosli API token
31-
```shell {.command}
31+
```shell
3232
kubectl create secret generic kosli-api-token --from-literal=key=<your-api-key>
3333
```
3434

@@ -70,7 +70,7 @@ reporterConfig:
7070
excludeNamespaces: [prod-ns1, prod-ns2, default]
7171
```
7272

73-
```shell {.command}
73+
```shell
7474
helm install kosli-reporter kosli/k8s-reporter -f values.yaml
7575
```
7676

@@ -85,15 +85,15 @@ helm install kosli-reporter kosli/k8s-reporter -f values.yaml
8585

8686
If upgrading from v1.x to v2.0.0, migrate your values to the **environments** list format (see above). Then:
8787

88-
```shell {.command}
88+
```shell
8989
helm upgrade kosli-reporter kosli/k8s-reporter -f values.yaml
9090
```
9191
{{- end }}
9292

9393
{{ define "extra.uninstall" -}}
9494
## Uninstalling chart
9595

96-
```shell {.command}
96+
```shell
9797
helm uninstall kosli-reporter
9898
```
9999
{{- end }}
@@ -109,7 +109,7 @@ The chart offers two ways to do this. Use whichever fits your deployment flow.
109109

110110
1. Create a Secret containing the corporate CA certificate (PEM format, single cert or bundle):
111111

112-
```shell {.command}
112+
```shell
113113
kubectl create secret generic corporate-ca-bundle --from-file=ca.crt=/path/to/corporate-ca.crt
114114
```
115115

charts/k8s-reporter/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ reporterConfig:
9292
runAsUser: 1000
9393

9494
# -- map of plain environment variables to inject into the reporter container.
95-
# For a single-tenant Kosli instance, set KOSLI_HOST to https://<instance_name>.kosli.com.
95+
# For a single-tenant Kosli instance, set `KOSLI_HOST` to `https://<instance_name>.kosli.com`.
9696
env: {}
9797

9898
# -- additional environment variables to inject into the reporter container.

0 commit comments

Comments
 (0)