-
Notifications
You must be signed in to change notification settings - Fork 15
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
Address the way kraken calls services #185
Comments
synackd
pushed a commit
to synackd/kraken
that referenced
this issue
Jul 15, 2020
Merged
jlowellwofford
pushed a commit
that referenced
this issue
Jul 17, 2020
* kraken-build: Add uKraken() and -uroot option * Add copying block for kraken files * Update kraken modules with oitai10/copy * Correct module errors * Usage: -uroot prints that it needs dst path * Add building of kraken for u-root At this point, the u-root version of the kraken source tree is simply a clone of kraken proper. Building creates a "main" binary. Both of these will be updated subsequently. * Rename 'main' to 'kraken' after u-root build * Simplify rename error checking * Print where u-root kraken is being generated * Be more verbose with rename error * u-root: copy kraken src & compile templates * -uroot: compile into "src" instead of "tmp" * -uroot: utmpDir -> usrcDir for build routine * Add u-root source generation mode to kraken Consists of the following WIP commits: - Create custom kraken templates for u-root This aims to solve the import path errors of the following format: \# github.com/u-root/u-root/cmds/exp/kraken/src ./main.go:169:23: cannot use any (type *"github.com/u-root/u-root/cmds/exp/kraken/vendor/github.com/golang/protobuf/ptypes/any".Any) as type *"github.com/hpc/kraken/vendor/github.com/golang/protobuf/ptypes/any".Any in argument to restapi.UpdateConfig 2019/09/16 00:59:36 failed to build linux-amd64 for u-root: exit status 2 - Replace hpc/kraken with u-root/u-root/cmds/exp/kraken This is to avoid import errors in the generated kraken source tree for u-root. - Distinguish DeepSearchAndReplace from SimpleSearchAndReplace - Fix search/replace recursion * kraken -> kraken-tpl * main.go -> kraken.go * Remove building kraken binary for u-root * Add a kraken config for UEFI firmware build * uefi.yaml: Shrink dependencies * Don't copy "vendor" folder (not used) * uefi.yaml: Fix description comment * Update go.sum * Clarify comments and switch verbose & err blocks * Get rid of "ukraken" dir * Add descrioptive comment to uCompileTemplates() * uKraken: Touch up some comments * Update go.mod * Move search/replace functions from kraken-build to lib * go.sum: Update oitai10/copy * Tidy up module dependencies * buildutil.go: "go-ify" function comments * Go-ify documentation comments for uKraken and uCompileTemplates * Simplify large if-else in uKraken() * Move u-root checking from main() to checkUrootOpt() * checkUrootOpt: Pass variables from main * uroot: Overwrite destination files if -force passed * Fix import path replacement These blocks are to prevent trouble when testing on the synackd fork. Before this is merged into the main repository (hpc), these need to be removed. * Replace further hpc/kraken with synackd/kraken This also needs to be reverted before merging. * Convert uroot source generation from CLI flag to build target * go.mod: replace: Use current directory * kraken.yml: Revert to using this fork * kraken.yml: u-kraken branch * uefi.yaml: Add websocket, pxe modules/extensions * kraken-build: Move config parsing to separate function * kraken-build: Move build procedure to own function This is to eliminate complexity in the main() function to satisfy the CodeFactor checks. This commit also updates the names of some kraken helper functions to distinguish between u-root variants from the standard kraken functions. * kraken-build.go: Replace lines in ServiceInstance.go to make u-root work * kraken-build: Only copy needed files for u-root source generation kraken-build will parse the YAML config and only copy over the modules and extensions listed there, as well as core/ and lib/. It will also replace all regular kraken import paths of the form: github.com/hpc/kraken/* with import paths leading to the u-root build directory: github.com/hpc/kraken/build/u-root/* in all of the copied ("generated") files. Separate core/ and lib/ are needed for the u-root build target because u-root's BusyBox method will not allow kraken services to have a separate "[kraken:<service_ID>]" argv[0], whereas this will work fine for other build targets. * kraken-build: argv[0] for all kraken services in u-root initramfs Kraken executes itself using a differing argv0 of the format [kraken:<service_ID>] for each service. Since u-root uses a singe BusyBox and symlinks to execute commands, this will not work. So, when generating a source tree for u-root, the aforementioned format will be replace by simply argv[0] (how kraken itself was called). * kraken-build: Move extension/module copying to separate functions * kraken-build: Condense error if-blocks * kraken-build: Move source-copying to separate function * kraken-build: Move source modification to own function * Add regex replacement funcs, use for import path replacement * buildutil: One function for simple/recursive funcs * Fix typo in error message * Remove config/uefi.yaml (not used yet) * Revert go.mod: revert statement * Revert kraken.yml: Use master branch for vbox example * kraken-build: Unify compileTemplates for both main and u-root targets * compileTemplates: Include reference to #184 * modifySources: Include reference to #185 * Rewrite copy function (#1) * Add copy library * Integrate copy library with kraken-build * cmp: Condense IsEqualFile()
Resolved by #220 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, the way that kraken launches services is that it calls kraken with an
argv[0]
of the format[kraken:<service_ID>]
; however, since u-root uses a single BusyBox binary with symlinks for each command, it will not be able to "find" kraken when doing this since the binary usesargv[0]
to determine what command was called.We should consider modifying this mechanism to avoid hack solutions when generating u-root-compatible kraken source trees (e.g. modifying the service-launching code during generation).
The text was updated successfully, but these errors were encountered: