stackspout/apps/generate-kustomizations.sh

16 lines
458 B
Bash
Raw Normal View History

2022-07-12 17:38:21 +00:00
#!/bin/sh -e
# Generates kubernetes kustomizations for given directories or all subdirectories
if test $# -gt 0
then for dir; do
2024-02-07 12:03:43 +00:00
{ echo 'apiVersion: kustomize.config.k8s.io/v1beta1
2022-07-12 17:38:21 +00:00
kind: Kustomization
resources:'
find $dir -maxdepth 1 -type f -name "*.yaml" -not -name "kustomization.yaml" -printf " - %f\n"; } | tee $dir/kustomization.yaml
done
else
find -mindepth 1 -maxdepth 1 -type d | while read dir
do echo "$dir"
$0 "$dir"
done
fi