diff --git a/extras/kgoss/README.md b/extras/kgoss/README.md index e061692b..4aa80112 100644 --- a/extras/kgoss/README.md +++ b/extras/kgoss/README.md @@ -136,6 +136,7 @@ GOSS\_PATH | Local location of a compatible goss binary to use in container | `$ GOSS\_FILES\_PATH | Location of the goss yaml files | `.` GOSS\_KUBECTL\_BIN | Kubenetes client tool to use | `$(which kubectl)` GOSS\_KUBECTL\_OPTS | Options to inject more options such as "--namespace=default" | "" +GOSS\_KUBECTL\_RUN\_OPTS | Options only for kubectl run (e.g. --overrides for serviceAccount) | "" GOSS\_OPTS | Options to use for the goss test run. | `--color --format documentation` GOSS\_WAIT\_OPTS | Options to use for the goss wait run, when `./goss_wait.yaml` exists. | `-r 30s -s 1s > /dev/null` GOSS\_VARS | Variables file relative to `GOSS_FILES_PATH` to copy and use | "" diff --git a/extras/kgoss/kgoss b/extras/kgoss/kgoss index 1632d6a7..903d621c 100755 --- a/extras/kgoss/kgoss +++ b/extras/kgoss/kgoss @@ -40,6 +40,7 @@ If -p, -c and -a are not specified, container will run its ENTRYPOINT. GOSS_KUBECTL_BIN="$(which kubectl)": location of kubectl-compatible binary GOSS_KUBECTL_OPTS="": hook to inject more options such as "--namespace=default" +GOSS_KUBECTL_RUN_OPTS="": options only for kubectl run (e.g. --overrides for serviceAccount) GOSS_PATH="$(which goss)": location of goss binary GOSS_FILES_PATH=".": location of goss.yaml and other configuration files GOSS_VARS="": path to a goss.vars file @@ -74,6 +75,8 @@ GOSS_OPTS=${GOSS_OPTS:-"--color --format documentation"} GOSS_WAIT_OPTS=${GOSS_WAIT_OPTS:-"-r 30s -s 1s > /dev/null"} GOSS_CONTAINER_PATH=${GOSS_CONTAINER_PATH:-/tmp/goss} GOSS_KUBECTL_OPTS=${GOSS_KUBECTL_OPTS:-""} +# GOSS_KUBECTL_RUN_OPTS: additional options only for kubectl run (e.g. --overrides for serviceAccount, nodeSelector) +GOSS_KUBECTL_RUN_OPTS=${GOSS_KUBECTL_RUN_OPTS:-""} kgoss_cmd=run image= @@ -200,7 +203,7 @@ initialize () { info "Creating Kubernetes pod/container to test" test_pod_name=kgoss-tester-${RANDOM} set -x - id=$(${k} run ${GOSS_KUBECTL_OPTS} $test_pod_name --image-pull-policy=Always --restart=Never \ + id=$(${k} run ${GOSS_KUBECTL_OPTS} ${GOSS_KUBECTL_RUN_OPTS} $test_pod_name --image-pull-policy=Always --restart=Never \ --labels='app=kgoss-test' --output=jsonpath={.metadata.name} ${envs} \ --image=${image} ${to_exec} ) set +x