-
Notifications
You must be signed in to change notification settings - Fork 5
Existing kubeconfig file causes tests to fail #116
Comments
I run into this issue as well. What seems to help is when I override the @csviri I wonder what would you think about adding to the code a custom |
thx @BramMeerten and @scholzj for the issue, so if I understand when checking if the api server is up and ready, the @scholzj yes, that might be a viable workaround. Feel free to create a PR for this. |
…rator-sdk#116 Signed-off-by: Jakub Scholz <[email protected]>
In some environments, where the user has an existing `kubeconfig` file with an active context using the `client-key-data` or `client-certificate-data` fields, the `kubectl` client used in the Kube API server readiness check does not know what certificates to use and the API Server startup fails with the exception `JenvtestException: Kube API Server did not start properly`. This PR works around it by specifying the `KUBECONFIG` environment variable to an non-existent config file when calling `kubectl` in the readiness check. That makes the `kubectl` process not use the pre-existing `kubeconfig` with its certificates and makes everything work. This is not needed is the user asks for updating the `kubeconfig` file as in such case, the `kubeconfig` already contains the correct configuration and no special handling is needed. This should resolve #116 Signed-off-by: Jakub Scholz <[email protected]>
When running a simple test, the
waitUntilDefaultNamespaceAvailable
check fails:By debugging and reading the errorStream of the process in
ProcessReadinessChecker::defaultNamespaceExists
, I find the following reason:rancher-desktop
refers to the context defined in my~/.kube/config
file. If I remove this file, the test works.Or if I add
@EnableKubeAPIServer(updateKubeConfigFile = true)
, then my test works without removing the kube config file.But the documentation saids this flag is not advised. And it's unclear when and why I should use this flag.
So it's unclear if to me if this is a bug, or is this as designed and should I use the
updateKubeConfigFile
flag?The text was updated successfully, but these errors were encountered: