While restoring the e2e tests that use bash I realize that a pain point that users of kn will experience is having to repeat the same namespace when issuing many commands in a row---If that namespace is not the default namespace.
See the PR #183 or sample snippet here to illustrate:
# Listing 1
# Will create and delete this namespace and use it for smoke tests
export KN_E2E_SMOKE_TESTS_NAMESPACE=kne2esmoketests
kubectl create ns $KN_E2E_SMOKE_TESTS_NAMESPACE
./kn service create hello --image gcr.io/knative-samples/helloworld-go -e TARGET=Knative -n $KN_E2E_SMOKE_TESTS_NAMESPACE
sleep 5
./kn service get -n $KN_E2E_SMOKE_TESTS_NAMESPACE -n $KN_E2E_SMOKE_TESTS_NAMESPACE
./kn service update hello --env TARGET=kn -n $KN_E2E_SMOKE_TESTS_NAMESPACE
sleep 3
./kn revision get -n $KN_E2E_SMOKE_TESTS_NAMESPACE
./kn service get -n $KN_E2E_SMOKE_TESTS_NAMESPACE
...
A better option would be to have kn use KN_NAMESPACE env value as the namespace for commands if that's defined.
So above becomes cleanly:
# Listing 2
# Will create and delete this namespace and use it for smoke tests
export KN_NAMESPACE=kne2esmoketests
./kn service create hello --image gcr.io/knative-samples/helloworld-go -e TARGET=Knative
sleep 5
./kn service get
./kn service update hello --env TARGET=kn
sleep 3
./kn revision get
./kn service get
...
While restoring the e2e tests that use
bashI realize that a pain point that users ofknwill experience is having to repeat the same namespace when issuing many commands in a row---If that namespace is not the default namespace.See the PR #183 or sample snippet here to illustrate:
A better option would be to have
knuseKN_NAMESPACEenv value as the namespace for commands if that's defined.So above becomes cleanly: