Use kubernetes client-go in a few places
In general, the EKS-Anywhere project has shelled out to kubectl to interact with the cluster's API. However, given that the EKS-A kubectl binary is run via a docker image, it can be slow. For cluster creation/teardown, this slowness is amortized and isn't nearly as noticeable. But for commands like "list packages" which should be rather fast, it's very noticeable.
So we're starting to use API client libraries where it makes sense to speed up these calls that are more interactive in nature, or where faster responses make sense.
There will be more commits of this nature in the near future. So if you see patterns here that you don't like, or think could be improved, now would be a great time to bring them up for discussion. :)
As a historical note, the choice to shell out to kubectl was made because it was planned that EKS-A would support more versions of kubernetes than the upstream project would, and it was thought that the ability to swap out executable versions to match the kubernetes version would be an easier or more flexible way to manage the differences when compared with linking to / using multiple versions of the client libraries. Whether or not that is true remains to be seen, but that fact is being used as guidance here, in that—at least at first—we will replace only calls that are stable and therefore less likely to change or require multiple library versions. (Like the list and get calls replaced here).
Issue #, if available:
Description of changes:
Testing (if applicable):
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: To complete the pull request process, please ask for approval from ewollesen after the PR has been reviewed.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
Codecov Report
Merging #2897 (c4aaad4) into main (60fc46c) will increase coverage by
0.05%. The diff coverage is87.75%.
@@ Coverage Diff @@
## main #2897 +/- ##
==========================================
+ Coverage 62.48% 62.54% +0.05%
==========================================
Files 335 335
Lines 26995 27014 +19
==========================================
+ Hits 16869 16897 +28
+ Misses 8839 8833 -6
+ Partials 1287 1284 -3
| Impacted Files | Coverage Δ | |
|---|---|---|
| pkg/dependencies/factory.go | 67.78% <68.42%> (+0.01%) |
:arrow_up: |
| pkg/curatedpackages/bundle.go | 84.88% <100.00%> (+17.44%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
/hold
I'm seeing some issues when no KUBECONFIG is provided (thanks to @a-cool-train) that I need to get sorted before this merges.