Skip to content

Conversation

@christiangebhard
Copy link
Contributor

This should resolve #52 , providing the option to use the contents of a kubeconfig instead of a file directly.

Disclaimer: I'm no go expert so the tests are a bit spartanic.

@manusa
Copy link
Owner

manusa commented Dec 11, 2024

Thanks for contributing, I'll review deeper as soon as I get some time.

From the first look, I think I'd prefer an approach where the kubeconfig contents was persisted in Java to a temporary file and then passed as a path to the go side of things (the file should be deleted after the Java execution).
However, this might not be very good security-wise.

On the other hand, your current approach is quite convoluted and might have multiple unwanted side-effects for more complex configurations. I'm not sure if you ported the client-go instantiation from helm or not. I'd need check this further.

@christiangebhard
Copy link
Contributor Author

Thanks for the first feedback. I totally understand your concerns about my approach. I did choose this over a temporary file, like you said for security reasons. If you think these concerns are unnecessary let me know and I can change the implementation.
The client-go instantiation is inspired by this discussion here helm/helm#6910 and from browsing through the helm code.

@manusa manusa self-assigned this Dec 21, 2024
@manusa manusa self-requested a review December 21, 2024 06:05
@manusa manusa force-pushed the feature/kubeconfig-from-string branch from e03473f to ec4f773 Compare December 21, 2024 08:07
@manusa
Copy link
Owner

manusa commented Dec 21, 2024

After a few hours of digging into client-go's source code I think I managed to find a simple solution that is both secure and sustainable in the future.

Please take a look to see if this works for you. The tests seem to be passing fine.

I think another iteration is needed to make it work completely fine without side-effects, but it should probably be tackled as a separate pull request.

@christiangebhard
Copy link
Contributor Author

Thanks for your work, this works completely fine for our use case (#52 (comment)) - looking forward to use the release :)

@manusa manusa merged commit 3310768 into manusa:main Dec 23, 2024
3 checks passed
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.

Allow providing kubeconfig from String

2 participants