stackspout/apps/generate-kustomizations.sh

16 lines
458 B
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh -e
# Generates kubernetes kustomizations for given directories or all subdirectories
if test $# -gt 0
then for dir; do
{ echo 'apiVersion: kustomize.config.k8s.io/v1beta1
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