-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add Kubernetes back-end client #82
Add Kubernetes back-end client #82
Conversation
2377d79
to
93b3de6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions, and some cleanup.
2547eda
to
4bc9339
Compare
3c042da
to
3e0cd30
Compare
Codecov Report
@@ Coverage Diff @@
## main #82 +/- ##
==========================================
- Coverage 50.00% 42.35% -7.65%
==========================================
Files 3 6 +3
Lines 374 595 +221
==========================================
+ Hits 187 252 +65
- Misses 155 311 +156
Partials 32 32
Continue to review full report at Codecov.
|
308bcf3
to
360938c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took an initial look to get a sense of what's in flux and left a few questions.
bc16c9c
to
bb999a9
Compare
291dfe6
to
e2f8bad
Compare
e2f8bad
to
c8a1202
Compare
4069e86
to
0e7bcd7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo minor nits, and pending merge of tinkerbell/tink#573
236bb9c
to
d5ea9ab
Compare
d5ea9ab
to
326c59a
Compare
1c5944d
to
7679986
Compare
7679986
to
8ee9572
Compare
The Kubernetes back-end client enables Hegel to talk to a Kubernetes API Server to retrieve Hardware metadata from CRDs available in the Tink project. This realizes the Hegel portion of proposal 0026. Signed-off-by: Chris Doherty <[email protected]>
5407406
to
b6787b8
Compare
hardware/kubernetes_client.go
Outdated
} | ||
|
||
managerCtx, cancel := context.WithCancel(context.Background()) | ||
go func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally I agree. The way the app is designed though makes this difficult to do. The NewClient()
call is a factory function returning an interface so anything that needs to be done for a given implementation must be done during that call. Without re-designing this factory I don't think there's much I can do.
b6787b8
to
26c8747
Compare
Http handlers require a specific metadata format for querying using jq. The metadata format of the Kubernetes object isn't equivilent so we create an explicit mapping. This has the side effect of being much clearer and intentional about the serialization of metadata. Signed-off-by: Chris Doherty <[email protected]>
26c8747
to
f6fccce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Builds on #82 The hardware clients has 3 implementations with a fourth, file based for testing, being written. This change introduces a simple source file split to reduce cognitive load.
Description
Builds on #95 (rebased after PR was created)
This feature builds on #81 and realizes the Hegel portion of the Kubernetes back-end proposal.
Having generalized the client used to acquire metadata, this PR implements a Kubernetes client that leverages an internal client caching mechanism so as to reduce load on the Kubernetes API Server.
Additionally, I put some effort into reworking the Hegel Dockerfile so it could leverage layer caching for Go module dependencies and added an image build command to the Makefile.
The
Watch
API for the client is unimplemented and scheduled for a follow up. This is so we can get off the ground for machine provisioning. TheWatch
API is used for subscription capabilities so doesn't feature in metadata retrieval.How Has This Been Tested?
Built and ran the image with the Kubernetes back-end enabled talking to a KinD cluster containing the necessary CRDs and a
Hardware
resource.How are existing users impacted? What migration steps/scripts do we need?
None. Users enable the Kubernetes back-end by setting the
DATA_MODEL_VERSION=kubernetes
plus some additional env vars.Future work
Watch
API for consistency with other back-ends.