Skip to content
Snippets Groups Projects
generate-kustomizations.sh 458 B
Newer Older
xeruf's avatar
xeruf committed
#!/bin/sh -e
# Generates kubernetes kustomizations for given directories or all subdirectories
if test $# -gt 0
	{ echo 'apiVersion: kustomize.config.k8s.io/v1beta1
xeruf's avatar
xeruf committed
kind: Kustomization
resources:'
	find $dir -maxdepth 1 -type f -name "*.yaml" -not -name "kustomization.yaml" -printf "  - %f\n"; } | tee $dir/kustomization.yaml
else
	find -mindepth 1 -maxdepth 1 -type d | while read dir
			$0 "$dir"
		done
fi