-
Notifications
You must be signed in to change notification settings - Fork 80
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
Use github.com/tinkerbell/dhcp
library:
#337
Conversation
This is an improved DHCP library. The package layout has been updated to improve the reflection of the services that Boots runs. The `cmd/boots` package has been remove and main.go is not top level. The extra packages are necessary. References to `cmd/boots` were removed. test directory and docker-compose were updated to work with these changes. The cli flags and env vars have been updated and reorganized by function (syslog, dhcp, tftp, http ipxe binaries, http ipxe scripts). This helps func main be to more understandable. The phonehome endpoint and all `/_packet` were removed. These were old deprecated endponts that don't serve much purpose now. The syslog package was updated to handle shutdown via context, so that it can be used like the other services with `errgroup`. Update nix shell file to use Go 1.20. Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
There isn't a strong enough case for the backend code to have its own package. Signed-off-by: Jacob Weinstock <[email protected]>
This enables honoring the `http-ipxe-binary-enabled` and `http-ipxe-script-enabled` if they both are disabled. Signed-off-by: Jacob Weinstock <[email protected]>
This sorts the flags in the usage output by the service name in between the brackets "[]" in the usage string. Signed-off-by: Jacob Weinstock <[email protected]>
Clarify Boots interoperability with existing DHCP servers. Update flag and env var references. Add section on the services Boots provides. Signed-off-by: Jacob Weinstock <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #337 +/- ##
=====================================
+ Coverage 13% 30% +16%
=====================================
Files 18 6 -12
Lines 1732 426 -1306
=====================================
- Hits 233 129 -104
+ Misses 1482 288 -1194
+ Partials 17 9 -8
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Order by service name in the "[]" and the flag name. Signed-off-by: Jacob Weinstock <[email protected]>
Hey @chrisdoherty4, apologies that this PR is so large. It's a significant library change so i was unable to avoid this churn. We can go over it together if that would help. I can do this in our open forum community meeting if that works. |
This helps clarify data translation between the handler.BackendReader and script.Data. Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
HandlerMapping type in the http package allows func main to not need the stdlib http package and thus allowing bhttp to be http. Signed-off-by: Jacob Weinstock <[email protected]>
Simpler use of go run makes it easier to understand and lessens the make fu needed. Signed-off-by: Jacob Weinstock <[email protected]>
Improve clarity of purpose. Signed-off-by: Jacob Weinstock <[email protected]>
The previous version was doing what goimports was already doing. Signed-off-by: Jacob Weinstock <[email protected]>
While i prefer single command main funcs to live top level, the top level has a lot of files aleady and it felt more difficult to see and understand the Go files when they lived at the top level. Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
.golangci.yml
Outdated
@@ -106,7 +106,8 @@ linters: | |||
- asciicheck | |||
- bodyclose | |||
- cyclop | |||
- deadcode | |||
# deprecated | |||
# - deadcode |
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.
Do you want to just delete these? I don't think there's a reason to leave them in given we don't intend to reenable.
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.
ah yes, fixed.
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.
Minimal feedback as everything seems good.
} | ||
|
||
func backendFlags(c *config, fs *flag.FlagSet) { | ||
fs.BoolVar(&c.backends.file.Enabled, "backend-file-enabled", false, "[backend] enable the file backend for DHCP and the HTTP iPXE script") |
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.
It seems like I could specify --backend-file-enabled
and --backend-kube-enabled
without any explicit error?
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.
yes, correct. fixed now.
cmd/boots/flag_test.go
Outdated
-osie-url [http] url where OSIE(Hook) images are located | ||
-tink-server [http] ip:port for the Tink server | ||
-tink-server-tls [http] use TLS for Tink server (default "false") | ||
-trusted-proxies [http] comma separated list of trusted proxies |
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.
IPs or CIDRs or Domains?
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.
CIDRs. added to the description.
cmd/boots/flag_test.go
Outdated
-extra-kernel-args [http] extra set of kernel args (k=v k=v) that are appended to the kernel cmdline iPXE script | ||
-http-addr [http] local IP and port to listen on for iPXE http script requests (default "%[1]v:80") | ||
-http-ipxe-binary-enabled [http] enable iPXE http binary server (default "true") | ||
-http-ipxe-script-enabled [http] enable iPXE http script server) (default "true") |
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.
-http-ipxe-script-enabled [http] enable iPXE http script server) (default "true") | |
-http-ipxe-script-enabled [http] enable iPXE http script server (default "true") |
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.
fixed
cmd/boots/flag_test.go
Outdated
-http-addr [http] local IP and port to listen on for iPXE http script requests (default "%[1]v:80") | ||
-http-ipxe-binary-enabled [http] enable iPXE http binary server (default "true") | ||
-http-ipxe-script-enabled [http] enable iPXE http script server) (default "true") | ||
-osie-url [http] url where OSIE(Hook) images are located |
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.
-osie-url [http] url where OSIE(Hook) images are located | |
-osie-url [http] URL where OSIE(Hook) images are located |
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.
fixed
want := fmt.Sprintf(`USAGE | ||
Run Boots server for provisioning | ||
|
||
FLAGS |
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 are a number of acronym inconsistencies in the help. ip
vs IP
, http
vs HTTP
.
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.
fixed
cmd/boots/main.go
Outdated
|
||
// ipxeScript is is needed to be able to translate the handler.BackendReader | ||
// returned data to the script.Data struct. | ||
type ipxeScript struct { |
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.
It seems odd for this to live here?
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.
ah yes, updated to a better place.
This was in main package but didnt make sense being there. Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
Also fixed some typos. Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
95f67ee
to
0d80274
Compare
Signed-off-by: Jacob Weinstock <[email protected]>
Description
This is an improved DHCP library. The package layout has been updated to improve the reflection of the services that Boots runs.
test
directory and docker-compose were updated to work with these changes.The cli flags and env vars have been updated and reorganized by function (syslog, dhcp, tftp, http ipxe binaries, http ipxe scripts). This helps func main be to more understandable.
The phonehome endpoint and all
/_packet
were removed. These were old deprecated endponts that don't serve much purpose now.The syslog package was updated to handle shutdown via context, so that it can be used like the other services with
errgroup
.Update nix shell file to use Go 1.20.
Why is this needed
Fixes: #266
Fixes: #195
How Has This Been Tested?
How are existing users impacted? What migration steps/scripts do we need?
Checklist:
I have: