themes/geekboot/layouts/partials/crds.html
{{/* Responsible for building the API page */}}
{{ partialCached "apiBuilder/GKVHeader" . }} {{/* $.Site.Data is from the hugo config file module.mounts.target. */}} {{/* Hugo requires YAML to be in the 'data' location for processing */}} {{/* https://gohugo.io/methods/site/data/ */}} {{ $crdFiles := index $.Site.Data.crds .Section "api" "crds" }} {{/* Iterate over each CRD file */}} {{ range $fileName, $crdContent := $crdFiles }} {{/* The path to download the CRD files. Relative to the _index.md file using "product: crds" */}} {{ $downloadPath := (printf "crds/%s.yaml" $fileName) }} {{ $group := $crdContent.spec.group }} {{ $kind := $crdContent.spec.names.kind }} {{/* bigName is the kind length limit to change CSS styles when it needs to be truncated */}} {{ $bigName := partial "apiBuilder/checkBigName" $kind }} {{/* Iterate over each served version and create separate entries */}} {{ range $versionItem := $crdContent.spec.versions }} {{ if $versionItem.served }} {{ $schema := $versionItem.schema.openAPIV3Schema }} {{ $version := $versionItem.name }} {{ $deprecated := $versionItem.deprecated }} {{ $description := $schema.description }} {{/* The div containing the entire CRD information including the Expand All/Collapse All row */}} {{/* generate the GKV line to expand/collapse the CRD data */}} {{ partial "apiBuilder/printGKVExpander" (dict "group" $group "version" $version "kind" $kind "deprecated" $deprecated) }} {{/* The container to show/hide with information related to the CRD */}} {{/* Generate the "Download YAML" link */}} {{ partial "apiBuilder/downloadLink" (dict "group" $group "version" $version "kind" $kind "downloadPath" $downloadPath) }} {{/* bigName-reset prevents the description from expanding into the x-scroll */}} {{ $description | markdownify}}
{{/* Loop over each key inside the schema */}} {{ range $key, $contents := $schema.properties }} {{/* Skip irrelevant keys at the top level */}} {{ if not (in (slice "apiVersion" "description" "kind" "metadata") $key) }} {{ partial "apiBuilder/processSpec" (dict "key" $key "contents" $contents "page" . "kind" $kind) }} {{ end }} {{ end }} {{/* Generate the "Return to top" link */}} {{ partialCached "apiBuilder/backToTopButton" . }}
{{ end }} {{ end }} {{ end}}