-
Notifications
You must be signed in to change notification settings - Fork 98
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
spike: Create a kairos "installer" #2968
Comments
I would love to see a factory provisioning step added for this, ideally this would be a yip/cloudconfig file that is loaded at installation to augment the installation process that is not persisted to the system. I have gotten called out on security audits for leaving installation scripts on deployed devices as it gives more information than is needed to a potential hacker about how the system is bootstrapped. Currently we run things in kairos-uki-install.after:
- commands:
- | which allow us to add unique keys, names, capture device identities, etc. and then at the end of that stage, before the first boot, we actually remove that whole block like this: # Cleanup unwanted stages from YAML file
echo "Cleaning up the bootstrapping instructions"
/oem/yq eval -i 'del(.stages."kairos-uki-install.after")' /oem/90_custom.yaml
rm /oem/yq It works, but it feels crude and fragile. If I could just add another cloud-config to the install process (we use a PiKVM to mount a unique disks to each device, one the Kairos installer, the other the |
We need to first spend a bit of time in designing an architecture (high-level) which satisfies our current needs before jumping directly into implementing a solution. Moving to a spike |
I was thinking of trying https://zarf.dev for k3s and up, might also be interesting for kairos? |
had a look at this and while its nice and it fills some of our gaps (single binary, yummy!) its also heavily skewed towards runnig as part of a k8s cluster :( Ideally we want to have something like this:
And that would build a container with all the bits and blops inside to be either used to build an iso with AuroraBoot or use it directly as upgrade source for a existing kairos system. So lowing the barrier of converting an existing container into a kairos-ready container. kairos-init should:
Those seem like the minimal things we need to get a kairos ready container. Nice things to have:
|
This would be awesome. This way, maybe we can implement the complex process of installing the "firmware" package and then removing all unnecessary drivers from uki images in go so we can create smaller bootable ISOs for trusted boot.
Is this meant to be used in CI? It's not a bad idea but I would postpone it a bit to first get the basic functionality.
Most of the things
If people need to do additional stuff on top of our base images, shouldn't they just create their own Dockerfiles? Is
See my previous comment.
Relevant: #1546
I'm not sure if I like this or not. I was thinking that this tool would replace Dockerfiles making it easier to understand what we install/run/whatever. This suggestion here, goes towards a declarative "build recipe". So instead of the Go code, the steps will be defined in a config which is yet another moving part. To be honest, I'd rather have everything hardcoded in Go than having yamls modifying the process. |
No but the idea of enabling disable things in a more dynamic nature, means that things need to be ordered so tey trigger at the correct time :D
Well, maybe but its a nice way of ordering things and if we expect in the future to have toggle features that you can enabled/disable maybe its the way to go?
I have no idea, but I was thinking also about our usecase. Plugins could work for things like different arches or different boards, without needing to fully change the code.
Im just saying that at one point somebody is gonna ask for that. Because they need to do X or they need do Y and we will need to add it sooner or later. Just thinking about having it in place and getting it out of the way looool |
The discussion goes back to the scope of this tool. If it's meant to help people build Kairos derivatives, then people might ask for such things, yes. But if it's only meant to create our official images, then we don't need any hooks. We make it part of the regular steps and we are done. If we allow dynamically extending what the tool does, we are in danger of implementing our own generic alternative of Dockerfiles which was not the goal. What we want, is an alternative to Dockerfiles, only for one specific case, ours. |
OK cool, that makes it clearer then! I was thinking that this may be used like the factory to generate kairos images for anybody, but indeed, if its used inside a dockerfile then it makes sense that people will build the derivatives with docker as they do now. |
@kairos-io/maintainers ^ thoughts? Let's agree on the scope of the tool before we proceed. |
btw, I wouldn't even create releases of the tool. We can build it from source (specific git hash) in the dockerfile in a separate stage ( |
💯
On top of my mind I would add:
mh albeit useful, this is going to make things really complex, so we should limit it in a way or another. My take here is to introduce e.g. the concept of "profiles" that encapsulates a ruleset, and avoid completely free-form configuration.
good point here. Kernel selection and system packages can be tricky. I would provide a flag instead to piggyback that to the user if possible these (e.g. --no-kernel-install, --no-firmware-install, etc.) or even assume all the packages are already installed (e.g. to drop only static files).
I think this should be part of the kairos init command, and we should assume that is run at the end of the Dockerfile always. At that point I expect no other action to be made (e.g. rebuilding initrd).
No strong preference here, but if we see that many of the steps can be run in parallel then would make totally sense
I'm having a bit of mixed feelings on this: I would rather simply let the user define any other change/configuration before invoking
ditto on the above
That'd be super-useful!
I'm leaning towards @jimmykarily 's points here. I'd probably stick with some concept like "build profiles". This is because mainly kairos-init isn't meant to run during runtime, but only as a build-only command.
It definitely should and this is one of the most important parts: we want replace instructions that redirect the user to select framework images when going over the current BYOI flow. We should provide then an option to just download a binary of a specific version, and run a command on it instead of have to mangle with Dockerfile or Earthfiles and pinning framework images. If not part of the agent, the kairos init command should be a standalone binary and be treated as a first-class citizen. |
ok, a basic form of it is now under https://github.com/Itxaka/kairos-init
Another example of a multi-distro Dockerfile can be found at the kairos PR #3044
That can generate different container images based on the FLAVOR arg so you can do:
And it will build with the proper base ubuntu image. As this was only a spike and we got other cards to investigate other tools, I think this can be closed. Takeaways:
If other tools can provide something similar to this we should jump on it. Pulumi, cuelang, packaer, etc.. will provide the building blocks against this, so if our side was config only, it would be much nicer that doing it from scratch. On the other side, building it ourselves allows us to have very specific things (like kernel firmware removal, kdump enblement and such) which may be difficult to plug into this third party tools. |
Overall it looks great to me, I can see many of the benefits it will bring. I'm still hesitant to see how the final maintenance of this will be once all the different flavors, boards, variation, uki/non-uki, etc. are introduced on top of the MVP, but I can see why the benefits might still outweigh the drawbacks on that. Great job everyone, and sorry to jump on the discussion so late |
Follow up on #3045 |
Right now, the way to create a Kairos "derivative" image is to either feed a base image to our dockerfiles of take one of our images and use it as a base image for another dockerfile.
Our dockerfiles are rather complex and the logic very hard to follow. This makes them very difficult to extend and test.
Also, using dockerfiles, makes docker a hard dependency (or some other tool that can build dockerfiles anyway).
We could move all the dockerfile logic in a go binary (let's call it the "installer" for now but we need a better name to avoid confusion with the agent that installs Kairos on the machines). By doing that, one would simply run the binary inside an OS and all the dependencies to make it a Kairos OS would be installed with no additional dependencies.
The text was updated successfully, but these errors were encountered: