diff --git a/hack/krmFunctionBenchmark/benchmark.sh b/hack/krmFunctionBenchmark/benchmark.sh index efdaa258c..a2c5e8cc5 100755 --- a/hack/krmFunctionBenchmark/benchmark.sh +++ b/hack/krmFunctionBenchmark/benchmark.sh @@ -56,6 +56,17 @@ function run_tshirt_benchmark { run_fn $loop "T-shirt Example Container Function" "example_tshirt/containerfn" } +if [ "$1" != "--doIt" ]; then + echo "Usage: $0 --doIt" + echo " " + echo "This script measures performance of kustomize containerized" + echo "functions (KRM config functions) implementation." + echo "It does so by running functions in local executable mode and" + echo "in container mode for 10, 100 and 1000 times. The time" + echo "used in these 2 modes are recorded." + exit 1 +fi + loops=(10 100 1000) build_exec diff --git a/hack/krmFunctionBenchmark/example_tshirt/execfn/build.sh b/hack/krmFunctionBenchmark/example_tshirt/execfn/build.sh index d5d758411..4795418c3 100755 --- a/hack/krmFunctionBenchmark/example_tshirt/execfn/build.sh +++ b/hack/krmFunctionBenchmark/example_tshirt/execfn/build.sh @@ -5,4 +5,5 @@ BUILD_HOME=/usr/local/build docker build -t $IMAGE_LABEL . -docker run --rm -v $(pwd):/out $IMAGE_LABEL cp -r $BUILD_HOME/functions/examples/injection-tshirt-sizes/image/tshirt /out +docker run --rm -v $(pwd):/out $IMAGE_LABEL \ + cp -r $BUILD_HOME/functions/examples/injection-tshirt-sizes/image/tshirt /out diff --git a/hack/krmFunctionBenchmark/label_namespace/execfn/build.sh b/hack/krmFunctionBenchmark/label_namespace/execfn/build.sh index abc93c02b..c7e461db5 100755 --- a/hack/krmFunctionBenchmark/label_namespace/execfn/build.sh +++ b/hack/krmFunctionBenchmark/label_namespace/execfn/build.sh @@ -5,4 +5,5 @@ BUILD_HOME=/usr/local/build docker build -t $IMAGE_LABEL . -docker run --rm -v $(pwd):/out $IMAGE_LABEL cp -r $BUILD_HOME/ts/hello-world/dist $BUILD_HOME/ts/hello-world/node_modules /out +docker run --rm -v $(pwd):/out $IMAGE_LABEL \ + cp -r $BUILD_HOME/ts/hello-world/dist $BUILD_HOME/ts/hello-world/node_modules /out diff --git a/hack/krmFunctionBenchmark/readme.md b/hack/krmFunctionBenchmark/readme.md index dee12742e..b32a09d23 100644 --- a/hack/krmFunctionBenchmark/readme.md +++ b/hack/krmFunctionBenchmark/readme.md @@ -1,9 +1,9 @@ # Benchmark for KRM functions in Kustomize -## Pre-request +## Pre-prerequisites - - You have to use Kustomize version with KRM function supported. - - You need to have Docker running on your machine. + - [kustomize v3.7.0 or higher](https://kubernetes-sigs.github.io/kustomize/installation) (support for KRM Config Functions). + - [docker](https://github.com/kubernetes-sigs/kustomize/pull/docker.com) ## How to run