Skip to content

Add ability to provide a preconfigured KubernetesClient #1507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 3, 2022

Conversation

codepitbull
Copy link
Contributor

Why ?

We are using the Testcontainers K3s-module (https://www.testcontainers.org/modules/k3s/) for integration tests while working on our operators.
These k8s-instances are created on the fly at test-runtime there is never a KUBECONFIG-env or something in ~/.kube/config which means that they can't be used with the default test-implementatio which uses new KubernetesClientBuilder().build()and relies on the existence of either of the two.

What ?

I added the ability to inject your own instanc eof a KubernetesClient to the builders for LocallyRunOperatorExtension and ClusterDeployedOperatorExtension.
In case none is provided it falls back to the old behaviour.

I hope this helps, feel free to leave comments for things I should change/add :)

Thanks a lot for your great work!

@scrocquesel
Copy link
Contributor

+1

Aside, did you ever test https://github.com/dajudge/kindcontainer ?

@codepitbull
Copy link
Contributor Author

+1

Aside, did you ever test https://github.com/dajudge/kindcontainer ?

Nope, but will give it a shot soon :)
Thanks for pointing out!

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! Thank you!

just one more little thing before we merge this, could you pls run mvn clean install on the project - that will format the code - and push the changes. That will fix the failing CI job.

@codepitbull
Copy link
Contributor Author

LGTM! Thank you!

just one more little thing before we merge this, could you pls run mvn clean install on the project - that will format the code - and push the changes. That will fix the failing CI job.

I ran it and pushed the results.

@csviri csviri merged commit 904275a into operator-framework:main Oct 3, 2022
@csviri
Copy link
Collaborator

csviri commented Oct 3, 2022

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants