-
Notifications
You must be signed in to change notification settings - Fork 28
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
ignition: add support for ignition config file #209
Conversation
Skipping CI for Draft Pull Request. |
cmd/vfkit/main.go
Outdated
if err != nil { | ||
return err | ||
} | ||
defer file.Close() |
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 dont know what the policy is on this project, but recently we have starting capturing the error here and logrus it
pkg/config/config.go
Outdated
} | ||
|
||
socketPath := filepath.Join(os.TempDir(), "ignition.sock") | ||
dev, err := VirtioVsockNew(1024, socketPath, 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.
pop to const ?
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.
and maybe line above?
cmd/vfkit/main.go
Outdated
@@ -86,6 +91,10 @@ func newVMConfiguration(opts *cmdline.Options) (*config.VirtualMachine, error) { | |||
return nil, err | |||
} | |||
|
|||
if err := vmConfig.AddIgnitionFileFromCmdLine(opts.IgnitionPath); err != nil { | |||
return nil, err |
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.
perhaps consider wrapping this here to make it meaningful
cmd/vfkit/main.go
Outdated
@@ -198,3 +216,37 @@ func runVirtualMachine(vmConfig *config.VirtualMachine, vm *vf.VirtualMachine) e | |||
|
|||
return <-errCh | |||
} | |||
|
|||
func startServer(ignitionFile string, ignitionSocketPath string) 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.
consider passing ignitionFile as a reader
flyby review, nice work work @lstocchi ... all my comments are largely things to think about, neat idea too. |
fec258c
to
0e8abdd
Compare
@baude thanks for the suggestions. Hopefully I got all of them. 👍 Gonna add some tests tomorrow morning so that it can be reviewed again |
@lstocchi being that ignition is on the rarer side of things, I wonder you should create |
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.
Just the proposal to add an example file comment ... lgtm otherwise
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.
Looks great, thanks for working on this new feature!
it adds support to pass an ignition config file to vfkit that handles the provisioning process. Vfkit start a small server, listening to a unix socket to feed the config file, and create a virtio-vsock device using port 1024. This will be used by Ignition that read its configuration using an HTTP GET over a vsock connection on port 1024. Server code taken from https://github.com/containers/podman/blob/6487940534c1065d6c7753e3b6dfbe253666537d/pkg/machine/applehv/ignition.go Signed-off-by: Luca Stocchi <lstocchi@redhat.com>
Signed-off-by: Luca Stocchi <lstocchi@redhat.com>
it updates the doc to explain how the ignition flag is used. It also adds a new section under contrib where to store an example of configuration and link to the ignition website for more details about specification, mime type and other examples. Signed-off-by: Luca Stocchi <lstocchi@redhat.com>
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
/approve
func startIgnitionProvisionerServer(ignitionReader io.Reader, ignitionSocketPath string) error { | ||
mux := http.NewServeMux() | ||
mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { | ||
_, err := io.Copy(w, ignitionReader) |
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.
This could use https://pkg.go.dev/net/http#ServeContent (no need to make this change right, this can be a follow-up)
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: baude, cfergeau The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
it adds support to pass an ignition config file to vfkit that handles the provisioning process.
it resolves #124