openshift-kni / cnf-features-deploy

Kustomize configs for installing CNF features and e2e functional tests for verifying feature deployment/integration
Apache License 2.0
56 stars 132 forks source link

KUBECONFIG with multiple entries doesn't work when running the container #550

Open jc-rh opened 3 years ago

jc-rh commented 3 years ago

podman run --rm --network host -v /home/jun/.kube/config:/usr/tnf/kubeconfig/config:ro -v /home/jun/.kube/nmlabconfig:/usr/tnf/kubeconfig/config.2:ro -v /data/test-network-function/test-network-function:/usr/tnf/claim:Z -e KUBECONFIG=/usr/tnf/kubeconfig/config:/usr/tnf/kubeconfig/config.2 -e TNF_MINIKUBE_ONLY=false -e TNF_ENABLE_CONFIG_AUTODISCOVER=false -e PATH=/usr/bin:/usr/local/oc/bin quay.io/openshift-kni/cnf-tests:latest /usr/bin/test-run.sh --junit /usr/tnf/claim -ginkgo.v '-ginkgo.skip=performance|sriov|ptp|sctp|xt_u32|dpdk|ovn' running /usr/bin//validationsuite --junit /usr/tnf/claim -ginkgo.v -ginkgo.skip=performance|sriov|ptp|sctp|xt_u32|dpdk|ovn ERROR: logging before flag.Parse: I0607 14:29:56.940886 2 clients.go:74] Failed to init kubernetes client, please check the $KUBECONFIG environment variable I0607 14:29:58.379567 2 request.go:655] Throttling request took 1.04934837s, request: GET:https://api.nmlabcluster.webscale.nm-lab.com:6443/apis/scheduling.k8s.io/v1?timeout=32s Running Suite: CNF Features e2e validation

Random Seed: 1623076196 Will run 17 of 36 specs

Failure [0.000 seconds] [BeforeSuite] BeforeSuite /go/src/github.com/openshift-kni/cnf-features-deploy/cnf-tests/testsuites/validationsuite/test_suite_test.go:55

Verify the KUBECONFIG environment variable Expected <*client.ClientSet | 0x0>: nil not to be nil

jc-rh commented 3 years ago

Both config files are valid. It works if either one is removed from the KUBECONFIG var.

yuvalk commented 3 years ago

yeah, I think the -v $KUBECONFIG:/kubeconfig -e KUBECONFIG=/kubeconfig does not allow for that. it's assuming a single file

If you truely need this, you can do -v $DIR_WITH_KUBECONFIGS:/kubeconfig -e KUBECONFIG=/kubeconfig/kube1.conf:/kubeconfig/kube2.conf

but cnf-tests cant run on multiple clusters, so I think you'd better pass it a single conf file

jc-rh commented 3 years ago

Right, we never meant to run it on multiple clusters. It's just a convenience thing. We often switch contexts between clusters and compare results. And it's not super straightforward to merge multiple cluster config into one single file.