goss-org / goss

Quick and Easy server testing/validation
https://goss.rocks
Apache License 2.0
5.5k stars 470 forks source link

GOSS_KUBECTL_OPTS not working with some kubectl args #799

Open HabibMAALEM opened 1 year ago

HabibMAALEM commented 1 year ago

Describe the bug When using kgoss run, i can't override kubectl run command with some extra args like --overrides in $GOSS_KUBECTL_OPTS, its work for starting the pod but not recognized with kubectl wait and kubectl delete

How To Reproduce

$ export GOSS_KUBECTL_OPTS=--namespace=default --overrides={"apiVersion":"v1","spec":{"imagePullSecrets":[{"name":"secret"}]}}
$ kgoss run -i "nginx"

Expected Behavior Running tests on kubernetes

Actual Behavior

[INFO]: Parsing command line
[INFO]: using image: nginx
[INFO]: going to execute (may be blank): --
[INFO]: Preparing files to copy into container
[INFO]: Creating Kubernetes pod/container to test
++ /usr/local/bin/kubectl run --namespace=default '--overrides={"apiVersion":"v1","spec":{"imagePullSecrets":[{"name":"secret"}]}}' kgoss-tester-1895 --image-pull-policy=Always --restart=Never --labels=app=kgoss-test '--output=jsonpath={.metadata.name}' --image=nginx --

+ id=kgoss-tester-1895
+ set +x
[INFO]: Waiting for container to be ready
error: unknown flag: --overrides
See 'kubectl wait --help' for usage.
[INFO]: Deleting pod/container
error: unknown flag: --overrides
See 'kubectl delete --help' for usage.

Environment:

aelsabbahy commented 1 year ago

Thanks for reporting this.

Feel free to submit a PR fixing this. Everything outside of dgoss wrapper has been community maintained.