Skip to content

Commit

Permalink
update chart parsing for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
demeesterdev committed Aug 1, 2024
1 parent f77ba45 commit 393601a
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
if [ -f "${PWD}/kubeconfig" ]; then
export KUBECONFIG="${PWD}/kubeconfig"
fi
fi
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
kubeconfig
kubeconfig
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Kubernetes Helm Charts

> Inspired by [helm-charts | USA-RedDragon](https://github.com/USA-RedDragon/helm-charts)
> Inspired by
> [https://charts.mcswain.dev/](https://charts.mcswain.dev/)
The code is provided as is without warrenties to others or myself.

Expand All @@ -18,3 +19,7 @@ helm repo add demeesterdev https://charts.demeester.dev
You can then run `helm search repo demeesterdev` to see the charts.

## Chart Overview

| Chart | Description |
| ----- | ----------- |
| [container-app](charts/container-app/) | A Helm chart for a generic Docker app |
4 changes: 2 additions & 2 deletions charts/app/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: app
name: container-app
description: A Helm chart for a generic Docker app
maintainers:
- name: demeesterdev
Expand All @@ -19,7 +19,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: "0.1.1"
version: "0.1.2"

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
60 changes: 60 additions & 0 deletions charts/app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# container-app

![Version: 0.1.2](https://img.shields.io/badge/Version-0.1.2-informational?style=flat-square)
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)

A Helm chart for a generic Docker app

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| demeesterdev | <thijs@demeester.dev> | <https://github.com/demeesterdev> |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| args | list | `[]` | |
| command | list | `[]` | |
| configs | list | `[]` | |
| deploymentStrategy.type | string | `"Recreate"` | |
| env | list | `[]` | |
| envFrom | list | `[]` | |
| extraContainers | list | `[]` | |
| extraVolumes | list | `[]` | |
| fullnameOverride | string | `""` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"nginx"` | |
| image.tag | string | `"alpine"` | |
| imagePullSecrets | list | `[]` | |
| ingress.annotations | object | `{}` | |
| ingress.enabled | bool | `true` | |
| ingress.hosts[0].host | string | `"example.demeester.app"` | |
| ingress.hosts[0].paths[0].path | string | `"/"` | |
| ingress.hosts[0].paths[0].pathType | string | `"Prefix"` | |
| ingress.hosts[0].paths[0].port | int | `80` | |
| ingress.tls[0].hosts[0] | string | `"example.mcswain.app"` | |
| ingress.tls[0].secretName | string | `"example-demeester-app-tls"` | |
| initContainers | list | `[]` | |
| lifecycle | object | `{}` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| persistentVolumes | list | `[]` | |
| podAnnotations | object | `{}` | |
| podSecurityContext | object | `{}` | |
| probes | object | `{}` | |
| replicaCount | int | `1` | |
| resources | object | `{}` | |
| secrets | list | `[]` | |
| securityContext | object | `{}` | |
| service.ports[0].name | string | `"http"` | |
| service.ports[0].port | int | `80` | |
| service.type | string | `"ClusterIP"` | |
| serviceAccountName | string | `nil` | |
| tolerations | list | `[]` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
22 changes: 22 additions & 0 deletions charts/app/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}

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

{{ template "chart.description" . }}

{{ template "chart.homepageLine" . }}

{{ template "chart.maintainersSection" . }}

{{ template "chart.sourcesSection" . }}

{{ template "chart.requirementsSection" . }}

{{ template "chart.valuesSection" . }}

{{- if not .SkipVersionFooter }}
{{ template "helm-docs.versionFooter" . }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/app/README_CONFIG.md.gotmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{- define "custom.chart.name" -}}
Generic App
# Generic App
{{- end -}}
2 changes: 1 addition & 1 deletion charts/app/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ Check Ingress supports pathType
{{/* pathType was added to networking.k8s.io/v1beta1 in Kubernetes 1.18 */}}
{{- define "app.ingress.supportsPathType" -}}
{{- or (eq (include "app.ingress.isStable" .) "true") (and (eq (include "app.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/demeesterdev/helm-charts

go 1.22.5
go 1.22.5
39 changes: 39 additions & 0 deletions scripts/gen-chart-summary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -euo pipefail

# require yq
command -v yq >/dev/null 2>&1 || {
echo >&2 'yq (https://github.com/mikefarah/yq) is not installed. Aborting.'
exit 1
}

# Absolute path of repository
repository="$(git rev-parse --show-toplevel)"
charts_folder="$repository/charts"
charts_summary_file="$repository/README.md"
charts_header='## Chart Overview'

# Gather all charts
stable_charts="$(find "$charts_folder" -name "Chart.yaml" | sort)"

sed -i '' '/^'"$charts_header"'$/,$d' "$charts_summary_file"

{
echo "$charts_header"
echo
echo "| Chart | Description |"
echo "| ----- | ----------- |"
for chart_yaml in ${stable_charts[@]}; do
if ! git ls-files --error-unmatch "$chart_yaml" &>/dev/null; then continue; fi
IFS=$'\t' read -r chart_name chart_description chart_icon < <(yq eval -o=tsv '[.name, .description, .icon // ""]' "$chart_yaml")
if [ -n "$chart_icon" ]; then
width=18
if [[ "$chart_name" == mnemonic-ninja ]]; then
width=12
fi
chart_icon=" <img src='$chart_icon' alt='$chart_name icon' width='${width}px' align='right' loading='lazy'>"
fi
pretty_name="$(head -n1 "$(dirname "$chart_yaml")/README.md" | sed 's/^# //')"
echo "| [$pretty_name$chart_icon](charts/$chart_name/) | $chart_description |"
done
} >> "$charts_summary_file"

0 comments on commit 393601a

Please sign in to comment.