Skip to content

Commit f734df8

Browse files
committed
Initial chart example
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent d422df8 commit f734df8

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

render-chart.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
## Example for rendering Helm chart for openfaas to a static
4+
## set of objects with predictable/stable names for easier
5+
## diffs and maintenance for teams who need to go through a manual
6+
## YAML approval for each change/object vs reviewing the chart directly
7+
8+
OUTPUT="yaml/openfaas/"
9+
rm -rf "$OUTPUT"
10+
11+
helm template chart/openfaas/ -f ./chart/openfaas/values-pro.yaml | \
12+
yq -N -s '"__split__" + $index' - && \
13+
for f in __split__*.yml; do
14+
kind=$(yq '.kind' "$f")
15+
name=$(yq '.metadata.name' "$f")
16+
17+
if [ "$kind" = "null" ] || [ -z "$kind" ]; then
18+
rm -f "$f"
19+
continue
20+
fi
21+
22+
lower_kind=$(echo "$kind" | tr '[:upper:]' '[:lower:]')
23+
24+
prefix=""
25+
if [ "$kind" = "CustomResourceDefinition" ]; then
26+
prefix="00_"
27+
fi
28+
29+
dir="${OUTPUT}/${prefix}${lower_kind}"
30+
mkdir -p "$dir"
31+
mv "$f" "${dir}/${name}.yaml"
32+
done

0 commit comments

Comments
 (0)