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

Added virtual worker #602

Merged
merged 2 commits into from
Apr 19, 2022
Merged

Conversation

micahhausler
Copy link
Contributor

Add virtual tink worker command

Description

  • Add a no-op tinkerbell worker

Why is this needed

This worker is helpful if you want to test Tinkerbell API changes while not actually executing a worker that executes docker containers.

Fixes: #

How Has This Been Tested?

Tested locally against the Tinkerbell API. I'll have an E2E test in a future PR that uses the no-op logger and container manager.

How are existing users impacted? What migration steps/scripts do we need?

No impact to existing users.

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • added unit or e2e tests
  • provided instructions on how to upgrade

@micahhausler micahhausler requested review from mmlb and displague April 5, 2022 20:31
)

func getRandHexStr(length int) string {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

G404: Use of weak random number generator (math/rand instead of crypto/rand)

(at-me in a reply with help or ignore)

@micahhausler micahhausler force-pushed the worker/virtual-worker branch 2 times, most recently from 9aeacad to 5417ada Compare April 5, 2022 20:51
@codecov
Copy link

codecov bot commented Apr 5, 2022

Codecov Report

Merging #602 (a983be0) into main (685a7f6) will not change coverage.
The diff coverage is n/a.

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

@@           Coverage Diff           @@
##             main     #602   +/-   ##
=======================================
  Coverage   45.86%   45.86%           
=======================================
  Files          56       56           
  Lines        3268     3268           
=======================================
  Hits         1499     1499           
  Misses       1686     1686           
  Partials       83       83           

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 685a7f6...a8e4873. Read the comment docs.

Copy link
Contributor

@mmlb mmlb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple small fixes needed but otherwise lgtm. I'd really love it if #584 would land first and then your root.go could be based off of tink-worker's from then, but if not then rebasing and adapting this in #584 would be fine too.

cmd/virtual-worker/Dockerfile Outdated Show resolved Hide resolved
cmd/virtual-worker/main.go Show resolved Hide resolved
@micahhausler
Copy link
Contributor Author

a couple small fixes needed but otherwise lgtm. I'd really love it if #584 would land first and then your root.go could be based off of tink-worker's from then, but if not then rebasing and adapting this in #584 would be fine too.

I'm happy to wait on #584 and reuse cmd code from tink-worker

@micahhausler micahhausler force-pushed the worker/virtual-worker branch from 5417ada to c291002 Compare April 8, 2022 15:55
@mmlb mmlb mentioned this pull request Apr 15, 2022
3 tasks
@micahhausler micahhausler force-pushed the worker/virtual-worker branch from c291002 to 12adba2 Compare April 15, 2022 16:26
@micahhausler micahhausler force-pushed the worker/virtual-worker branch from 12adba2 to 3921cb3 Compare April 18, 2022 21:38
cmd/virtual-worker/cmd/root.go Outdated Show resolved Hide resolved
cmd/virtual-worker/cmd/root.go Outdated Show resolved Hide resolved
cmd/virtual-worker/main.go Show resolved Hide resolved

func getRandHexStr(length int) string {
// intentionally weak RNG. This is only for fake output
r := rand.New(rand.NewSource(time.Now().UnixNano()))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

G404: Use of weak random number generator (math/rand instead of crypto/rand)

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@micahhausler micahhausler force-pushed the worker/virtual-worker branch from 3921cb3 to 2c1045c Compare April 19, 2022 16:40
Signed-off-by: Micah Hausler <[email protected]>
@micahhausler micahhausler force-pushed the worker/virtual-worker branch from 2c1045c to c4d4735 Compare April 19, 2022 16:47
@mmlb mmlb added the ready-to-merge Signal to Mergify to merge the PR. label Apr 19, 2022
@mmlb mmlb removed the request for review from displague April 19, 2022 19:57
@mergify mergify bot merged commit 2b87714 into tinkerbell:main Apr 19, 2022
@displague displague added this to the 0.7.0 milestone Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Signal to Mergify to merge the PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants