Skip to content
This repository was archived by the owner on Apr 10, 2024. It is now read-only.

Work around conflicts with existing kubeconfig file #133

Conversation

scholzj
Copy link
Contributor

@scholzj scholzj commented Nov 22, 2023

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

Copy link
Collaborator

@csviri csviri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@csviri csviri merged commit 8e5f87f into java-operator-sdk:main Nov 22, 2023
@scholzj scholzj deleted the workaround-conflicts-with-existing-kubeconfig-file branch November 22, 2023 15:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Existing kubeconfig file causes tests to fail
2 participants