Skip to content

Commit 95f2591

Browse files
authored
Merge pull request #101 from rollandf/helm-doc-fix
bug: fix object rendering in helm doc
2 parents c63aafd + 83aec5b commit 95f2591

File tree

3 files changed

+200
-36
lines changed

3 files changed

+200
-36
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,20 @@ copy-local-helm-chart: | $(HELM_CHART_DEP_ROOT) clean-helm-chart-dep-root
8181
cp -r $(HELM_CHART_PATH) $(HELM_CHART_DEP_ROOT)
8282

8383
# Generate helm chart documentation in a reStructuredText format.
84-
.PHONY: helm-docs
85-
helm-docs: | $(HELM_DOCS)
84+
.PHONY: gen-helm-docs
85+
gen-helm-docs: | $(HELM_DOCS)
8686
$(HELM_DOCS) --output-file=../../../../docs/customizations/helm.rst \
8787
--ignore-file=.helmdocsignore \
8888
--template-files=./templates/helm.rst.gotmpl ${HELM_CHART_DEP_ROOT}
8989

9090
.PHONY: ngc-helm-docs
91-
ngc-helm-docs: download-ngc-helm-chart helm-docs
91+
ngc-helm-docs: download-ngc-helm-chart gen-helm-docs
9292

9393
.PHONY: helm-docs
94-
helm-docs: download-helm-chart helm-docs
94+
helm-docs: download-helm-chart gen-helm-docs
9595

9696
.PHONY: local-helm-docs
97-
local-helm-docs: copy-local-helm-chart helm-docs
97+
local-helm-docs: copy-local-helm-chart gen-helm-docs
9898

9999
.PHONY: download-api
100100
download-api: | $(CRD_API_DEP_ROOT)

docs/customizations/helm.rst

Lines changed: 162 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,23 @@ General Parameters
6767
- `true`
6868
- Use cert-manager for generating self-signed certificate.
6969
* - operator.affinity.nodeAffinity
70-
- object
71-
- `{"preferredDuringSchedulingIgnoredDuringExecution":[{"preference":{"matchExpressions":[{"key":"node-role.kubernetes.io/master","operator":"In","values":[""]}]},"weight":1},{"preference":{"matchExpressions":[{"key":"node-role.kubernetes.io/control-plane","operator":"In","values":[""]}]},"weight":1}]}`
70+
- yaml
71+
- .. code-block:: yaml
72+
73+
preferredDuringSchedulingIgnoredDuringExecution:
74+
- weight: 1
75+
preference:
76+
matchExpressions:
77+
- key: "node-role.kubernetes.io/master"
78+
operator: In
79+
values: [""]
80+
- weight: 1
81+
preference:
82+
matchExpressions:
83+
- key: "node-role.kubernetes.io/control-plane"
84+
operator: In
85+
values: [""]
86+
7287
- Configure node affinity settings for the operator.
7388
* - operator.cniBinDirectory
7489
- string
@@ -95,12 +110,30 @@ General Parameters
95110
- `"nvcr.io/nvidia/cloud-native"`
96111
- Network Operator image repository.
97112
* - operator.resources
98-
- object
99-
- `{"limits":{"cpu":"500m","memory":"128Mi"},"requests":{"cpu":"5m","memory":"64Mi"}}`
113+
- yaml
114+
- .. code-block:: yaml
115+
116+
limits:
117+
cpu: 500m
118+
memory: 128Mi
119+
requests:
120+
cpu: 5m
121+
memory: 64Mi
122+
100123
- Optional `resource requests and limits <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/>`_ for the operator.
101124
* - operator.tolerations
102-
- list
103-
- `[{"effect":"NoSchedule","key":"node-role.kubernetes.io/master","operator":"Equal","value":""},{"effect":"NoSchedule","key":"node-role.kubernetes.io/control-plane","operator":"Equal","value":""}]`
125+
- yaml
126+
- .. code-block:: yaml
127+
128+
- key: "node-role.kubernetes.io/master"
129+
operator: "Equal"
130+
value: ""
131+
effect: "NoSchedule"
132+
- key: "node-role.kubernetes.io/control-plane"
133+
operator: "Equal"
134+
value: ""
135+
effect: "NoSchedule"
136+
104137
- Set additional tolerations for various Daemonsets deployed by the operator.
105138
* - operator.useDTK
106139
- bool
@@ -181,12 +214,44 @@ Node Feature Discovery Helm chart customization options can be found `here <http
181214
- `"node-feature-discovery"`
182215
- The name of the service account for garbage collector to use. If not set and create is true, a name is generated using the fullname template and -gc suffix.
183216
* - node-feature-discovery.master
184-
- object
185-
- `{"config":{"extraLabelNs":["nvidia.com"]},"serviceAccount":{"create":true,"name":"node-feature-discovery"}}`
217+
- yaml
218+
- .. code-block:: yaml
219+
220+
serviceAccount:
221+
name: node-feature-discovery
222+
create: true
223+
config:
224+
extraLabelNs: ["nvidia.com"]
225+
186226
- NFD master deployment configuration.
187227
* - node-feature-discovery.worker
188-
- object
189-
- `{"config":{"sources":{"pci":{"deviceClassWhitelist":["0300","0302"],"deviceLabelFields":["vendor"]}}},"serviceAccount":{"create":false,"name":"node-feature-discovery"},"tolerations":[{"effect":"NoSchedule","key":"node-role.kubernetes.io/master","operator":"Exists"},{"effect":"NoSchedule","key":"node-role.kubernetes.io/control-plane","operator":"Exists"},{"effect":"NoSchedule","key":"nvidia.com/gpu","operator":"Exists"}]}`
228+
- yaml
229+
- .. code-block:: yaml
230+
231+
serviceAccount:
232+
# disable creation to avoid duplicate serviceaccount creation by master spec
233+
# above
234+
name: node-feature-discovery
235+
create: false
236+
tolerations:
237+
- key: "node-role.kubernetes.io/master"
238+
operator: "Exists"
239+
effect: "NoSchedule"
240+
- key: "node-role.kubernetes.io/control-plane"
241+
operator: "Exists"
242+
effect: "NoSchedule"
243+
- key: nvidia.com/gpu
244+
operator: Exists
245+
effect: NoSchedule
246+
config:
247+
sources:
248+
pci:
249+
deviceClassWhitelist:
250+
- "0300"
251+
- "0302"
252+
deviceLabelFields:
253+
- vendor
254+
190255
- NFD worker daemonset configuration.
191256

192257
=======================
@@ -235,8 +300,58 @@ SR-IOV Network Operator Helm chart customization options can be found `here <htt
235300
- `"nvcr.io/nvidia/mellanox/sriov-network-operator-webhook:network-operator-24.7.0"`
236301
-
237302
* - sriov-network-operator.operator.admissionControllers
238-
- object
239-
- `{"certificates":{"certManager":{"enabled":true,"generateSelfSigned":true},"custom":{"enabled":false},"secretNames":{"injector":"network-resources-injector-cert","operator":"operator-webhook-cert"}},"enabled":false}`
303+
- yaml
304+
- .. code-block:: yaml
305+
306+
enabled: false
307+
certificates:
308+
secretNames:
309+
operator: "operator-webhook-cert"
310+
injector: "network-resources-injector-cert"
311+
certManager:
312+
# -- When enabled, makes use of certificates managed by cert-manager.
313+
enabled: true
314+
# -- When enabled, certificates are generated via cert-manager and then
315+
# name will match the name of the secrets defined above.
316+
generateSelfSigned: true
317+
# -- If not specified, no secret is created and secrets with the names
318+
# defined above are expected to exist in the cluster. In that case,
319+
# the ca.crt must be base64 encoded twice since it ends up being an env variable.
320+
custom:
321+
enabled: false
322+
# operator:
323+
# caCrt: |
324+
# -----BEGIN CERTIFICATE-----
325+
# MIIMIICLDCCAdKgAwIBAgIBADAKBggqhkjOPQQDAjB9MQswCQYDVQQGEwJCRTEPMA0G
326+
# ...
327+
# -----END CERTIFICATE-----
328+
# tlsCrt: |
329+
# -----BEGIN CERTIFICATE-----
330+
# MIIMIICLDCCAdKgAwIBAgIBADAKBggqhkjOPQQDAjB9MQswCQYDVQQGEwJCRTEPMA0G
331+
# ...
332+
# -----END CERTIFICATE-----
333+
# tlsKey: |
334+
# -----BEGIN EC PRIVATE KEY-----
335+
# MHcl4wOuDwKQa+upc8GftXE2C//4mKANBC6It01gUaTIpo=
336+
# ...
337+
# -----END EC PRIVATE KEY-----
338+
# injector:
339+
# caCrt: |
340+
# -----BEGIN CERTIFICATE-----
341+
# MIIMIICLDCCAdKgAwIBAgIBADAKBggqhkjOPQQDAjB9MQswCQYDVQQGEwJCRTEPMA0G
342+
# ...
343+
# -----END CERTIFICATE-----
344+
# tlsCrt: |
345+
# -----BEGIN CERTIFICATE-----
346+
# MIIMIICLDCCAdKgAwIBAgIBADAKBggqhkjOPQQDAjB9MQswCQYDVQQGEwJCRTEPMA0G
347+
# ...
348+
# -----END CERTIFICATE-----
349+
# tlsKey: |
350+
# -----BEGIN EC PRIVATE KEY-----
351+
# MHcl4wOuDwKQa+upc8GftXE2C//4mKANBC6It01gUaTIpo=
352+
# ...
353+
# -----END EC PRIVATE KEY-----
354+
240355
- Enable admission controller.
241356
* - sriov-network-operator.operator.admissionControllers.certificates.certManager.enabled
242357
- bool
@@ -255,8 +370,12 @@ SR-IOV Network Operator Helm chart customization options can be found `here <htt
255370
- `"nvidia.com"`
256371
- Prefix to be used for resources names.
257372
* - sriov-network-operator.sriovOperatorConfig.configDaemonNodeSelector
258-
- object
259-
- `{"beta.kubernetes.io/os":"linux","network.nvidia.com/operator.mofed.wait":"false"}`
373+
- yaml
374+
- .. code-block:: yaml
375+
376+
beta.kubernetes.io/os: "linux"
377+
network.nvidia.com/operator.mofed.wait: "false"
378+
260379
- Selects the nodes to be configured
261380
* - sriov-network-operator.sriovOperatorConfig.deploy
262381
- bool
@@ -342,8 +461,11 @@ For example:
342461
- `30`
343462
- NVIDIA DOCA Driver readiness probe interval.
344463
* - ofedDriver.repoConfig
345-
- object
346-
- `{"name":""}`
464+
- yaml
465+
- .. code-block:: yaml
466+
467+
name: ""
468+
347469
- Private mirror repository configuration.
348470
* - ofedDriver.repository
349471
- string
@@ -366,8 +488,23 @@ For example:
366488
- `true`
367489
- Global switch for automatic upgrade feature, if set to false all other options are ignored.
368490
* - ofedDriver.upgradePolicy.drain
369-
- object
370-
- `{"deleteEmptyDir":true,"enable":true,"force":true,"podSelector":"","timeoutSeconds":300}`
491+
- yaml
492+
- .. code-block:: yaml
493+
494+
# -- Options for node drain (``kubectl drain``) before driver reload, if
495+
# auto upgrade is enabled.
496+
enable: true
497+
# -- Use force drain of pods.
498+
force: true
499+
# -- Pod selector to specify which pods will be drained from the node.
500+
# An empty selector means all pods.
501+
podSelector: ""
502+
# -- It's recommended to set a timeout to avoid infinite drain in case
503+
# non-fatal error keeps happening on retries.
504+
timeoutSeconds: 300
505+
# -- Delete pods local storage.
506+
deleteEmptyDir: true
507+
371508
- Options for node drain (`kubectl drain`) before the driver reload. If auto upgrade is enabled but drain.enable is false, then driver POD will be reloaded immediately without removing PODs from the node.
372509
* - ofedDriver.upgradePolicy.drain.deleteEmptyDir
373510
- bool
@@ -486,8 +623,13 @@ RDMA Shared Device Plugin
486623
- `"ghcr.io/mellanox"`
487624
- RDMA shared device plugin image repository.
488625
* - rdmaSharedDevicePlugin.resources
489-
- list
490-
- `[{"name":"rdma_shared_device_a","rdmaHcaMax":63,"vendors":["15b3"]}]`
626+
- yaml
627+
- .. code-block:: yaml
628+
629+
- name: rdma_shared_device_a
630+
vendors: [15b3]
631+
rdmaHcaMax: 63
632+
491633
- The following defines the RDMA resources in the cluster. It must be provided by the user when deploying the chart. Each entry in the resources element will create a resource with the provided <name> and list of devices.
492634
* - rdmaSharedDevicePlugin.useCdi
493635
- bool

templates/helm.rst.gotmpl

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ General Parameters
5050
(hasPrefix "node-feature-discovery" .Key))) }}
5151
* - {{ .Key }}
5252
- {{ .Type }}
53-
- {{ if .Default }}{{ .Default }}{{ else }}{{ "" }}{{ end }}
53+
- {{ if eq .Type "yaml" }}.. code-block:: yaml
54+
55+
{{ .Default | indent 10}}{{ else }}{{ .Default }}{{ end }}
5456
- {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }}
5557
{{- end }}
5658
{{- end }}
@@ -104,7 +106,9 @@ Node Feature Discovery Helm chart customization options can be found `here <http
104106
{{- if hasPrefix "node-feature-discovery" .Key}}
105107
* - {{ .Key }}
106108
- {{ .Type }}
107-
- {{ if .Default }}{{ .Default }}{{ else }}{{ "" }}{{ end }}
109+
- {{ if eq .Type "yaml" }}.. code-block:: yaml
110+
111+
{{ .Default | indent 10}}{{ else }}{{ .Default }}{{ end }}
108112
- {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }}
109113
{{- end }}
110114
{{- end }}
@@ -130,7 +134,9 @@ SR-IOV Network Operator Helm chart customization options can be found `here <htt
130134
{{- if hasPrefix "sriov-network-operator" .Key}}
131135
* - {{ .Key }}
132136
- {{ .Type }}
133-
- {{ if .Default }}{{ .Default }}{{ else }}{{ "" }}{{ end }}
137+
- {{ if eq .Type "yaml" }}.. code-block:: yaml
138+
139+
{{ .Default | indent 10}}{{ else }}{{ .Default }}{{ end }}
134140
- {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }}
135141
{{- end }}
136142
{{- end }}
@@ -173,7 +179,9 @@ For example:
173179
{{- if hasPrefix "ofedDriver" .Key}}
174180
* - {{ .Key }}
175181
- {{ .Type }}
176-
- {{ if .Default }}{{ .Default }}{{ else }}{{ "" }}{{ end }}
182+
- {{ if eq .Type "yaml" }}.. code-block:: yaml
183+
184+
{{ .Default | indent 10}}{{ else }}{{ .Default }}{{ end }}
177185
- {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }}
178186
{{- end }}
179187
{{- end }}
@@ -253,7 +261,9 @@ RDMA Shared Device Plugin
253261
{{- if hasPrefix "rdmaSharedDevicePlugin" .Key}}
254262
* - {{ .Key }}
255263
- {{ .Type }}
256-
- {{ if .Default }}{{ .Default }}{{ else }}{{ "" }}{{ end }}
264+
- {{ if eq .Type "yaml" }}.. code-block:: yaml
265+
266+
{{ .Default | indent 10}}{{ else }}{{ .Default }}{{ end }}
257267
- {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }}
258268
{{- end }}
259269
{{- end }}
@@ -297,7 +307,9 @@ SR-IOV Network Device Plugin
297307
{{- if hasPrefix "sriovDevicePlugin" .Key}}
298308
* - {{ .Key }}
299309
- {{ .Type }}
300-
- {{ if .Default }}{{ .Default }}{{ else }}{{ "" }}{{ end }}
310+
- {{ if eq .Type "yaml" }}.. code-block:: yaml
311+
312+
{{ .Default | indent 10}}{{ else }}{{ .Default }}{{ end }}
301313
- {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }}
302314
{{- end }}
303315
{{- end }}
@@ -342,7 +354,9 @@ ib-kubernetes provides a daemon that works in conjunction with the `SR-IOV Netwo
342354
{{- if hasPrefix "ibKubernetes" .Key}}
343355
* - {{ .Key }}
344356
- {{ .Type }}
345-
- {{ if .Default }}{{ .Default }}{{ else }}{{ "" }}{{ end }}
357+
- {{ if eq .Type "yaml" }}.. code-block:: yaml
358+
359+
{{ .Default | indent 10}}{{ else }}{{ .Default }}{{ end }}
346360
- {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }}
347361
{{- end }}
348362
{{- end }}
@@ -393,7 +407,9 @@ NVIDIA IPAM Plugin
393407
{{- if hasPrefix "nvIpam" .Key}}
394408
* - {{ .Key }}
395409
- {{ .Type }}
396-
- {{ if .Default }}{{ .Default }}{{ else }}{{ "" }}{{ end }}
410+
- {{ if eq .Type "yaml" }}.. code-block:: yaml
411+
412+
{{ .Default | indent 10}}{{ else }}{{ .Default }}{{ end }}
397413
- {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }}
398414
{{- end }}
399415
{{- end }}
@@ -427,7 +443,9 @@ Specifies components to deploy in order to facilitate a secondary network in Kub
427443
{{- if hasPrefix "secondaryNetwork" .Key}}
428444
* - {{ .Key }}
429445
- {{ .Type }}
430-
- {{ if .Default }}{{ .Default }}{{ else }}{{ "" }}{{ end }}
446+
- {{ if eq .Type "yaml" }}.. code-block:: yaml
447+
448+
{{ .Default | indent 10}}{{ else }}{{ .Default }}{{ end }}
431449
- {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }}
432450
{{- end }}
433451
{{- end }}
@@ -453,7 +471,9 @@ NVIDIA NIC Feature Discovery
453471
{{- if hasPrefix "nicFeatureDiscovery" .Key}}
454472
* - {{ .Key }}
455473
- {{ .Type }}
456-
- {{ if .Default }}{{ .Default }}{{ else }}{{ "" }}{{ end }}
474+
- {{ if eq .Type "yaml" }}.. code-block:: yaml
475+
476+
{{ .Default | indent 10}}{{ else }}{{ .Default }}{{ end }}
457477
- {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }}
458478
{{- end }}
459479
{{- end }}
@@ -478,7 +498,9 @@ DOCA Telemetry Service
478498
{{- if hasPrefix "docaTelemetryService" .Key}}
479499
* - {{ .Key }}
480500
- {{ .Type }}
481-
- {{ if .Default }}{{ .Default }}{{ else }}{{ "" }}{{ end }}
501+
- {{ if eq .Type "yaml" }}.. code-block:: yaml
502+
503+
{{ .Default | indent 10}}{{ else }}{{ .Default }}{{ end }}
482504
- {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }}
483505
{{- end }}
484506
{{- end }}

0 commit comments

Comments
 (0)