Skip to content
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

Auth agnostic kube client #1941

Merged
merged 1 commit into from
Apr 28, 2022
Merged

Conversation

g-gaston
Copy link
Member

@g-gaston g-gaston commented Apr 26, 2022

Part of #1106 and #1109

Description of changes

Wrapping around the the kubectl interface to make the client API
agnostic from the authentication mechanism. Also adding support for an
internal schema that avoids having to indicate the resource type because
it's inferred from the concrete CRD type.

This allows to provide a common interface that can be implemented by
both a kubectl binary wrapper and a controller runtime client. With
this, we will be be able to build logic that interacts with the api
server and that can be shared between the CLI and the controller.

Testing

Added unit tests

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eks-distro-bot
Copy link
Collaborator

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@eks-distro-bot eks-distro-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 26, 2022
@g-gaston g-gaston force-pushed the kubernetes-clients branch from 216eebc to af4825f Compare April 28, 2022 17:53
@codecov
Copy link

codecov bot commented Apr 28, 2022

Codecov Report

Merging #1941 (bc31a18) into main (b3e58c4) will increase coverage by 0.06%.
The diff coverage is 82.75%.

❗ Current head bc31a18 differs from pull request most recent head 8f73688. Consider uploading reports for the commit 8f73688 to get more accurate results

@@            Coverage Diff             @@
##             main    #1941      +/-   ##
==========================================
+ Coverage   50.01%   50.07%   +0.06%     
==========================================
  Files         290      293       +3     
  Lines       24680    24731      +51     
==========================================
+ Hits        12343    12385      +42     
- Misses      11040    11046       +6     
- Partials     1297     1300       +3     
Impacted Files Coverage Δ
pkg/clients/kubernetes/scheme.go 50.00% <50.00%> (ø)
pkg/dependencies/factory.go 50.67% <53.84%> (+0.07%) ⬆️
pkg/executables/kubectl.go 35.54% <92.85%> (+0.44%) ⬆️
pkg/clients/kubernetes/kubeconfig.go 100.00% <100.00%> (ø)
pkg/clients/kubernetes/unauth.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b3e58c4...8f73688. Read the comment docs.

@g-gaston g-gaston force-pushed the kubernetes-clients branch 2 times, most recently from 932fa88 to 2fd1232 Compare April 28, 2022 19:54
@g-gaston g-gaston marked this pull request as ready for review April 28, 2022 19:55
@g-gaston g-gaston changed the title First implementation of auth agnostic kube clients Auth agnostic kube client Apr 28, 2022
pkg/clients/kubernetes/unauth.go Outdated Show resolved Hide resolved
pkg/executables/kubectl.go Outdated Show resolved Hide resolved
@jiayiwang7
Copy link
Member

/lgtm

Wrapping around the the kubectl interface to make the client API
agnostic from the authentication mechanism. Also adding support for an
internal schema that avoids having to indicate the resource type because
it's inferred from the concrete CRD type.

This allows to provide a common interface that can be implemented by
both a kubectl binary wrapper and a controller runtime client. With
this, we will be be able to build logic that interacts with the api
server and that can be shared between the CLI and the controller.
@g-gaston g-gaston force-pushed the kubernetes-clients branch from bc31a18 to 8f73688 Compare April 28, 2022 20:48
@jiayiwang7
Copy link
Member

/lgtm

@g-gaston
Copy link
Member Author

/approve

@eks-distro-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: g-gaston

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@eks-distro-bot eks-distro-bot merged commit c48e262 into aws:main Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants