-
Notifications
You must be signed in to change notification settings - Fork 137
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
tink worker command line args #287
Conversation
d5f93df
to
4e424ea
Compare
That's a great effort @displague !! Now we have a page in our documentation for each service. You analyzed the topic well and you know the various ways to configure the tink-worker, do you mind adding a section in the tink-worker doc about this? https://tinkerbell.org/docs/services/tink/ Thanks |
@gianarb That sounds like a good idea. I'll need to become a little more familiar with tink-worker before I can do that. I need to add tests to this pull request (and actually test it out myself 😅 ) before doing so. |
dda5ed9
to
3cf8bdb
Compare
3cf8bdb
to
5950a98
Compare
385caf4
to
0643ce4
Compare
Codecov Report
@@ Coverage Diff @@
## master #287 +/- ##
=======================================
Coverage 22.67% 22.67%
=======================================
Files 15 15
Lines 1270 1270
=======================================
Hits 288 288
Misses 963 963
Partials 19 19
Continue to review full report at Codecov.
|
9c03438
to
dc2b493
Compare
…history Signed-off-by: Marques Johansson <marques@packet.com>
Signed-off-by: Marques Johansson <marques@packet.com>
…ent) arguments Signed-off-by: Marques Johansson <marques@packet.com>
Signed-off-by: Marques Johansson <marques@packet.com>
5516f8c
to
e78b852
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, thanks for all the hard work you put into this one @displague!
…riable used for the worker ID (#147) ## Description Adds support for the latest tink-worker changes to command line arguments/env variables after tinkerbell/tink#287 merged ## Why is this needed Testing using the latest published images is broken, since tink-worker is looking for the ID env variable rather than WORKER_ID, this PR adds forward and backward compatible support. ## How Has This Been Tested? Currently testing now using the tilt configuration I'm working on in https://github.com/detiber/tink/tree/kindDev, but it could also be tested using the vagrant or terraform setups with the changes needed to point to an osie build. ## How are existing users impacted? What migration steps/scripts do we need? No additional migrations or scripts should be needed, it should not impact users.
Description
This PR makes most constants and environment variables for tink-worker configurable from the command line, environment variables, and falls back to a
.tinkerbell.yaml
(worker-id: 1234
) (or .json) file.Notably,
TINKERBELL_CERT_URL
lookups are checked from a client that is defined in a parent package. This variable has not been made configurable in the same way.This is similar in spirit to #266
Considerable refactoring was done to clean up the use of global variables. The
internal
pkg contains aWorker
andRegistryConnDetails
struct which are context bags for the methods that needed these global variables. I imagine we will continue to evolve these types to find a better shape.Why is this needed
When run from various environments, users may have an easier time manipulating either configuration files, command line arguments, or the environment. Also, by defining these variables with cobra/viper, users can leverage
--help
and we can eventually use this to generate man pages, shell auto-completions, and markdown docs.Fixes: #
How Has This Been Tested?
How are existing users impacted? What migration steps/scripts do we need?
Known Bugs
--help
does not include the environment variable hints which are shown when invalid args are supplied 🤔 (these hints are generated at runtime, we could just move them into the text description)Checklist:
I have: