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

osbuild-runner: run osbuild in an ec2 vm #3939

Merged
merged 8 commits into from
Feb 14, 2024

Conversation

croissanne
Copy link
Member

@croissanne croissanne commented Feb 9, 2024

No description provided.

@croissanne croissanne force-pushed the osbuild-in-vm branch 7 times, most recently from c6dc11f to 002fc04 Compare February 12, 2024 11:08
@croissanne croissanne marked this pull request as ready for review February 12, 2024 11:10
@croissanne croissanne force-pushed the osbuild-in-vm branch 3 times, most recently from b40338a to 312a5fd Compare February 12, 2024 12:03
@croissanne croissanne changed the title Osbuild in vm osbuild-runner: run osbuild in an ec2 vm Feb 12, 2024
@croissanne
Copy link
Member Author

I just realised, since this machine will still need to be subscribed, we also need the ability to add a role to read a single secret.

@croissanne croissanne force-pushed the osbuild-in-vm branch 5 times, most recently from 0faf1f3 to 72c5a35 Compare February 12, 2024 17:06
@croissanne croissanne force-pushed the osbuild-in-vm branch 2 times, most recently from 4947409 to 8308487 Compare February 12, 2024 18:43
@croissanne croissanne requested a review from bcl February 12, 2024 18:48
@croissanne croissanne force-pushed the osbuild-in-vm branch 2 times, most recently from b3008b6 to 93b9447 Compare February 12, 2024 19:14
supakeen
supakeen previously approved these changes Feb 12, 2024
cmd/osbuild-worker/config.go Outdated Show resolved Hide resolved
Copy link
Contributor

@bcl bcl left a comment

Choose a reason for hiding this comment

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

All my comments except one are cosmetic :) The only actual change I think it needs is a worst-case timeout on the exec.Command

Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

Thank you, this looks very nice. I really like the attention of detail in the security setup! I add a whole bunch of ideas/suggestions and also have some questions. All is just nitpicks or personal preferences, feel free to ignore them if you have different preferences or opinions :) Hope this is useful.

cmd/osbuild-worker/jobimpl-osbuild.go Show resolved Hide resolved
cmd/osbuild-worker/config.go Outdated Show resolved Hide resolved
cmd/osbuild-worker/config.go Show resolved Hide resolved
internal/cloud/awscloud/secure-instance.go Outdated Show resolved Hide resolved
internal/cloud/awscloud/secure-instance.go Outdated Show resolved Hide resolved
internal/cloud/awscloud/secure-instance.go Show resolved Hide resolved
internal/cloud/awscloud/secure-instance.go Outdated Show resolved Hide resolved
internal/cloud/awscloud/secure-instance.go Show resolved Hide resolved
internal/osbuildexecutor/osbuild-executor.go Show resolved Hide resolved
cmd.Stdout = stdout
cmd.Stderr = stderr

err = cmd.Start()
Copy link
Contributor

Choose a reason for hiding this comment

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

A bit of a meta-question - given that osbild-jobsite-manager is part of this repo and written in go, why is it not used directly from go code, why the extra indirection via a os/exec and the json? is it for robustness, i.e. a crashing osbuild-jobsite-manager would not affect the service? or is there a different/deeper reason?

Copy link
Member Author

Choose a reason for hiding this comment

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

@supakeen implemented the manager as a separate process, and I don't think there's a way to invoke it currently directly from go.

As to the reason, maybe to avoid sharing secrets between the processes? Or if the builder could somehow make the manager do something weird, it would be contained within that process?

Copy link
Member

@supakeen supakeen Feb 14, 2024

Choose a reason for hiding this comment

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

It's a layer of separation here; the worker might/will spawn multiple managers for multiple builders and/or run them inside containers or separate network namespaces.

Robustness and allowing users to run the manager/worker separately from the rest of the stack also plays a role.

Wrap the current osbuildexecutor.Executor in an interface so it's easier
to add different executors, which for instance can run osbuild in a VM.
@croissanne croissanne force-pushed the osbuild-in-vm branch 2 times, most recently from 1752fb3 to e472ecf Compare February 13, 2024 14:12
This instance can only contact the host, and requires this host to be
running on AWS itself with the appropriate IAM role.
This way the `worker-initialization.service` knows to spin up the
builder instead of the worker.
This executor spins up an instance which can only contact the host, and
uses the osbuild-jobsite manager & builder to invoke osbuild.
@croissanne croissanne merged commit d0caac9 into osbuild:main Feb 14, 2024
69 of 72 checks passed
@croissanne croissanne deleted the osbuild-in-vm branch February 14, 2024 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants