File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments